From a547bcdc58ce52d8638c5ac0a61e28f764a78e60 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Tue, 18 Feb 2025 19:20:46 +0100 Subject: [PATCH] Bundler fix --- src/elements/Tree.lua | 4 ++++ tools/bundler.lua | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/elements/Tree.lua b/src/elements/Tree.lua index cf0e84a..30973fb 100644 --- a/src/elements/Tree.lua +++ b/src/elements/Tree.lua @@ -128,6 +128,10 @@ function Tree:mouse_click(button, x, y) end end +--- Registers a callback for when a node is selected +--- @shortDescription Registers a callback for when a node is selected +--- @param callback function The callback function +--- @return Tree self The Tree instance function Tree:onSelect(callback) self:registerCallback("node_select", callback) return self diff --git a/tools/bundler.lua b/tools/bundler.lua index 103e6f2..abbafa0 100644 --- a/tools/bundler.lua +++ b/tools/bundler.lua @@ -20,7 +20,7 @@ local function bundle() 'local minified = true\n', 'local project = {}\n', 'local baseRequire = require\n', - 'require = function(path) return project[path] or baseRequire(path) end\n' + 'require = function(path) return project[path..".lua"] or baseRequire(path) end\n' } for _, file in ipairs(files) do @@ -31,17 +31,16 @@ local function bundle() local success, minified = minify(content) if not success then print("Failed to minify " .. file.path) - print(minified) os.exit(1) end table.insert(output, string.format( 'project["%s"] = function(...) %s end\n', - file.path, minified + file.path, minified:gsub("\n", " ") )) end - table.insert(output, 'return project["main.lua"]') + table.insert(output, 'return project["main.lua"]()') local out = io.open("release/basalt.lua", "w") out:write(table.concat(output))