pruny 1.43.1 → 1.43.3
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.js +48 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12576,30 +12576,32 @@ var EXPORTED_METHOD_PATTERN = /export\s+(?:async\s+)?(?:function|const)\s+(GET|P
|
|
|
12576
12576
|
var NEST_CONTROLLER_PATTERN = /@Controller\s*\(\s*(?:['"`]([^'"`]*)['"`])?\s*\)/;
|
|
12577
12577
|
var NEST_METHOD_PATTERN = /@(Get|Post|Put|Delete|Patch|Options|Head|All)\s*\(\s*(?:['"`]([^'"`]*)['"`])?\s*\)/g;
|
|
12578
12578
|
var API_METHOD_PATTERNS = [
|
|
12579
|
-
{ regex: /(?:axios|api|http|client|service)!?\.get\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "GET" },
|
|
12580
|
-
{ regex: /(?:axios|api|http|client|service)!?\.post\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "POST" },
|
|
12581
|
-
{ regex: /(?:axios|api|http|client|service)!?\.put\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "PUT" },
|
|
12582
|
-
{ regex: /(?:axios|api|http|client|service)!?\.delete\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "DELETE" },
|
|
12583
|
-
{ regex: /(?:axios|api|http|client|service)!?\.patch\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "PATCH" },
|
|
12584
|
-
{ regex: /(?:axios|api|http|client|service)!?\.get\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "GET" },
|
|
12585
|
-
{ regex: /(?:axios|api|http|client|service)!?\.post\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "POST" },
|
|
12586
|
-
{ regex: /(?:axios|api|http|client|service)!?\.put\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "PUT" },
|
|
12587
|
-
{ regex: /(?:axios|api|http|client|service)!?\.delete\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "DELETE" },
|
|
12588
|
-
{ regex: /(?:axios|api|http|client|service)!?\.patch\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "PATCH" },
|
|
12589
|
-
{ regex: /useSWR\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "GET" },
|
|
12590
|
-
{ regex: /useSWR\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "GET" },
|
|
12591
|
-
{ regex: /fetch\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: undefined },
|
|
12592
|
-
{ regex: /fetch\s*\(\s*`([^`]*?\/[^`]*)`/g, method: undefined },
|
|
12593
|
-
{ regex: /['"`](\/api\/[^'"`\s]+)['"`]/g, method: undefined },
|
|
12594
|
-
{ regex: /`([^`\n]*?\/api\/[^`\n]*)`/g, method: undefined },
|
|
12595
|
-
{ regex: /`
|
|
12596
|
-
{ regex:
|
|
12597
|
-
{ regex:
|
|
12598
|
-
{ regex: /[
|
|
12579
|
+
{ regex: /(?:axios|api|http|client|service)!?\.get\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "GET", source: "http-client" },
|
|
12580
|
+
{ regex: /(?:axios|api|http|client|service)!?\.post\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "POST", source: "http-client" },
|
|
12581
|
+
{ regex: /(?:axios|api|http|client|service)!?\.put\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "PUT", source: "http-client" },
|
|
12582
|
+
{ regex: /(?:axios|api|http|client|service)!?\.delete\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "DELETE", source: "http-client" },
|
|
12583
|
+
{ regex: /(?:axios|api|http|client|service)!?\.patch\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "PATCH", source: "http-client" },
|
|
12584
|
+
{ regex: /(?:axios|api|http|client|service)!?\.get\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "GET", source: "http-client" },
|
|
12585
|
+
{ regex: /(?:axios|api|http|client|service)!?\.post\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "POST", source: "http-client" },
|
|
12586
|
+
{ regex: /(?:axios|api|http|client|service)!?\.put\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "PUT", source: "http-client" },
|
|
12587
|
+
{ regex: /(?:axios|api|http|client|service)!?\.delete\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "DELETE", source: "http-client" },
|
|
12588
|
+
{ regex: /(?:axios|api|http|client|service)!?\.patch\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "PATCH", source: "http-client" },
|
|
12589
|
+
{ regex: /useSWR\s*(?:<[^>]+>)?\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: "GET", source: "http-client" },
|
|
12590
|
+
{ regex: /useSWR\s*(?:<[^>]+>)?\s*\(\s*`([^`]*?\/[^`]*)`/g, method: "GET", source: "http-client" },
|
|
12591
|
+
{ regex: /fetch\s*\(\s*['"`](\/[^'"`\s)]+)['"`]/g, method: undefined, source: "http-client" },
|
|
12592
|
+
{ regex: /fetch\s*\(\s*`([^`]*?\/[^`]*)`/g, method: undefined, source: "http-client" },
|
|
12593
|
+
{ regex: /['"`](\/api\/[^'"`\s]+)['"`]/g, method: undefined, source: "http-client" },
|
|
12594
|
+
{ regex: /`([^`\n]*?\/api\/[^`\n]*)`/g, method: undefined, source: "http-client" },
|
|
12595
|
+
{ regex: /`[^`]*?(\/api\/[\w-]+(?:\/[\w-]+)*(?:\/\$\{[^}]+\})*)[^`]*?`/gs, method: undefined, source: "http-client" },
|
|
12596
|
+
{ regex: /`[^`\n]*(?:API_URL|BASE_URL|BACKEND_URL|SERVER_URL)\}(\/[^`\n]*)`/g, method: undefined, source: "http-client" },
|
|
12597
|
+
{ regex: /`([^`\n]*?(\/[\w-]{2,}\/[^`\n]*))`/g, method: undefined, source: "generic" },
|
|
12598
|
+
{ regex: /https?:\/\/[^/]+(\/[^'"`\s]*)/g, method: undefined, source: "http-client" },
|
|
12599
|
+
{ regex: /['"`](\/[\w-]{2,}\/[^'"`\s]*)['"`]/g, method: undefined, source: "generic" },
|
|
12600
|
+
{ regex: /['"`](\/api\/[^'"`\s]*)['"`]/g, method: undefined, source: "http-client" }
|
|
12599
12601
|
];
|
|
12600
12602
|
function extractApiReferences(content) {
|
|
12601
12603
|
const matches = [];
|
|
12602
|
-
for (const { regex, method } of API_METHOD_PATTERNS) {
|
|
12604
|
+
for (const { regex, method, source } of API_METHOD_PATTERNS) {
|
|
12603
12605
|
regex.lastIndex = 0;
|
|
12604
12606
|
let regexMatch;
|
|
12605
12607
|
while ((regexMatch = regex.exec(content)) !== null) {
|
|
@@ -12607,6 +12609,7 @@ function extractApiReferences(content) {
|
|
|
12607
12609
|
matches.push({
|
|
12608
12610
|
path: regexMatch[1],
|
|
12609
12611
|
method,
|
|
12612
|
+
source,
|
|
12610
12613
|
start: regexMatch.index,
|
|
12611
12614
|
end: regexMatch.index + regexMatch[0].length
|
|
12612
12615
|
});
|
|
@@ -12640,8 +12643,15 @@ function extractApiReferences(content) {
|
|
|
12640
12643
|
for (const match of acceptedMatches) {
|
|
12641
12644
|
const key = `${match.path}::${match.method || "ANY"}`;
|
|
12642
12645
|
if (!seen.has(key)) {
|
|
12643
|
-
references.push({ path: match.path, method: match.method });
|
|
12646
|
+
references.push({ path: match.path, method: match.method, source: match.source });
|
|
12644
12647
|
seen.add(key);
|
|
12648
|
+
} else {
|
|
12649
|
+
if (match.source === "http-client") {
|
|
12650
|
+
const existing = references.find((r) => `${r.path}::${r.method || "ANY"}` === key);
|
|
12651
|
+
if (existing && existing.source === "generic") {
|
|
12652
|
+
existing.source = "http-client";
|
|
12653
|
+
}
|
|
12654
|
+
}
|
|
12645
12655
|
}
|
|
12646
12656
|
}
|
|
12647
12657
|
return references;
|
|
@@ -16142,6 +16152,20 @@ function extractNestRoutes(filePath, content, globalPrefix = "api") {
|
|
|
16142
16152
|
console.log(`[DEBUG] Extracted Route: ${fullPath} from ${filePath}`);
|
|
16143
16153
|
}
|
|
16144
16154
|
}
|
|
16155
|
+
if (routes.length === 0 && controllerMatch) {
|
|
16156
|
+
const fullPath = `/${globalPrefix}/${controllerPath}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
16157
|
+
routes.push({
|
|
16158
|
+
type: "nestjs",
|
|
16159
|
+
path: fullPath,
|
|
16160
|
+
filePath,
|
|
16161
|
+
used: false,
|
|
16162
|
+
references: [],
|
|
16163
|
+
methods: [],
|
|
16164
|
+
unusedMethods: [],
|
|
16165
|
+
methodLines: {},
|
|
16166
|
+
methodNames: {}
|
|
16167
|
+
});
|
|
16168
|
+
}
|
|
16145
16169
|
return routes;
|
|
16146
16170
|
}
|
|
16147
16171
|
function extractNestMethodName(content) {
|
|
@@ -16238,7 +16262,8 @@ function checkRouteUsage(route, references, nestGlobalPrefix = "") {
|
|
|
16238
16262
|
}
|
|
16239
16263
|
const usedMethods = new Set;
|
|
16240
16264
|
let used = false;
|
|
16241
|
-
|
|
16265
|
+
const filteredRefs = route.type === "nestjs" ? references.filter((r) => r.source === "http-client") : references;
|
|
16266
|
+
for (const ref of filteredRefs) {
|
|
16242
16267
|
let normalizedFound = ref.path.replace(/\s+/g, "").replace(/\$\{[^}]+\}/g, "*").replace(/\/$/, "").replace(/\?.*$/, "").replace(/\/+/g, "/").toLowerCase();
|
|
16243
16268
|
if (normalizedFound.startsWith("*")) {
|
|
16244
16269
|
const firstSlash = normalizedFound.indexOf("/");
|