GlyEngine 0.4
Create games and apps with lua
Loading...
Searching...
No Matches
Bundler

unify lua files More...

Functions

local function identify (filepath)
 bundler library
local function build (src, dest)

Detailed Description

The bundler is for general use and can be used in any lua code in addition to games made for the gly engine.

  • optimized recursive search for dependencies in your files.
  • minification by removing comments, extrabreaklines and tabulations.
  • compatibility with lua distributions that do not expose standard libs in require.
Downloads
Usage
  • gly engine cli
    lua cli.lua bundler src/main.lua --dist ./dist
  • bundler cli
    lua bundler_cli.lua src/main.lua dist/main.lua
Result
  • Input
    • lib_common_math.lua
      local function sum(a, b)
      return a + b
      end
      local P = {
      sum = sum
      }
      return P
    • main.lua
      local os = require('os')
      local zeebo_math = require('lib_common_math')
      print(zeebo_math.sum(1, 2))
      os.exit(0)
      local function exit()
      @decorator
      local function print(pos_x, pos_y, text)
      std.text.print
  • Output
    • main.lua
      local os = ((function() local x, y = pcall(require, 'os'); return x and y end)()) or _G.os
      local lib_common_math = nil
      local function main()
      local zeebo_math = lib_common_math()
      print(zeebo_math.sum(1, 2))
      os.exit(0)
      end
      lib_common_math = function()
      local function sum(a, b)
      return a + b
      end
      local P = {
      sum = sum
      }
      return P
      end
      main()

Function Documentation

◆ build()

local function build ( src ,
dest  )

◆ identify()

local function identify ( filepath )
Example
local bundler = require('bundler')
local ok, msg = bundler.build('src/main.lua', 'dist/main.lua')
if not ok then
error(msg)
end
local function build(src, dest)
local function error(...)
local function src(url)
deterministic id from entry content (djb2), avoids name collision of nested bundles