Lundle is a package bundler that allows you to easily bundle your lua files into a single file. Configuration is done through a buildscript file, which is a lua file that exports a table with the configuration, and can post-process the bundled file(for example, to add a shebang line, minify).
obtain the latest release from the releases page, or build from source.
git clone
cd Lundle
cargo buildFor building a project, you need to create a buildscript file (default name is lundle.build.lua), and run lundle in the same directory as the buildscript file.
Parameters to the lundle command:
-b,--buildscript: The buildscript file to use, defaults tolundle.build.lua
local c = config
c.main = "main.lua"
c.encoding = "utf-8"
c.output = "mainbundled.lua"
c:add_module("lib/*.lua")There are a few configuration options:
main: The entry point of the programencoding: The encoding of the files, defaults to utf-8output: The output fileadd_module: Adds a module to the bundle, can be a single file or a glob pattern. In the example above, all lua files in thelibdirectory will be added to the bundle.
You can post-process the bundled file by adding a postprocess function to the buildscript file.
local c = config
...
function postprocess(content)
return os.date("-- Built on %Y-%m-%d %H:%M:%S\n") .. content
endThe postprocess function takes the bundled file content as an argument, and should return the processed content.
In the example above, the bundled file will have a line added at the top with the current date and time (shebang line).
The entry point of the program, defaults to main.lua
The encoding of the files, defaults to utf-8
The output file, defaults to main.bundled.lua
Adds a module to the bundle, can be a single file or a glob pattern.
path: The path to the moduleprefix: The prefix to add to the module name in the bundle. If was empty string, the first part of the path will be removed. If not empty, the prefix will be added to first part of the path.
Removes a module from the bundle. Only works if the module was added with add_module.
path: The path to the module
This project is licensed under the MIT License.