bundler

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 32 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bundler compiles TSX apps into the scripts the tsx package runs, as NSH's bundler does (nsh-bundler): esbuild strips TypeScript, lowers syntax goja lacks and bundles the app's modules into one script, and jsx.go compiles the JSX into calls of the renderer, as NSH's compiler does. Imports of NSGo's modules (nsgo, nsgo/*, nsgo:rt) stay, as require calls the runtime answers. No Node is needed.

The nsgo tool links it, so it imports from NSGo only core and internal/driver, never the runtime (layering_test.go).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(fsys fs.FS, entry string) (string, error)

Compile compiles the app whose entry is entry in fsys, and the modules it imports, into one script with its source map inline.

func CompileHot

func CompileHot(fsys fs.FS, entry string) (string, error)

CompileHot compiles the app as Compile does, for hot updates: a newer bundle run in the VM of an older one (tsx.Hot) runs again only the modules whose code changed and renders their components' instances again, so the rest of the app keeps its state.

func CompileSplit

func CompileSplit(fsys fs.FS, entry string) (main string, chunks map[string]string, err error)

CompileSplit compiles the app whose entry is entry in fsys as Compile does, but for its import()s of its own modules: main is the entry's script, and chunks the scripts the runtime loads for them, by key.

func Transform

func Transform(file, src string) (string, error)

Transform compiles one module: its TypeScript stripped and its JSX compiled, as CommonJS with its source map inline.

Types

type Error

type Error struct {
	File         string
	Line, Column int // 1-based
	Message      string
}

An Error is a compile error at a place in the app's source.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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