@lark-apaas/devtool-kits 1.0.8 → 1.0.10
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/error.html +11 -11
- package/dist/index.cjs +74 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +74 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19110,6 +19110,45 @@ var require_get_proto = __commonJS({
|
|
|
19110
19110
|
}
|
|
19111
19111
|
});
|
|
19112
19112
|
|
|
19113
|
+
// ../../../node_modules/async-function/index.js
|
|
19114
|
+
var require_async_function = __commonJS({
|
|
19115
|
+
"../../../node_modules/async-function/index.js"(exports, module) {
|
|
19116
|
+
"use strict";
|
|
19117
|
+
var cached = (
|
|
19118
|
+
/** @type {import('.').AsyncFunctionConstructor} */
|
|
19119
|
+
(async function() {
|
|
19120
|
+
}).constructor
|
|
19121
|
+
);
|
|
19122
|
+
module.exports = () => cached;
|
|
19123
|
+
}
|
|
19124
|
+
});
|
|
19125
|
+
|
|
19126
|
+
// ../../../node_modules/generator-function/index.js
|
|
19127
|
+
var require_generator_function = __commonJS({
|
|
19128
|
+
"../../../node_modules/generator-function/index.js"(exports, module) {
|
|
19129
|
+
"use strict";
|
|
19130
|
+
var cached = (
|
|
19131
|
+
/** @type {GeneratorFunctionConstructor} */
|
|
19132
|
+
(function* () {
|
|
19133
|
+
}).constructor
|
|
19134
|
+
);
|
|
19135
|
+
module.exports = () => cached;
|
|
19136
|
+
}
|
|
19137
|
+
});
|
|
19138
|
+
|
|
19139
|
+
// ../../../node_modules/async-generator-function/index.js
|
|
19140
|
+
var require_async_generator_function = __commonJS({
|
|
19141
|
+
"../../../node_modules/async-generator-function/index.js"(exports, module) {
|
|
19142
|
+
"use strict";
|
|
19143
|
+
var cached = (
|
|
19144
|
+
/** @type {import('.').AsyncGeneratorFunctionConstructor} */
|
|
19145
|
+
(async function* () {
|
|
19146
|
+
}).constructor
|
|
19147
|
+
);
|
|
19148
|
+
module.exports = () => cached;
|
|
19149
|
+
}
|
|
19150
|
+
});
|
|
19151
|
+
|
|
19113
19152
|
// ../../../node_modules/hasown/index.js
|
|
19114
19153
|
var require_hasown = __commonJS({
|
|
19115
19154
|
"../../../node_modules/hasown/index.js"(exports, module) {
|
|
@@ -19141,13 +19180,6 @@ var require_get_intrinsic = __commonJS({
|
|
|
19141
19180
|
var pow = require_pow();
|
|
19142
19181
|
var round = require_round();
|
|
19143
19182
|
var sign = require_sign();
|
|
19144
|
-
var $Function = Function;
|
|
19145
|
-
var getEvalledConstructor = /* @__PURE__ */ __name(function(expressionSyntax) {
|
|
19146
|
-
try {
|
|
19147
|
-
return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
|
|
19148
|
-
} catch (e) {
|
|
19149
|
-
}
|
|
19150
|
-
}, "getEvalledConstructor");
|
|
19151
19183
|
var $gOPD = require_gopd();
|
|
19152
19184
|
var $defineProperty = require_es_define_property();
|
|
19153
19185
|
var throwTypeError = /* @__PURE__ */ __name(function() {
|
|
@@ -19202,7 +19234,7 @@ var require_get_intrinsic = __commonJS({
|
|
|
19202
19234
|
"%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array,
|
|
19203
19235
|
"%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array,
|
|
19204
19236
|
"%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry,
|
|
19205
|
-
"%Function%":
|
|
19237
|
+
"%Function%": Function,
|
|
19206
19238
|
"%GeneratorFunction%": needsEval,
|
|
19207
19239
|
"%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array,
|
|
19208
19240
|
"%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array,
|
|
@@ -19265,14 +19297,17 @@ var require_get_intrinsic = __commonJS({
|
|
|
19265
19297
|
}
|
|
19266
19298
|
}
|
|
19267
19299
|
var errorProto;
|
|
19300
|
+
var getAsyncFunction = require_async_function();
|
|
19301
|
+
var getGeneratorFunction = require_generator_function();
|
|
19302
|
+
var getAsyncGeneratorFunction = require_async_generator_function();
|
|
19268
19303
|
var doEval = /* @__PURE__ */ __name(function doEval2(name) {
|
|
19269
19304
|
var value;
|
|
19270
19305
|
if (name === "%AsyncFunction%") {
|
|
19271
|
-
value =
|
|
19306
|
+
value = getAsyncFunction() || void undefined2;
|
|
19272
19307
|
} else if (name === "%GeneratorFunction%") {
|
|
19273
|
-
value =
|
|
19308
|
+
value = getGeneratorFunction() || void undefined2;
|
|
19274
19309
|
} else if (name === "%AsyncGeneratorFunction%") {
|
|
19275
|
-
value =
|
|
19310
|
+
value = getAsyncGeneratorFunction() || void undefined2;
|
|
19276
19311
|
} else if (name === "%AsyncGenerator%") {
|
|
19277
19312
|
var fn = doEval2("%AsyncGeneratorFunction%");
|
|
19278
19313
|
if (fn) {
|
|
@@ -28611,7 +28646,7 @@ function handleDevProxyError(err, req, res, options) {
|
|
|
28611
28646
|
}
|
|
28612
28647
|
const template = getErrorHtmlTemplate();
|
|
28613
28648
|
const html = injectErrorData(template, errorLogs, clientBasePathWithoutSlash);
|
|
28614
|
-
res.writeHead(
|
|
28649
|
+
res.writeHead(502, {
|
|
28615
28650
|
"Content-Type": "text/html; charset=utf-8",
|
|
28616
28651
|
"Cache-Control": "no-cache, no-store, must-revalidate",
|
|
28617
28652
|
"X-Proxy-Error-Page": "true"
|
|
@@ -28696,6 +28731,25 @@ async function buildSourceMap(controllerFiles, processFile) {
|
|
|
28696
28731
|
return sourceMap;
|
|
28697
28732
|
}
|
|
28698
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");
|
|
28699
28753
|
function enhanceOpenApiPaths(openapi, sourceMap) {
|
|
28700
28754
|
let enhancedCount = 0;
|
|
28701
28755
|
if (!openapi.paths) {
|
|
@@ -28705,7 +28759,7 @@ function enhanceOpenApiPaths(openapi, sourceMap) {
|
|
|
28705
28759
|
if (!pathItem || typeof pathItem !== "object") continue;
|
|
28706
28760
|
for (const operation of Object.values(pathItem)) {
|
|
28707
28761
|
if (operation && typeof operation === "object" && "operationId" in operation) {
|
|
28708
|
-
const sourceInfo =
|
|
28762
|
+
const sourceInfo = findSourceInfo(operation.operationId, sourceMap);
|
|
28709
28763
|
if (sourceInfo) {
|
|
28710
28764
|
operation["x-source"] = {
|
|
28711
28765
|
file: sourceInfo.file,
|
|
@@ -28777,6 +28831,7 @@ __name(processControllerFile, "processControllerFile");
|
|
|
28777
28831
|
function extractControllerMetadata(sourceFile, filePath) {
|
|
28778
28832
|
const metadata = /* @__PURE__ */ new Map();
|
|
28779
28833
|
let controllerPath = "";
|
|
28834
|
+
let className = "";
|
|
28780
28835
|
function getDecorators(node) {
|
|
28781
28836
|
if ("modifiers" in node && Array.isArray(node.modifiers)) {
|
|
28782
28837
|
return node.modifiers.filter((mod) => mod.kind === ts.SyntaxKind.Decorator);
|
|
@@ -28790,6 +28845,9 @@ function extractControllerMetadata(sourceFile, filePath) {
|
|
|
28790
28845
|
function visit(node) {
|
|
28791
28846
|
if (ts.isClassDeclaration(node)) {
|
|
28792
28847
|
const decorators = getDecorators(node);
|
|
28848
|
+
if (node.name) {
|
|
28849
|
+
className = node.name.getText(sourceFile);
|
|
28850
|
+
}
|
|
28793
28851
|
for (const decorator of decorators) {
|
|
28794
28852
|
if (ts.isCallExpression(decorator.expression)) {
|
|
28795
28853
|
const expression = decorator.expression;
|
|
@@ -28834,8 +28892,9 @@ function extractControllerMetadata(sourceFile, filePath) {
|
|
|
28834
28892
|
}
|
|
28835
28893
|
}
|
|
28836
28894
|
}
|
|
28837
|
-
if (httpMethod && methodName) {
|
|
28838
|
-
|
|
28895
|
+
if (httpMethod && methodName && className) {
|
|
28896
|
+
const operationId = `${className}_${methodName}`;
|
|
28897
|
+
metadata.set(operationId, {
|
|
28839
28898
|
file: filePath,
|
|
28840
28899
|
line: line + 1,
|
|
28841
28900
|
method: httpMethod,
|