release: v0.1.0 package exports, CLI, integration guide, and AI rules template

This commit is contained in:
szy73711 committed 2026-11-29 00:31:10 +08:00
1 parent c0ac6eaad6
commit 1f76bca55c
8 files changed
+500 -33

No files matched your search

+42 -29
View File
@@ -11,33 +11,50 @@
- **编译期强约束(Fail Fast)**:在 TSTL AST 阶段直接阻断 `get/set` 访问器、`async/await`/`Promise`、`try/catch/throw`、`RegExp`/`Map`/`Set`/`Proxy`/`Symbol`、普通运行时 `enum`、`@unlua` 类 `constructor`/字段初始化器/`new` 实例化、UE Delegate 匿名函数回调、`UObject` 的 `instanceof`/`delete`/对象展开以及继承 `UE.UObject` 漏标 `@unlua` 等问题。
- **面向大型项目(3000~5000+ 文件)优化**:插件预编译为 JS、复用 TSTL 单次 AST 遍历、`WeakMap` 缓存类型查询、`skipLibCheck: true` 与增量 Watch 模式支持。
## 目录结构
## 在 UE 项目中接入(快速预览)
```text
ts2lua-unreal/
├── docs/
│ └── ts-unlua-spec.md # TypeScript -> UnLua 开发与语言约束规范
├── types/
│ └── unlua.d.ts # 全局 @unlua 装饰器与 UnLua/UE 基础类型声明
├── src/plugin/ # TSTL UnLua 编译器插件源码
│ ├── index.ts # 插件入口
│ ├── diagnostics.ts # 自定义编译错误码(90001-90110)
│ ├── type-utils.ts # WeakMap 缓存的 TypeChecker 工具
│ ├── validators.ts # 语言子集与 UnLua 约束校验
│ └── unlua-transform.ts # UnLua.Class / return M / super / default import 转换
├── examples/ # 对齐 UnrealLuaDemo 的端到端示例
│ ├── tsconfig.json
│ ├── types/demo.d.ts
│ └── src/
│ ├── Framework/ # 纯工具模块(Log / EventBus)
│ └── Game/ # UnLua 绑定类(LuaDemoActor / LuaSpecialDemoActor)
├── test/
│ └── plugin.test.mjs # Node 原生自动化测试套件
├── tsconfig.base.json # 业务项目可继承的 TSTL 基础配置(Lua 5.4)
└── tsconfig.plugin.json # 插件构建配置
在 UE 项目的 `TypeScript/package.json` 中通过 Git Tag 依赖接入:
```json
{
"scripts": {
"build": "ts2lua-unreal build",
"watch": "ts2lua-unreal watch",
"info": "ts2lua-unreal info"
},
"devDependencies": {
"ts2lua-unreal": "git+ssh://git@106.55.3.105:20022/szy73711/ts2lua-unreal.git#v0.1.0"
}
}
```
## 快速开始
`TypeScript/tsconfig.json` 直接继承内置基线配置:
```json
{
"extends": "ts2lua-unreal/tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "../Content/Script"
},
"include": [
"src/**/*.ts",
"types/**/*.d.ts",
"node_modules/ts2lua-unreal/types/unlua.d.ts"
]
}
```
> 完整的接入步骤、错误码速查表、版本升级与本地 `npm link` 联调套路,请查阅 **[UE 项目接入与迭代升级指南](docs/integration-guide.md)**。
## 文档索引
- [UE 项目接入与迭代升级指南](docs/integration-guide.md)(首次接入、错误码速查、升级/回滚与 `npm link` 联调)
- [TypeScript to UnLua 开发与语言约束规范](docs/ts-unlua-spec.md)(完整语言子集约束与原理说明)
- [业务项目开发规则模板](docs/ai-rules-template.md)(可直接复制到 UE 项目的 `AGENTS.md` / 团队规范)
- [版本变更日志](CHANGELOG.md)
## 本仓库开发命令
```bash
# 安装依赖
@@ -49,10 +66,6 @@ npm test
# 编译示例工程(输出至 examples/out/)
npm run build:examples
# 增量监听模式(适配 UnLua HotReload)
# 增量监听模式
npm run watch:examples
```
## 文档
- [TypeScript to UnLua 开发与语言约束规范](docs/ts-unlua-spec.md)