chore: rename runtime Lib/Module.lua & Lib/Class.lua to lowercase lib/module.lua & lib/class.lua (v0.3.1)
This commit is contained in:
1 parent
b1a53d8660
commit
1e2a0b7546
13 files changed
+42
-37
No files matched your search
+10
-10
@@ -84,8 +84,8 @@ function runLuaInDir(dir, script) {
|
||||
package.path = ${JSON.stringify(path.join(dir, "?.lua"))} .. ";" .. ${JSON.stringify(
|
||||
path.join(dir, "?/init.lua")
|
||||
)} .. ";" .. package.path
|
||||
require("Lib.Module")
|
||||
require("Lib.Class")
|
||||
require("lib.module")
|
||||
require("lib.class")
|
||||
${script}
|
||||
`;
|
||||
const proc = spawnSync(luaBin, ["-e", wrapped], { encoding: "utf8", cwd: dir });
|
||||
@@ -106,7 +106,7 @@ function withTempDir(fn) {
|
||||
// 1. 编译期产物与开关校验
|
||||
// ============================================================
|
||||
|
||||
test("hot-reload mode (default) auto-emits Lib/Module.lua and Lib/Class.lua and transforms imports/exports/classes", () => {
|
||||
test("hot-reload mode (default) auto-emits lib/module.lua and lib/class.lua and transforms imports/exports/classes", () => {
|
||||
const result = transpile({
|
||||
"Framework/Log.ts": `
|
||||
/** @noSelfInFile */
|
||||
@@ -146,9 +146,9 @@ test("hot-reload mode (default) auto-emits Lib/Module.lua and Lib/Class.lua and
|
||||
|
||||
assert.equal(getErrors(result).length, 0, formatDiagnostics(getErrors(result)));
|
||||
|
||||
// 自动产出 Lib/Module.lua 与 Lib/Class.lua
|
||||
assert.ok(getLuaFile(result, "Lib/Module.lua"), "Expected Lib/Module.lua to be emitted");
|
||||
assert.ok(getLuaFile(result, "Lib/Class.lua"), "Expected Lib/Class.lua to be emitted");
|
||||
// 自动产出 lib/module.lua 与 lib/class.lua
|
||||
assert.ok(getLuaFile(result, "lib/module.lua"), "Expected lib/module.lua to be emitted");
|
||||
assert.ok(getLuaFile(result, "lib/class.lua"), "Expected lib/class.lua to be emitted");
|
||||
|
||||
const workerLua = getLuaFile(result, "Logic/Worker.lua").lua;
|
||||
assert.match(workerLua, /local ____exports = __module\.env/);
|
||||
@@ -173,8 +173,8 @@ test("plugin options support emitRuntime: false and moduleSystem: 'standard'", (
|
||||
{ emitRuntime: false }
|
||||
);
|
||||
assert.equal(getErrors(noRuntime).length, 0);
|
||||
assert.equal(getLuaFile(noRuntime, "Lib/Module.lua"), undefined);
|
||||
assert.equal(getLuaFile(noRuntime, "Lib/Class.lua"), undefined);
|
||||
assert.equal(getLuaFile(noRuntime, "lib/module.lua"), undefined);
|
||||
assert.equal(getLuaFile(noRuntime, "lib/class.lua"), undefined);
|
||||
|
||||
const standard = transpile(
|
||||
{
|
||||
@@ -184,7 +184,7 @@ test("plugin options support emitRuntime: false and moduleSystem: 'standard'", (
|
||||
{ moduleSystem: "standard" }
|
||||
);
|
||||
assert.equal(getErrors(standard).length, 0);
|
||||
assert.equal(getLuaFile(standard, "Lib/Module.lua"), undefined);
|
||||
assert.equal(getLuaFile(standard, "lib/module.lua"), undefined);
|
||||
const bLua = getLuaFile(standard, "B.lua").lua;
|
||||
assert.match(bLua, /local ____exports = \{\}/);
|
||||
assert.match(bLua, /require\("A"\)/);
|
||||
@@ -384,7 +384,7 @@ test("Lua 5.4 runtime: @module_data preserves local/exported/nil values and keep
|
||||
});
|
||||
});
|
||||
|
||||
test("Lua 5.4 runtime: Lib/Class.lua hot-reloads pure TS base & child classes preserving instances, inheritance, instanceof, and cleaning removed methods", () => {
|
||||
test("Lua 5.4 runtime: lib/class.lua hot-reloads pure TS base & child classes preserving instances, inheritance, instanceof, and cleaning removed methods", () => {
|
||||
withTempDir((dir) => {
|
||||
const v1 = transpile({
|
||||
"Logic/Animal.ts": `
|
||||
|
||||
Reference in new issue
Block a user