squishy

Fri, 05 May 2017 09:47:52 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 05 May 2017 09:47:52 +0100
branch
lua5.2
changeset 95
828e814152e0
parent 60
e80882a6af57
child 99
2b6416334a25
permissions
-rw-r--r--

squish: Optionally add in a 5.2-compatible module() function (5.2's own compat function is broken)

--module-compat or --no-module-compat, default is --module-compat if running under 5.2+ (detected at runtime).

When compiled with the appropriate flags, Lua 5.2 provides a module() function for backwards compatibility with
5.1. However 5.1's version of the function changed function environments, while 5.2's version changes the global
environment, which breaks through squish's per-module sandbox functions.


-- Set this option, same as if user specified
-- '--executable' on the command-line. Can be 
-- disabled by user with '--no-executable'
Option "executable"

-- Output filename
Output "squish"

-- This is normal/main script
Main "squish.lua"

-- Add minify extension if asked to
if GetOption "with-minify" then
	Module "optlex"		"minify/optlex.lua"
	Module "optparser"	"minify/optparser.lua"
	Module "llex"		"minify/llex.lua"
	Module "lparser"	"minify/lparser.lua"

	Main "minify/squish.minify.lua"
end

-- Compress Lua scripts (an excellent hack :) )
if GetOption "with-uglify" then
	Module "llex"		"uglify/llex.lua"
	
	Main "uglify/squish.uglify.lua"
end

-- Compile output files to Lua bytecode
if GetOption "with-compile" then
	Module "minichunkspy" "compile/minichunkspy.lua"
	Main "compile/squish.compile.lua"
end

if GetOption "with-virtual-io" then
	Resource "vio" "vio/vio.lua"
end

if GetOption "with-gzip" then
	Resource "gunzip.lua" "gunzip.lua"
	Main "gzip/squish.gzip.lua"
end

if GetOption "with-debug" then
	Resource "squish.debug" "squish.debug"
end

mercurial