@lark-apaas/devtool-kits 1.0.9 → 1.0.11
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/dist/index.cjs +28 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28646,7 +28646,7 @@ function handleDevProxyError(err, req, res, options) {
|
|
|
28646
28646
|
}
|
|
28647
28647
|
const template = getErrorHtmlTemplate();
|
|
28648
28648
|
const html = injectErrorData(template, errorLogs, clientBasePathWithoutSlash);
|
|
28649
|
-
res.writeHead(
|
|
28649
|
+
res.writeHead(200, {
|
|
28650
28650
|
"Content-Type": "text/html; charset=utf-8",
|
|
28651
28651
|
"Cache-Control": "no-cache, no-store, must-revalidate",
|
|
28652
28652
|
"X-Proxy-Error-Page": "true"
|
|
@@ -28731,6 +28731,25 @@ async function buildSourceMap(controllerFiles, processFile) {
|
|
|
28731
28731
|
return sourceMap;
|
|
28732
28732
|
}
|
|
28733
28733
|
__name(buildSourceMap, "buildSourceMap");
|
|
28734
|
+
function findSourceInfo(operationId, sourceMap) {
|
|
28735
|
+
const directMatch = sourceMap.get(operationId);
|
|
28736
|
+
if (directMatch) {
|
|
28737
|
+
return directMatch;
|
|
28738
|
+
}
|
|
28739
|
+
for (const [key, value] of sourceMap.entries()) {
|
|
28740
|
+
const [className, methodName] = key.split("_");
|
|
28741
|
+
if (!className || !methodName) continue;
|
|
28742
|
+
const camelCaseId = className.charAt(0).toLowerCase() + className.slice(1) + methodName.charAt(0).toUpperCase() + methodName.slice(1);
|
|
28743
|
+
if (operationId === camelCaseId) {
|
|
28744
|
+
return value;
|
|
28745
|
+
}
|
|
28746
|
+
if (operationId === methodName) {
|
|
28747
|
+
return value;
|
|
28748
|
+
}
|
|
28749
|
+
}
|
|
28750
|
+
return void 0;
|
|
28751
|
+
}
|
|
28752
|
+
__name(findSourceInfo, "findSourceInfo");
|
|
28734
28753
|
function enhanceOpenApiPaths(openapi, sourceMap) {
|
|
28735
28754
|
let enhancedCount = 0;
|
|
28736
28755
|
if (!openapi.paths) {
|
|
@@ -28740,7 +28759,7 @@ function enhanceOpenApiPaths(openapi, sourceMap) {
|
|
|
28740
28759
|
if (!pathItem || typeof pathItem !== "object") continue;
|
|
28741
28760
|
for (const operation of Object.values(pathItem)) {
|
|
28742
28761
|
if (operation && typeof operation === "object" && "operationId" in operation) {
|
|
28743
|
-
const sourceInfo =
|
|
28762
|
+
const sourceInfo = findSourceInfo(operation.operationId, sourceMap);
|
|
28744
28763
|
if (sourceInfo) {
|
|
28745
28764
|
operation["x-source"] = {
|
|
28746
28765
|
file: sourceInfo.file,
|
|
@@ -28812,6 +28831,7 @@ __name(processControllerFile, "processControllerFile");
|
|
|
28812
28831
|
function extractControllerMetadata(sourceFile, filePath) {
|
|
28813
28832
|
const metadata = /* @__PURE__ */ new Map();
|
|
28814
28833
|
let controllerPath = "";
|
|
28834
|
+
let className = "";
|
|
28815
28835
|
function getDecorators(node) {
|
|
28816
28836
|
if ("modifiers" in node && Array.isArray(node.modifiers)) {
|
|
28817
28837
|
return node.modifiers.filter((mod) => mod.kind === ts.SyntaxKind.Decorator);
|
|
@@ -28825,6 +28845,9 @@ function extractControllerMetadata(sourceFile, filePath) {
|
|
|
28825
28845
|
function visit(node) {
|
|
28826
28846
|
if (ts.isClassDeclaration(node)) {
|
|
28827
28847
|
const decorators = getDecorators(node);
|
|
28848
|
+
if (node.name) {
|
|
28849
|
+
className = node.name.getText(sourceFile);
|
|
28850
|
+
}
|
|
28828
28851
|
for (const decorator of decorators) {
|
|
28829
28852
|
if (ts.isCallExpression(decorator.expression)) {
|
|
28830
28853
|
const expression = decorator.expression;
|
|
@@ -28869,8 +28892,9 @@ function extractControllerMetadata(sourceFile, filePath) {
|
|
|
28869
28892
|
}
|
|
28870
28893
|
}
|
|
28871
28894
|
}
|
|
28872
|
-
if (httpMethod && methodName) {
|
|
28873
|
-
|
|
28895
|
+
if (httpMethod && methodName && className) {
|
|
28896
|
+
const operationId = `${className}_${methodName}`;
|
|
28897
|
+
metadata.set(operationId, {
|
|
28874
28898
|
file: filePath,
|
|
28875
28899
|
line: line + 1,
|
|
28876
28900
|
method: httpMethod,
|