2026-01-27 10:23:07 -05:00
wip
2026-01-27 10:17:27 -05:00
2026-01-27 10:23:07 -05:00
wip
2026-01-27 10:17:27 -05:00
2026-01-27 09:56:40 -05:00
2026-01-27 10:23:07 -05:00
2026-01-27 09:56:40 -05:00
2026-01-27 09:56:40 -05:00
2026-01-27 10:23:07 -05:00
2026-01-27 10:23:07 -05:00
2026-01-27 10:23:07 -05:00

Poiesis

A Go tool that transpiles TypeScript to JavaScript using esbuild and executes it with goja, with an extensible builtin system.

Project Structure

reichard.io/poiesis/
├── cmd/
│   └── poiesis/          # CLI application entry point
│       └── main.go
├── internal/
│   ├── builtin/          # Builtin function framework
│   │   ├── builtin.go
│   │   └── builtin_test.go
│   └── runtime/          # TypeScript transpilation and execution
│       ├── runtime.go
│       └── runtime_test.go
└── examples/             # Example TypeScript files

Installation & Build

go build ./cmd/poiesis

Testing

go test ./...
golangci-lint run

Usage

poiesis <typescript-file>

Builtin System

The builtin system allows you to easily expose Go functions to TypeScript/JavaScript.

Adding a Builtin

Just write a Go function and register it:

// Your function
func add(a, b int) int {
    return a + b
}

// Register it
func init() {
    builtin.RegisterBuiltin("add", add)
}

That's it! The framework automatically:

  • Converts TypeScript values to Go types
  • Handles errors (panics as JS errors)
  • Generates TypeScript definitions
  • Manages the goja integration

Example

// TypeScript code
console.log("5 + 10 =", add(5, 10));

const response = fetch("https://httpbin.org/get");
console.log("OK:", response.ok);
console.log("Status:", response.status);
console.log("Body:", response.text());

Built-in Functions

  • fetch(url, options?) - HTTP requests
  • add(a, b) - Simple arithmetic example
  • greet(name) - String manipulation example

Dependencies

  • github.com/evanw/esbuild/pkg/api - TypeScript transpilation
  • github.com/dop251/goja - JavaScript execution
  • github.com/stretchr/testify/assert - Test assertions
Description
No description provided
Readme 107 KiB
Languages
Go 98.6%
Nix 1.4%