@lark-apaas/coding-preset-vite-react 1.0.13-alpha.3 → 1.0.13-alpha.4

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.
Files changed (44) hide show
  1. package/lib/index.d.ts.map +1 -1
  2. package/lib/index.js +6 -2
  3. package/lib/index.js.map +1 -1
  4. package/lib/plugins/basename-injection.d.ts +29 -0
  5. package/lib/plugins/basename-injection.d.ts.map +1 -0
  6. package/lib/plugins/basename-injection.js +114 -0
  7. package/lib/plugins/basename-injection.js.map +1 -0
  8. package/lib/plugins/server-log.d.ts +7 -17
  9. package/lib/plugins/server-log.d.ts.map +1 -1
  10. package/lib/plugins/server-log.js +7 -27
  11. package/lib/plugins/server-log.js.map +1 -1
  12. package/lib/plugins/view-context.d.ts +5 -0
  13. package/lib/plugins/view-context.d.ts.map +1 -1
  14. package/lib/plugins/view-context.js +3 -0
  15. package/lib/plugins/view-context.js.map +1 -1
  16. package/package.json +1 -1
  17. package/lib/server-log/openapi/controller.d.ts +0 -7
  18. package/lib/server-log/openapi/controller.d.ts.map +0 -1
  19. package/lib/server-log/openapi/controller.js +0 -60
  20. package/lib/server-log/openapi/controller.js.map +0 -1
  21. package/lib/server-log/openapi/index.d.ts +0 -10
  22. package/lib/server-log/openapi/index.d.ts.map +0 -1
  23. package/lib/server-log/openapi/index.js +0 -48
  24. package/lib/server-log/openapi/index.js.map +0 -1
  25. package/lib/server-log/openapi/router.d.ts +0 -20
  26. package/lib/server-log/openapi/router.d.ts.map +0 -1
  27. package/lib/server-log/openapi/router.js +0 -26
  28. package/lib/server-log/openapi/router.js.map +0 -1
  29. package/lib/server-log/openapi/services.d.ts +0 -15
  30. package/lib/server-log/openapi/services.d.ts.map +0 -1
  31. package/lib/server-log/openapi/services.js +0 -276
  32. package/lib/server-log/openapi/services.js.map +0 -1
  33. package/lib/server-log/openapi/spec-controller.d.ts +0 -4
  34. package/lib/server-log/openapi/spec-controller.d.ts.map +0 -1
  35. package/lib/server-log/openapi/spec-controller.js +0 -136
  36. package/lib/server-log/openapi/spec-controller.js.map +0 -1
  37. package/lib/server-log/openapi/types.d.ts +0 -56
  38. package/lib/server-log/openapi/types.d.ts.map +0 -1
  39. package/lib/server-log/openapi/types.js +0 -3
  40. package/lib/server-log/openapi/types.js.map +0 -1
  41. package/lib/server-log/openapi/utils.d.ts +0 -18
  42. package/lib/server-log/openapi/utils.d.ts.map +0 -1
  43. package/lib/server-log/openapi/utils.js +0 -128
  44. package/lib/server-log/openapi/utils.js.map +0 -1
@@ -1,128 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.findControllerFiles = findControllerFiles;
7
- exports.buildSourceMap = buildSourceMap;
8
- exports.enhanceOpenApiPaths = enhanceOpenApiPaths;
9
- exports.transformOpenapiPaths = transformOpenapiPaths;
10
- const node_path_1 = __importDefault(require("node:path"));
11
- const node_fs_1 = require("node:fs");
12
- /**
13
- * Find all controller files in a directory
14
- */
15
- async function findControllerFiles(dir) {
16
- const files = [];
17
- async function scan(currentDir) {
18
- const entries = await node_fs_1.promises.readdir(currentDir, { withFileTypes: true });
19
- for (const entry of entries) {
20
- const fullPath = node_path_1.default.join(currentDir, entry.name);
21
- if (entry.isDirectory()) {
22
- await scan(fullPath);
23
- }
24
- else if (entry.isFile() && entry.name.endsWith('.controller.ts')) {
25
- files.push(fullPath);
26
- }
27
- }
28
- }
29
- await scan(dir);
30
- return files;
31
- }
32
- /**
33
- * Build source map from controller files
34
- */
35
- async function buildSourceMap(controllerFiles, processFile) {
36
- const sourceMap = new Map();
37
- // Process files in parallel with a concurrency limit
38
- const concurrency = 10;
39
- const results = [];
40
- for (let i = 0; i < controllerFiles.length; i += concurrency) {
41
- const batch = controllerFiles.slice(i, i + concurrency);
42
- const batchResults = await Promise.all(batch.map((filePath) => processFile(filePath)));
43
- results.push(...batchResults);
44
- }
45
- // Merge results
46
- for (const metadata of results) {
47
- for (const [operationId, info] of metadata.entries()) {
48
- sourceMap.set(operationId, info);
49
- }
50
- }
51
- return sourceMap;
52
- }
53
- /**
54
- * Try to match operationId with different formats
55
- * Supports:
56
- * - Direct match: ClassName_methodName
57
- * - Camel case: classNameMethodName
58
- * - Method only: methodName
59
- */
60
- function findSourceInfo(operationId, sourceMap) {
61
- // Try direct match first
62
- const directMatch = sourceMap.get(operationId);
63
- if (directMatch) {
64
- return directMatch;
65
- }
66
- // Try matching with different formats
67
- for (const [key, value] of sourceMap.entries()) {
68
- // key format: ClassName_methodName
69
- const [className, methodName] = key.split('_');
70
- if (!className || !methodName)
71
- continue;
72
- // Try camelCase format: classNameMethodName
73
- const camelCaseId = className.charAt(0).toLowerCase() + className.slice(1) + methodName.charAt(0).toUpperCase() + methodName.slice(1);
74
- if (operationId === camelCaseId) {
75
- return value;
76
- }
77
- // Try method name only
78
- if (operationId === methodName) {
79
- return value;
80
- }
81
- }
82
- return undefined;
83
- }
84
- /**
85
- * Enhance OpenAPI paths with source information
86
- */
87
- function enhanceOpenApiPaths(openapi, sourceMap) {
88
- let enhancedCount = 0;
89
- if (!openapi.paths) {
90
- return enhancedCount;
91
- }
92
- for (const pathItem of Object.values(openapi.paths)) {
93
- if (!pathItem || typeof pathItem !== 'object')
94
- continue;
95
- for (const operation of Object.values(pathItem)) {
96
- if (operation && typeof operation === 'object' && 'operationId' in operation) {
97
- const sourceInfo = findSourceInfo(operation.operationId, sourceMap);
98
- if (sourceInfo) {
99
- operation['x-source'] = {
100
- file: sourceInfo.file,
101
- line: sourceInfo.line,
102
- };
103
- enhancedCount++;
104
- }
105
- }
106
- }
107
- }
108
- return enhancedCount;
109
- }
110
- /**
111
- * Transform OpenAPI paths by removing basePath prefix
112
- */
113
- function transformOpenapiPaths(openapi, basePath) {
114
- if (basePath === '/' || !openapi.paths) {
115
- return openapi;
116
- }
117
- const newPaths = {};
118
- Object.keys(openapi.paths).forEach((key) => {
119
- const staticApiKey = key.startsWith(basePath) ? key.slice(basePath.length) : key;
120
- newPaths[staticApiKey] = openapi.paths[key];
121
- });
122
- return {
123
- ...openapi,
124
- paths: newPaths,
125
- basePath,
126
- };
127
- }
128
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/server-log/openapi/utils.ts"],"names":[],"mappings":";;;;;AAOA,kDAmBC;AAKD,wCAwBC;AAwCD,kDAyBC;AAKD,sDAgBC;AA7ID,0DAA6B;AAC7B,qCAAyC;AAGzC;;GAEG;AACI,KAAK,UAAU,mBAAmB,CAAC,GAAW;IACnD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,UAAU,IAAI,CAAC,UAAkB;QACpC,MAAM,OAAO,GAAG,MAAM,kBAAE,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAEtE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAEnD,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvB,CAAC;iBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBACnE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,cAAc,CAClC,eAAyB,EACzB,WAAmE;IAEnE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;IA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