@lark-apaas/devtool-kits 1.2.17-alpha.15 → 1.2.17-alpha.17
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 +17 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3341,8 +3341,9 @@ function groupRoutesByModule(routes) {
|
|
|
3341
3341
|
return groups.sort((a, b) => a.name.localeCompare(b.name));
|
|
3342
3342
|
}
|
|
3343
3343
|
__name(groupRoutesByModule, "groupRoutesByModule");
|
|
3344
|
-
async function fetchRoutesFromBackend() {
|
|
3345
|
-
const
|
|
3344
|
+
async function fetchRoutesFromBackend(basePath) {
|
|
3345
|
+
const normalizedBasePath = basePath.replace(/\/+$/, "");
|
|
3346
|
+
const url = `http://localhost:${SERVER_PORT}${normalizedBasePath}/api/__framework__/debug`;
|
|
3346
3347
|
const response = await fetch(url, {
|
|
3347
3348
|
method: "GET",
|
|
3348
3349
|
headers: {
|
|
@@ -3359,13 +3360,18 @@ async function fetchRoutesFromBackend() {
|
|
|
3359
3360
|
}
|
|
3360
3361
|
const debugRoutes = routeConfig.routes;
|
|
3361
3362
|
return debugRoutes.filter((route) => {
|
|
3362
|
-
return route.path.
|
|
3363
|
-
}).map((route) =>
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
method
|
|
3367
|
-
|
|
3368
|
-
|
|
3363
|
+
return route.path.includes("/api/") && !route.path.includes("__framework__") && !route.path.includes("__innerapi__") && !route.path.includes("/api/capability");
|
|
3364
|
+
}).map((route) => {
|
|
3365
|
+
const apiPathMatch = route.path.match(/\/api\/.*/);
|
|
3366
|
+
const apiPath = apiPathMatch ? apiPathMatch[0] : route.path;
|
|
3367
|
+
const method = route.method || "ALL";
|
|
3368
|
+
return {
|
|
3369
|
+
id: generateRouteId(method, apiPath),
|
|
3370
|
+
path: apiPath,
|
|
3371
|
+
method,
|
|
3372
|
+
module: extractModuleFromPath(apiPath)
|
|
3373
|
+
};
|
|
3374
|
+
});
|
|
3369
3375
|
}
|
|
3370
3376
|
__name(fetchRoutesFromBackend, "fetchRoutesFromBackend");
|
|
3371
3377
|
function createApiListHandler() {
|
|
@@ -3374,7 +3380,8 @@ function createApiListHandler() {
|
|
|
3374
3380
|
res.header("Access-Control-Allow-Methods", "GET, OPTIONS");
|
|
3375
3381
|
res.header("Access-Control-Allow-Headers", "Content-Type, Accept");
|
|
3376
3382
|
try {
|
|
3377
|
-
const
|
|
3383
|
+
const basePath = process.env.CLIENT_BASE_PATH || "";
|
|
3384
|
+
const routes = await fetchRoutesFromBackend(basePath);
|
|
3378
3385
|
const groups = groupRoutesByModule(routes);
|
|
3379
3386
|
res.json({
|
|
3380
3387
|
groups,
|