Documentation
¶
Overview ¶
Lualib bundle builder: transpiles TSTL's lualib TypeScript source into a self-contained lualib_bundle.lua matching TSTL's bundle format.
Index ¶
- Variables
- func BuildBundleFromSource(lualibSrcDir, langExtPath, luaTypesPath string, luaTarget transpiler.LuaTarget, ...) (string, error)
- func BundleForTarget(target string) []byte
- func Middleclass() []byte
- func MinimalBundleForTarget(target string, usedExports []string) ([]byte, error)
- func Patches() []byte
- type FeatureData
- type FeatureInfo
- type ModuleInfo
Constants ¶
This section is empty.
Variables ¶
var Bundle []byte
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 ¶
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 ¶
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