added tinker_core as lib
This commit is contained in:
parent
fc98520147
commit
7b33667e04
19
Makefile
19
Makefile
@ -1,20 +1,27 @@
|
|||||||
BIN_NAME := Haxe.lua
|
BUNDLE_NAME = bundle.lua
|
||||||
MINIFYD_NAME := Haxe.min.lua
|
HAXE_NAME = haxe.lua
|
||||||
|
MINIFYD_NAME := bundle.min.lua
|
||||||
BUILD_DIR := build
|
BUILD_DIR := build
|
||||||
HAXE_FLAGS = -D webconsole
|
HAXE_FLAGS = -D webconsole
|
||||||
|
POLYFILLED_NAME = bundle.polyfill.lua
|
||||||
|
POLYFILL_SRC = src/polyfill.lua
|
||||||
|
|
||||||
BIN_PATH := $(BUILD_DIR)/$(BIN_NAME)
|
HAXE_PATH := $(BUILD_DIR)/$(HAXE_NAME)
|
||||||
MIN_PATH := $(BUILD_DIR)/$(MINIFYD_NAME)
|
MIN_PATH := $(BUILD_DIR)/$(MINIFYD_NAME)
|
||||||
|
POLYFILL_PATH := $(BUILD_DIR)/$(POLYFILLED_NAME)
|
||||||
|
|
||||||
all: clean $(MIN_PATH)
|
all: clean $(MIN_PATH)
|
||||||
|
|
||||||
build: $(MIN_PATH)
|
build: $(MIN_PATH)
|
||||||
|
|
||||||
$(BIN_PATH): $(shell find src -name '*.hx')
|
$(HAXE_PATH): $(shell find src -name '*.hx')
|
||||||
haxe build.hxml $(HAXE_FLAGS)
|
haxe build.hxml $(HAXE_FLAGS)
|
||||||
|
|
||||||
$(MIN_PATH): $(BIN_PATH)
|
$(MIN_PATH): $(POLYFILL_PATH)
|
||||||
node minify.js $@
|
node minify.js $(POLYFILL_PATH) $@
|
||||||
|
|
||||||
|
$(POLYFILL_PATH): $(POLYFILL_SRC) $(HAXE_PATH)
|
||||||
|
cat $(POLYFILL_SRC) $(HAXE_PATH) > $@
|
||||||
|
|
||||||
deps: package.json build.hxml
|
deps: package.json build.hxml
|
||||||
haxelib install all --always && yarn install
|
haxelib install all --always && yarn install
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
--main Startup
|
--main Startup
|
||||||
|
|
||||||
--library cctweaked:git:https://git.kapelle.org/niklas/cctweaked-haxelib.git
|
--library cctweaked:git:https://git.kapelle.org/niklas/cctweaked-haxelib.git
|
||||||
|
--library tink_core
|
||||||
|
|
||||||
--dce full
|
--dce full
|
||||||
|
|
||||||
--lua build/Haxe.lua
|
--lua build/haxe.lua
|
||||||
-D lua-vanilla
|
-D lua-vanilla
|
||||||
|
-D lua-ver 5.1
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const luamin = require("luamin");
|
const luamin = require("luamin");
|
||||||
|
|
||||||
const haxeOutput = fs.readFileSync("build/Haxe.lua",{encoding:"utf8"});
|
const haxeOutput = fs.readFileSync(process.argv[2] ?? "build/Haxe.min.lua",{encoding:"utf8"});
|
||||||
|
|
||||||
const minified = luamin.minify(haxeOutput);
|
const minified = luamin.minify(haxeOutput);
|
||||||
|
|
||||||
fs.writeFileSync(process.argv[2] ?? "build/Haxe.min.lua",minified);
|
fs.writeFileSync(process.argv[3] ?? "build/Haxe.min.lua",minified);
|
||||||
|
|
||||||
console.log("minified lua");
|
console.log("minified lua");
|
||||||
|
22
src/polyfill.lua
Normal file
22
src/polyfill.lua
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
-- Polyfill require function
|
||||||
|
_G.require = function (module)
|
||||||
|
-- Polyfill luv package
|
||||||
|
if module == "luv" then
|
||||||
|
local module = {}
|
||||||
|
local metatable = {
|
||||||
|
__index = function(t, i)
|
||||||
|
-- Polyfill gettimeofday
|
||||||
|
if i == "gettimeofday" then
|
||||||
|
return function ()
|
||||||
|
local mil = os.epoch()
|
||||||
|
return mil / 1000, mil
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print("ERROR: Tell a dev to implement: " .. i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
setmetatable(module, metatable)
|
||||||
|
return module
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user