Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clarkmcc/go-typescript
Compile and run Typescript code natively in Go
https://github.com/clarkmcc/go-typescript
amd evaluate goja module-loader typescript
Last synced: 2 months ago
JSON representation
Compile and run Typescript code natively in Go
- Host: GitHub
- URL: https://github.com/clarkmcc/go-typescript
- Owner: clarkmcc
- License: gpl-3.0
- Created: 2021-03-13T18:48:26.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-07T05:31:14.000Z (over 1 year ago)
- Last Synced: 2024-08-03T09:07:39.846Z (6 months ago)
- Topics: amd, evaluate, goja, module-loader, typescript
- Language: JavaScript
- Homepage:
- Size: 4.74 MB
- Stars: 101
- Watchers: 5
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - go-typescript
README
![](assets/banner.png)
This package provides a thin wrapper around [goja](https://github.com/dop251/goja) (a native Javascript runtime for Go). There are no direct dependencies besides goja, and [testify](https://github.com/stretchr/testify) (for testing only). This package supports the following features:
* Typescript compilation and evaluation.
* A context-aware evaluation API to support cancellation.
* AMD-style modules using the built-in [Almond module loader](https://github.com/requirejs/almond).
* Custom Typescript version registration with built-in support for versions 3.8.3, 3.9.9, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.2.2, 4.2.3, 4.2.4, and 4.7.2.
* 90%+ test coverage
* Used in production world-wide (sponsoring company has evaluated over 1 billion scripts using this runtime)## Installation
go get github.com/clarkmcc/go-typescript
## Examples
* [Transpile Typescript](examples/typescript_test.go)
* [Transpile and Evaluate Typescript](examples/typescript_evaluate_test.go)
* [AMD Modules](examples/typescript_amd_modules_test.go)
* [Context Cancellation](examples/typescript_context_test.go)