{"id":24770302,"url":"https://github.com/jvatic/goja-babel","last_synced_at":"2025-04-06T22:09:13.075Z","repository":{"id":54146318,"uuid":"82740314","full_name":"jvatic/goja-babel","owner":"jvatic","description":"Run babel transforms using Go to transpile your modern JavaScript and JSX.","archived":false,"fork":false,"pushed_at":"2024-10-24T12:18:17.000Z","size":25358,"stargazers_count":60,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-25T12:41:21.736Z","etag":null,"topics":["babel","golang","javascript","react"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jvatic.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":"2017-02-22T00:05:06.000Z","updated_at":"2024-10-24T12:18:22.000Z","dependencies_parsed_at":"2023-12-12T12:27:36.195Z","dependency_job_id":"81013377-9f69-4ec3-b736-8ffce6389dc8","html_url":"https://github.com/jvatic/goja-babel","commit_stats":null,"previous_names":[],"tags_count":127,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvatic%2Fgoja-babel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvatic%2Fgoja-babel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvatic%2Fgoja-babel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvatic%2Fgoja-babel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jvatic","download_url":"https://codeload.github.com/jvatic/goja-babel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"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":["babel","golang","javascript","react"],"created_at":"2025-01-29T03:36:55.260Z","updated_at":"2025-04-06T22:09:13.058Z","avatar_url":"https://github.com/jvatic.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"goja-babel\n==========\n\n[![CI](https://github.com/jvatic/goja-babel/actions/workflows/ci.yml/badge.svg)](https://github.com/jvatic/goja-babel/actions/workflows/ci.yml)\n\nUses github.com/dop251/goja to run babel.js within Go.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/jvatic/goja-babel\"\n)\n\nfunc main() {\n\tbabel.Init(4) // Setup 4 transformers (can be any number \u003e 0)\n\tres, err := babel.Transform(strings.NewReader(`let foo = 1;\n\t\u003cdiv\u003e\n\t\tHello JSX!\n\t\tThe value of foo is {foo}.\n\t\u003c/div\u003e`), map[string]interface{}{\n\t\t\"plugins\": []string{\n\t\t\t\"transform-react-jsx\",\n\t\t\t\"transform-block-scoping\",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tio.Copy(os.Stdout, res)\n\tfmt.Println(\"\")\n}\n```\n\n```js\n$ go run main.go\nvar foo = 1;\n\n/*#__PURE__*/\nReact.createElement(\"div\", null, \"Hello JSX! The value of foo is \", foo, \".\");\n```\n\n## Benchmarks\n\n```\ngo test -bench Transform -benchmem\ngoos: darwin\ngoarch: amd64\npkg: github.com/jvatic/goja-babel\ncpu: Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz\nBenchmarkTransformString-8                    \t      81\t  15642708 ns/op\t 3069085 B/op\t   37243 allocs/op\nBenchmarkTransformStringWithSingletonPool-8   \t      67\t  15820676 ns/op\t 3070920 B/op\t   37244 allocs/op\nBenchmarkTransformStringWithLargePool-8       \t      78\t  15497562 ns/op\t 3070015 B/op\t   37243 allocs/op\nPASS\nok  \tgithub.com/jvatic/goja-babel\t4.993s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjvatic%2Fgoja-babel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjvatic%2Fgoja-babel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjvatic%2Fgoja-babel/lists"}