resolve

package
v0.1.0-dev.84 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package resolve handles post-transpilation dependency resolution.

The transpiler emits structured ModuleDependency metadata alongside each file's Lua output. This package walks that metadata to discover external .lua dependencies (e.g. pre-built TSTL libraries in node_modules), reads them from disk, and recursively resolves their dependencies using FindLuaRequires (text scanning - the only option for third-party Lua).

For files we transpiled ourselves, no text scanning is needed: the transpiler already resolved every import and recorded it as metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildMode

type BuildMode string

BuildMode controls how external dependencies are handled.

const (
	BuildModeDefault BuildMode = "default"
	BuildModeLibrary BuildMode = "library"
)

type Options

type Options struct {
	// SourceRoot is the project root directory (rootDir from tsconfig).
	SourceRoot string
	// BuildMode controls library vs default mode behavior.
	BuildMode BuildMode
}

Options configures dependency resolution.

type ResolvedFile

type ResolvedFile struct {
	// FileName is the absolute path of the file.
	FileName string
	// Lua is the Lua source code.
	Lua string
	// IsTranspiled is true for files we transpiled (vs external .lua).
	IsTranspiled bool
}

ResolvedFile represents a file to be included in the output.

type Result

type Result struct {
	// Files is the ordered list of files to include in the output.
	// Transpiled files come first, followed by discovered external deps.
	Files []ResolvedFile
	// Errors collects non-fatal resolution issues.
	Errors []string
}

Result holds the output of dependency resolution.

func ResolveDependencies

func ResolveDependencies(results []transpiler.TranspileResult, opts Options) Result

ResolveDependencies walks the ModuleDependency metadata from transpiled results, discovers external .lua files, and returns the complete set of files to include in the output.

Jump to

Keyboard shortcuts

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