lualib

package
v0.1.0-dev.128 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Lualib bundle builder: transpiles TSTL's lualib TypeScript source into a self-contained lualib_bundle.lua matching TSTL's bundle format.

Index

Constants

This section is empty.

Variables

View Source
var Bundle []byte
View Source
var Bundle50 []byte

Functions

func BuildBundleFromSource

func BuildBundleFromSource(lualibSrcDir, langExtPath, luaTypesPath string, luaTarget transpiler.LuaTarget, overrideDir string, adapters *transpiler.RuntimeAdapters) (string, error)

BuildBundleFromSource transpiles the TSTL lualib TypeScript source files and assembles them into a lualib_bundle.lua. Pass a non-nil adapters to apply user runtime-adapter emitters throughout the bundle.

func BundleForTarget

func BundleForTarget(target string) []byte

BundleForTarget returns the appropriate lualib bundle for the given target. The embedded Bundle / Bundle50 are produced by BuildBundleFromSource at development time (via `just update-lualib`). TestCommittedBundleUpToDate enforces that they stay byte-equivalent to a fresh rebuild from TS sources.

func Middleclass

func Middleclass() []byte

Middleclass returns the embedded kikito/middleclass library source. Used by the ClassStyleMiddleclass emit path; the transpiler injects `require("middleclass")`, and tooling (playground, future bundling) can resolve that require against this source. MIT-licensed; see internal/lualib/middleclass/MIT-LICENSE.txt.

func MinimalBundleForTarget

func MinimalBundleForTarget(target string, usedExports []string) ([]byte, error)

MinimalBundleForTarget returns a slim lualib_bundle.lua containing only the features needed by usedExports (plus their transitive deps), matching TSTL's luaLibImport=require-minimal output.

func Patches

func Patches() []byte

Patches returns the tslua-specific pure-Lua helpers that have no TS source (Map/Set for-of fast paths). BuildBundleFromSource and BuildFeatureDataFromSource fold these in when producing bundles, so they are present in both the committed embedded bundle and any on-demand rebuild.

Types

type FeatureData

type FeatureData = lualibinfo.FeatureData

func BuildFeatureDataFromSource

func BuildFeatureDataFromSource(lualibSrcDir, langExtPath, luaTypesPath string, luaTarget transpiler.LuaTarget, overrideDir string, adapters *transpiler.RuntimeAdapters) (*FeatureData, error)

BuildFeatureDataFromSource transpiles the TSTL lualib TypeScript source files and returns per-feature metadata for selective inlining. Pass a non-nil adapters to apply user runtime-adapter emitters to lualib feature bodies.

func FeatureDataForTarget

func FeatureDataForTarget(target string) (*FeatureData, error)

FeatureDataForTarget returns per-feature lualib data for selective inlining.

type FeatureInfo

type FeatureInfo = lualibinfo.FeatureInfo

Type aliases so lualib consumers don't need to import lualibinfo directly.

type ModuleInfo

type ModuleInfo = lualibinfo.ModuleInfo

Jump to

Keyboard shortcuts

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