{"id":13812474,"url":"https://github.com/lithdew/quickjs","last_synced_at":"2025-08-21T09:32:25.169Z","repository":{"id":49380390,"uuid":"278329106","full_name":"lithdew/quickjs","owner":"lithdew","description":"Go bindings to QuickJS: a fast, small, and embeddable ES2020 JavaScript interpreter.","archived":false,"fork":false,"pushed_at":"2020-12-30T01:16:03.000Z","size":532,"stargazers_count":146,"open_issues_count":2,"forks_count":37,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-05-02T03:39:37.769Z","etag":null,"topics":["es2020","golang","javascript","quickjs"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lithdew.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}},"created_at":"2020-07-09T10:04:36.000Z","updated_at":"2024-05-02T03:39:37.770Z","dependencies_parsed_at":"2022-08-25T08:11:14.789Z","dependency_job_id":null,"html_url":"https://github.com/lithdew/quickjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lithdew/quickjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fquickjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fquickjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fquickjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fquickjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lithdew","download_url":"https://codeload.github.com/lithdew/quickjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lithdew%2Fquickjs/sbom","scorecard":{"id":592831,"data":{"date":"2025-08-11","repo":{"name":"github.com/lithdew/quickjs","commit":"aaa42285c9d2d101135484c60c41cc68e213b4c9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T22:24:05.193Z","repository_id":49380390,"created_at":"2025-08-20T22:24:05.194Z","updated_at":"2025-08-20T22:24:05.194Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271455616,"owners_count":24762759,"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-08-21T02:00:08.990Z","response_time":74,"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":["es2020","golang","javascript","quickjs"],"created_at":"2024-08-04T04:00:52.318Z","updated_at":"2025-08-21T09:32:24.771Z","avatar_url":"https://github.com/lithdew.png","language":"C","readme":"# quickjs\n\n[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](LICENSE)\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/lithdew/quickjs)\n[![Discord Chat](https://img.shields.io/discord/697002823123992617)](https://discord.gg/HZEbkeQ)\n\nGo bindings to [QuickJS](https://bellard.org/quickjs/): a fast, small, and embeddable [ES2020](https://tc39.github.io/ecma262/) JavaScript interpreter.\n\nThese bindings are a WIP and do not match full parity with QuickJS' API, though expose just enough features to be usable. The version of QuickJS that these bindings bind to may be located [here](version.h).\n\nThese bindings have been tested to cross-compile and run successfully on Linux, Windows, and Mac using gcc-7 and mingw32 without any addtional compiler or linker flags.\n\n## Usage\n\n```\n$ go get github.com/lithdew/quickjs\n```\n\n## Guidelines\n\n1. Free `quickjs.Runtime` and `quickjs.Context` once you are done using them.\n2. Free `quickjs.Value`'s returned by `Eval()` and `EvalFile()`. All other values do not need to be freed, as they get garbage-collected.\n3. You may access the stacktrace of an error returned by `Eval()` or `EvalFile()` by casting it to a `*quickjs.Error`.\n4. Make new copies of arguments should you want to return them in functions you created.\n5. Make sure to call `runtime.LockOSThread()` to ensure that QuickJS always operates in the exact same thread.\n\n## Example\n\nThe full example code below may be found by clicking [here](examples/main.go). Find more API examples [here](quickjs_test.go).\n\n```go\npackage main\n\nimport (\n\t\"errors\"\n\t\"flag\"\n\t\"fmt\"\n\t\"github.com/lithdew/quickjs\"\n\t\"strings\"\n)\n\nfunc check(err error) {\n\tif err != nil {\n\t\tvar evalErr *quickjs.Error\n\t\tif errors.As(err, \u0026evalErr) {\n\t\t\tfmt.Println(evalErr.Cause)\n\t\t\tfmt.Println(evalErr.Stack)\n\t\t}\n\t\tpanic(err)\n\t}\n}\n\nfunc main() {\n\truntime := quickjs.NewRuntime()\n\tdefer runtime.Free()\n\n\tcontext := runtime.NewContext()\n\tdefer context.Free()\n\n\tglobals := context.Globals()\n\n\t// Test evaluating template strings.\n\n\tresult, err := context.Eval(\"`Hello world! 2 ** 8 = ${2 ** 8}.`\")\n\tcheck(err)\n\tdefer result.Free()\n\n\tfmt.Println(result.String())\n\tfmt.Println()\n\n\t// Test evaluating numeric expressions.\n\n\tresult, err = context.Eval(`1 + 2 * 100 - 3 + Math.sin(10)`)\n\tcheck(err)\n\tdefer result.Free()\n\n\tfmt.Println(result.Int64())\n\tfmt.Println()\n\n\t// Test evaluating big integer expressions.\n\n\tresult, err = context.Eval(`128n ** 16n`)\n\tcheck(err)\n\tdefer result.Free()\n\n\tfmt.Println(result.BigInt())\n\tfmt.Println()\n\n\t// Test evaluating big decimal expressions.\n\n\tresult, err = context.Eval(`128l ** 12l`)\n\tcheck(err)\n\tdefer result.Free()\n\n\tfmt.Println(result.BigFloat())\n\tfmt.Println()\n\n\t// Test evaluating boolean expressions.\n\n\tresult, err = context.Eval(`false \u0026\u0026 true`)\n\tcheck(err)\n\tdefer result.Free()\n\n\tfmt.Println(result.Bool())\n\tfmt.Println()\n\n\t// Test setting and calling functions.\n\n\tA := func(ctx *quickjs.Context, this quickjs.Value, args []quickjs.Value) quickjs.Value {\n\t\tfmt.Println(\"A got called!\")\n\t\treturn ctx.Null()\n\t}\n\n\tB := func(ctx *quickjs.Context, this quickjs.Value, args []quickjs.Value) quickjs.Value {\n\t\tfmt.Println(\"B got called!\")\n\t\treturn ctx.Null()\n\t}\n\n\tglobals.Set(\"A\", context.Function(A))\n\tglobals.Set(\"B\", context.Function(B))\n\n\t_, err = context.Eval(`for (let i = 0; i \u003c 10; i++) { if (i % 2 === 0) A(); else B(); }`)\n\tcheck(err)\n\n\tfmt.Println()\n\n\t// Test setting global variables.\n\n\t_, err = context.Eval(`HELLO = \"world\"; TEST = false;`)\n\tcheck(err)\n\n\tnames, err := globals.PropertyNames()\n\tcheck(err)\n\n\tfmt.Println(\"Globals:\")\n\tfor _, name := range names {\n\t\tval := globals.GetByAtom(name.Atom)\n\t\tdefer val.Free()\n\n\t\tfmt.Printf(\"'%s': %s\\n\", name, val)\n\t}\n\tfmt.Println()\n\n\t// Test evaluating arbitrary expressions from flag arguments.\n\n\tflag.Parse()\n\tif flag.NArg() == 0 {\n\t\treturn\n\t}\n\n\tresult, err = context.Eval(strings.Join(flag.Args(), \" \"))\n\tcheck(err)\n\tdefer result.Free()\n\n\tif result.IsObject() {\n\t\tnames, err := result.PropertyNames()\n\t\tcheck(err)\n\n\t\tfmt.Println(\"Object:\")\n\t\tfor _, name := range names {\n\t\t\tval := result.GetByAtom(name.Atom)\n\t\t\tdefer val.Free()\n\n\t\t\tfmt.Printf(\"'%s': %s\\n\", name, val)\n\t\t}\n\t} else {\n\t\tfmt.Println(result.String())\n\t}\n}\n```\n\n```\n$ go run examples/main.go '(() =\u003e ({hello: \"world\", test: 2 ** 3}))()'\nHello world! 2 ** 8 = 256.\n\n197\n\n5192296858534827628530496329220096\n\n1.9342813113834066795e+25\n\nfalse\n\nA got called!\nB got called!\nA got called!\nB got called!\nA got called!\nB got called!\nA got called!\nB got called!\nA got called!\nB got called!\n\nGlobals:\n'Object': function Object() {\n    [native code]\n}\n'Function': function Function() {\n    [native code]\n}\n'Error': function Error() {\n    [native code]\n}\n'EvalError': function EvalError() {\n    [native code]\n}\n'RangeError': function RangeError() {\n    [native code]\n}\n'ReferenceError': function ReferenceError() {\n    [native code]\n}\n'SyntaxError': function SyntaxError() {\n    [native code]\n}\n'TypeError': function TypeError() {\n    [native code]\n}\n'URIError': function URIError() {\n    [native code]\n}\n'InternalError': function InternalError() {\n    [native code]\n}\n'AggregateError': function AggregateError() {\n    [native code]\n}\n'Array': function Array() {\n    [native code]\n}\n'parseInt': function parseInt() {\n    [native code]\n}\n'parseFloat': function parseFloat() {\n    [native code]\n}\n'isNaN': function isNaN() {\n    [native code]\n}\n'isFinite': function isFinite() {\n    [native code]\n}\n'decodeURI': function decodeURI() {\n    [native code]\n}\n'decodeURIComponent': function decodeURIComponent() {\n    [native code]\n}\n'encodeURI': function encodeURI() {\n    [native code]\n}\n'encodeURIComponent': function encodeURIComponent() {\n    [native code]\n}\n'escape': function escape() {\n    [native code]\n}\n'unescape': function unescape() {\n    [native code]\n}\n'Infinity': Infinity\n'NaN': NaN\n'undefined': undefined\n'__date_clock': function __date_clock() {\n    [native code]\n}\n'Number': function Number() {\n    [native code]\n}\n'Boolean': function Boolean() {\n    [native code]\n}\n'String': function String() {\n    [native code]\n}\n'Math': [object Math]\n'Reflect': [object Object]\n'Symbol': function Symbol() {\n    [native code]\n}\n'eval': function eval() {\n    [native code]\n}\n'globalThis': [object Object]\n'Date': function Date() {\n    [native code]\n}\n'RegExp': function RegExp() {\n    [native code]\n}\n'JSON': [object JSON]\n'Proxy': function Proxy() {\n    [native code]\n}\n'Map': function Map() {\n    [native code]\n}\n'Set': function Set() {\n    [native code]\n}\n'WeakMap': function WeakMap() {\n    [native code]\n}\n'WeakSet': function WeakSet() {\n    [native code]\n}\n'ArrayBuffer': function ArrayBuffer() {\n    [native code]\n}\n'SharedArrayBuffer': function SharedArrayBuffer() {\n    [native code]\n}\n'Uint8ClampedArray': function Uint8ClampedArray() {\n    [native code]\n}\n'Int8Array': function Int8Array() {\n    [native code]\n}\n'Uint8Array': function Uint8Array() {\n    [native code]\n}\n'Int16Array': function Int16Array() {\n    [native code]\n}\n'Uint16Array': function Uint16Array() {\n    [native code]\n}\n'Int32Array': function Int32Array() {\n    [native code]\n}\n'Uint32Array': function Uint32Array() {\n    [native code]\n}\n'BigInt64Array': function BigInt64Array() {\n    [native code]\n}\n'BigUint64Array': function BigUint64Array() {\n    [native code]\n}\n'Float32Array': function Float32Array() {\n    [native code]\n}\n'Float64Array': function Float64Array() {\n    [native code]\n}\n'DataView': function DataView() {\n    [native code]\n}\n'Atomics': [object Atomics]\n'Promise': function Promise() {\n    [native code]\n}\n'BigInt': function BigInt() {\n    [native code]\n}\n'BigFloat': function BigFloat() {\n    [native code]\n}\n'BigFloatEnv': function BigFloatEnv() {\n    [native code]\n}\n'BigDecimal': function BigDecimal() {\n    [native code]\n}\n'Operators': function Operators() {\n    [native code]\n}\n'A': function() { return proxy.call(this, id, ...arguments); }\n'B': function() { return proxy.call(this, id, ...arguments); }\n'HELLO': world\n'TEST': false\n\nObject:\n'hello': world\n'test': 8\n```\n\n## License\n\nQuickJS is released under the MIT license.\n\nQuickJS bindings are copyright Kenta Iwasaki, with code copyright Fabrice Bellard and Charlie Gordon.\n\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithdew%2Fquickjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flithdew%2Fquickjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flithdew%2Fquickjs/lists"}