@jayfong/x-server 1.27.0 → 1.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.27.1](https://github.com/jfWorks/x-server/compare/v1.27.0...v1.27.1) (2022-05-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* api ([d30109c](https://github.com/jfWorks/x-server/commit/d30109ce90db1f3f9c513b9867be6123bc6373e6))
|
|
11
|
+
|
|
5
12
|
## [1.27.0](https://github.com/jfWorks/x-server/compare/v1.26.9...v1.27.0) (2022-05-07)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -241,7 +241,7 @@ class ApiGenerator {
|
|
|
241
241
|
|
|
242
242
|
for (const handlerList of handlerGroup) {
|
|
243
243
|
const handlerListSourceFile = this.getTypeBySymbol(handlerList).getProperties()[0].getDeclarations()[0].getSourceFile();
|
|
244
|
-
const basePath = `/${
|
|
244
|
+
const basePath = `/${handlerListSourceFile.getFilePath().replace('.ts', '').split('/src/handlers/')[1].replace(/(^|\/)index$/, '/').split('/').map(v => (0, _vtils.snakeCase)(v)).join('/')}/`.replace(/\/{2,}/g, '/');
|
|
245
245
|
|
|
246
246
|
for (const handler of handlerListSourceFile.getVariableStatements().filter(item => item.isExported())) {
|
|
247
247
|
// 重要:这一步必须,先调一遍 getText 获取看到的对象,后续对于复杂定义才不会报错
|
|
@@ -259,7 +259,7 @@ class ApiGenerator {
|
|
|
259
259
|
continue;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
const handlerCategory = (0, _vtils.pascalCase)(basePath) || '
|
|
262
|
+
const handlerCategory = (0, _vtils.pascalCase)(basePath) || 'Index';
|
|
263
263
|
const handlerName = handlerComment.description || handlerPath;
|
|
264
264
|
const handlerMethod = methodType.getLiteralValueOrThrow();
|
|
265
265
|
const serverMethod = _http_method.HandlerMethodToHttpMethod[handlerMethod];
|
package/lib/cli/api_generator.js
CHANGED
|
@@ -225,7 +225,7 @@ export class ApiGenerator {
|
|
|
225
225
|
|
|
226
226
|
for (const handlerList of handlerGroup) {
|
|
227
227
|
const handlerListSourceFile = this.getTypeBySymbol(handlerList).getProperties()[0].getDeclarations()[0].getSourceFile();
|
|
228
|
-
const basePath = `/${
|
|
228
|
+
const basePath = `/${handlerListSourceFile.getFilePath().replace('.ts', '').split('/src/handlers/')[1].replace(/(^|\/)index$/, '/').split('/').map(v => snakeCase(v)).join('/')}/`.replace(/\/{2,}/g, '/');
|
|
229
229
|
|
|
230
230
|
for (const handler of handlerListSourceFile.getVariableStatements().filter(item => item.isExported())) {
|
|
231
231
|
// 重要:这一步必须,先调一遍 getText 获取看到的对象,后续对于复杂定义才不会报错
|
|
@@ -243,7 +243,7 @@ export class ApiGenerator {
|
|
|
243
243
|
continue;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
const handlerCategory = pascalCase(basePath) || '
|
|
246
|
+
const handlerCategory = pascalCase(basePath) || 'Index';
|
|
247
247
|
const handlerName = handlerComment.description || handlerPath;
|
|
248
248
|
const handlerMethod = methodType.getLiteralValueOrThrow();
|
|
249
249
|
const serverMethod = HandlerMethodToHttpMethod[handlerMethod];
|