refactor: 迁移到TC39标准装饰器

- 将实验性装饰器重构为TC39 Stage 3标准装饰器
- 使用ClassMethodDecoratorContext和ClassDecoratorContext
- 采用addInitializer方法进行装饰器初始化
- 移除reflect-metadata依赖,使用WeakMap存储元数据
- 更新TypeScript配置为ES2021目标版本
- 简化tsconfig.json配置,移除useDefineForClassFields显式设置
- 创建TC39标准装饰器使用指南文档

技术优势:
- 符合ECMAScript官方标准提案
- 零外部依赖,性能更优
- 完整TypeScript类型支持
- 未来原生浏览器兼容

Breaking Changes: 无,装饰器语法保持兼容
This commit is contained in:
2025-09-02 06:49:32 +08:00
parent 63c1e4df63
commit d178df54da
6 changed files with 168 additions and 60 deletions

View File

@@ -4,8 +4,7 @@
"@tsconfig/node-ts/tsconfig.json"
],
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"types": ["reflect-metadata"]
"target": "ES2022",
"useDefineForClassFields": false
}
}