npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

luacompact

v1.4.0

Published

Luacompact is a Lua bundler written in Typescript that combines multiple Lua files into one.

Downloads

12

Readme

Installation

Before installing LuaCompact, ensure that you have Node.js installed. After that, you can install LuaCompact using one of the commands below depending on which package manager you prefer.

# Using NPM
npm i luacompact -g

# Using Yarn
yarn global add luacompact

# Using PNPM
pnpm add luacompact -g

After installation, you should be able to use LuaCompact either by using the luacompact or lcp commands in terminal.

Usage

Creating a project

Once LuaCompact is installed, you will first have to create a LuaCompact project. To create a LuaCompact project, open the directory you want the project in and run the command below.

luacompact init

Building a project

To build a project, all you need to do is run the command below. Optionally, you can also include a -watch or -w parameter to the command to automatically have LuaCompact build the project once a file is changed.

# Building without -watch
luacompact build

# Building with -watch
luacompact build -watch

Loading modules/scripts

Loading a module/script is made pretty simple. All you need to do is use the load function and pass through a relative path to the script you want to load. The load function supports both .lua and .luau files.

index.lua Example:

local core = load("core.lua")
core.helloWorld()

core.lua Example:

local core = {}

function core.helloWorld()
    print("Hello world!")
end

return core

Importing other files

Not only can you load modules, but you can also import other files using the import function. Unlike the load function, the import function requires the file extension in the function call.

JSON files are automatically converted to Lua dictionaries, while every other file will be converted to text.

index.lua Example:

local defaultConfig = import("assets/config.json")
print(defaultConfig.Enabled)

config.json Example:

{
    "Enabled": true
}

Config

Every LuaCompact project has a config file called luacompact.json. Below, you can see the options and what each option is used for.

| Key | Description | Input | Type | Required | | --- | --- | --- | --- | --- | | main | The program entry point. | A directory to a lua file. | string | true | | prelude | Code that runs after imports are defined but before modules are defined. | A directory to a lua file. | string or string[] | false | | exclude | Files that aren't included in the final output. | A list of directories. | string[] | false | | exportDirectory | The place to export the final output. | A directory. | string | "build" |

Contributing

Information about contributing to the project can be found here.