skyfire

module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2026 License: MIT

README

Skyfire

A fast JavaScript/TypeScript parser library for Go, forked from esbuild.

Why Skyfire?

Skyfire exposes esbuild's internal JavaScript parser as a public Go API. This enables:

  • AST access: Full access to the parsed JavaScript/TypeScript AST
  • Speed: Leverages esbuild's extremely fast parser
  • ES6+ support: Handles modern JavaScript including modules, decorators, and class fields
  • Error reporting: Detailed parse errors with line and column numbers

Use Cases

  • Static analysis of JavaScript/TypeScript code
  • Extracting metadata from ES6 modules (imports, exports, decorators)
  • Building development tools that need to understand JS/TS structure

Installation

go get github.com/octoberswimmer/skyfire

Usage

package main

import (
    "fmt"
    "github.com/octoberswimmer/skyfire/parser"
)

func main() {
    source := `
        import { foo } from 'bar';
        export default class MyClass {
            @api myProperty;
        }
    `

    ast, err := parser.Parse(source, parser.Options{})
    if err != nil {
        fmt.Printf("Parse error: %v\n", err)
        return
    }

    // Access imports, exports, classes, decorators, etc.
    for _, imp := range ast.Imports {
        fmt.Printf("Import: %s\n", imp.Path)
    }
}

License

MIT License - see LICENSE.md

Acknowledgments

This project is a fork of esbuild by Evan Wallace. The core parser code is from esbuild with modifications to expose it as a public API.

Directories

Path Synopsis
cmd
esbuild command
Package cssparser provides a CSS parser with AST access and simple printing.
Package cssparser provides a CSS parser with AST access and simple printing.
internal
ast
fs
js_ast
This file was automatically generated by gen-unicode-table.js.
This file was automatically generated by gen-unicode-table.js.
xxhash
Package xxhash implements the 64-bit variant of xxHash (XXH64) as described at http://cyan4973.github.io/xxHash/.
Package xxhash implements the 64-bit variant of xxHash (XXH64) as described at http://cyan4973.github.io/xxHash/.
Package parser provides a JavaScript/TypeScript parser with full AST access.
Package parser provides a JavaScript/TypeScript parser with full AST access.
pkg
api
This API exposes esbuild's two main operations: building and transforming.
This API exposes esbuild's two main operations: building and transforming.
cli
This API exposes the command-line interface for esbuild.
This API exposes the command-line interface for esbuild.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL