Files
ts2lua-unreal/CHANGELOG.md
T

44 lines
3.4 KiB
Markdown
Raw Permalink Normal View History

# Changelog
All notable changes to `ts2lua-unreal` will be documented in this file.
The format is based on [Semantic Versioning](https://semver.org/).
## [0.2.1] - 2026-11-29
### Fixed
- 修正 [types/unlua.d.ts](types/unlua.d.ts) 中 `UE.TArray` 与 UnLua `LuaLib_Array.cpp` 不一致的两处签名:
- `RemoveItem(item: T): number`(实际返回移除元素数量 `int32`,而非 `boolean`)。
- `GetData(): unknown`(无参调用,传参会在运行时触发 `luaL_error`)。
### Added
- 在 [types/unlua.d.ts](types/unlua.d.ts) 中补充 UnLua 原生基础类型描述符 Token(`UE.int8`~`UE.uint64`、`UE.float`、`UE.double`、`UE.bool`、`UE.FName`、`UE.FString`),支持直接使用 `UE.TArray(UE.int32)` / `UE.TMap(UE.FString, UE.float)` 构造原生类型容器。
## [0.2.0] - 2026-11-29
### Changed
- **拆分精简 [types/unlua.d.ts](types/unlua.d.ts)**:移除所有 UE 引擎反射类声明(`UObject`/`AActor`/`UWorld`/`FVector`/`UKismetSystemLibrary` 等),仅保留 UE 反射无法自动生成的零冲突核心运行时层(`@unlua` 装饰器、`UnLua` 全局模块、`TArray`/`TMap`/`TSet`、智能指针模板别名、`FScriptDelegate`/`FMulticastScriptDelegate`/`FMulticastSparseDelegate` 以及 `UE.NewObject`/`LoadClass`/`LoadObject`),彻底避免与 UE 项目自动生成的反射 `.d.ts` 冲突。
### Removed
- 移除仓库内置的 `examples/` 示例工程、`examples/types/demo.d.ts` 及 `build:examples` / `watch:examples` 脚本;插件自动化测试保留在 [test/plugin.test.mjs](test/plugin.test.mjs) 中使用内存虚拟声明运行。
## [0.1.0] - 2026-11-29
### Added
- **规范与接入文档**:
- [docs/ts-unlua-spec.md](docs/ts-unlua-spec.md):面向 UE 5.8 + UnLua 2.3.6(Lua 5.4)的 TypeScript 开发与语言约束规范。
- [docs/integration-guide.md](docs/integration-guide.md):UE 项目接入、错误码速查、版本升级与本地 `npm link` 联调手册。
- [docs/ai-rules-template.md](docs/ai-rules-template.md):可直接复用的业务项目规则模板。
- **UnLua TSTL 编译器插件 (`src/plugin/`)**:
- 编译期拦截全部禁用语言特性(`90001`~`90016`)与 `@unlua` 绑定类专项约束(`90101`~`90110`,含继承 `UE.UObject` 漏标 `@unlua` 防呆)。
- `@unlua` 类原生 UnLua 代码生成:`local ClassName = UnLua.Class(...)`、`function ClassName.Method(self, ...)`、`return ClassName`,消除 `____exports` / `__TS__Class` / `__TS__Decorate` 垫片。
- 精确 `super.Method(...)` 映射(UE 原生基类 -> `self.Overridden.Method(self, ...)`;`@unlua` TS 父类 -> `BaseClass.Method(self, ...)`)。
- `@unlua` 默认导入直连优化(`import Base from "./Base"` -> `local Base = require("...")`,不生成 `.default`)。
- 面向大项目(3000~5000+ 文件)的 `WeakMap` 类型与文件名缓存优化。
- **包导出与 CLI**:
- 暴露 `ts2lua-unreal`、`ts2lua-unreal/tsconfig.base.json`、`ts2lua-unreal/types/unlua.d.ts` 及全部文档导出。
- 提供 `ts2lua-unreal build` / `watch` / `info` CLI 命令与 `prepare` 自动构建脚本,支持通过 npm Git Tag 依赖无缝接入任意 UE 项目。
- **基础类型、示例与测试**:
- [types/unlua.d.ts](types/unlua.d.ts):全局 `@unlua` 装饰器及 UnLua/UE 核心基础类型声明。
- `examples/`:还原 `UnrealLuaDemo` 的端到端 TS -> UnLua 示例工程。
- `test/plugin.test.mjs`:16 组正反用例自动化测试套件。