@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 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 url = `http://localhost:${SERVER_PORT}/api/__framework__/debug`;
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.startsWith("/api/") && !route.path.includes("__framework__") && !route.path.includes("__innerapi__") && !route.path.startsWith("/api/capability");
3363
- }).map((route) => ({
3364
- id: generateRouteId(route.method || "GET", route.path),
3365
- path: route.path,
3366
- method: (route.method || "GET").toUpperCase(),
3367
- module: extractModuleFromPath(route.path)
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 routes = await fetchRoutesFromBackend();
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,