pruny 1.44.4 → 1.44.6
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 +15 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14198,7 +14198,7 @@ function getAppName(filePath) {
|
|
|
14198
14198
|
}
|
|
14199
14199
|
function makeCodePattern(name) {
|
|
14200
14200
|
const escaped = escapeRegExp(name);
|
|
14201
|
-
return new RegExp(`\\b${escaped}\\s*[({.,;<>|&\\[=)]` + `|\\b${escaped}\\s*\\)` + `|\\.[\\s\\n]*${escaped}\\b` + `|\\b${escaped}\\s*:[^:]` + `|:\\s*${escaped}\\b`);
|
|
14201
|
+
return new RegExp(`\\b${escaped}\\s*[({.,;<>|&\\[=)]` + `|\\b${escaped}\\s*\\)` + `|\\.[\\s\\n]*${escaped}\\b` + `|\\b${escaped}\\s*:[^:]` + `|:\\s*${escaped}\\b` + `|<\\/?${escaped}(?=[\\s/>]|$)`);
|
|
14202
14202
|
}
|
|
14203
14203
|
function escapeRegExp(string) {
|
|
14204
14204
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -15460,6 +15460,7 @@ function deleteDeclaration(lines, startLine, name) {
|
|
|
15460
15460
|
return 0;
|
|
15461
15461
|
let endLine = startLine;
|
|
15462
15462
|
let braceCount = 0;
|
|
15463
|
+
let bracketCount = 0;
|
|
15463
15464
|
let parenCount = 0;
|
|
15464
15465
|
let foundMethodDefinition = false;
|
|
15465
15466
|
let foundBodyOpening = false;
|
|
@@ -15485,7 +15486,7 @@ function deleteDeclaration(lines, startLine, name) {
|
|
|
15485
15486
|
const extraOpens = (afterTick.match(/{/g) || []).length;
|
|
15486
15487
|
const extraCloses = (afterTick.match(/}/g) || []).length;
|
|
15487
15488
|
braceCount += extraOpens - extraCloses;
|
|
15488
|
-
if (foundBodyOpening && braceCount <= 0) {
|
|
15489
|
+
if (foundBodyOpening && braceCount <= 0 && bracketCount <= 0) {
|
|
15489
15490
|
endLine = i;
|
|
15490
15491
|
foundClosing = true;
|
|
15491
15492
|
break;
|
|
@@ -15493,15 +15494,20 @@ function deleteDeclaration(lines, startLine, name) {
|
|
|
15493
15494
|
}
|
|
15494
15495
|
continue;
|
|
15495
15496
|
}
|
|
15497
|
+
let lineToSanitize = line;
|
|
15496
15498
|
if (backtickCount % 2 !== 0) {
|
|
15497
15499
|
inTemplateLiteral = true;
|
|
15500
|
+
const firstTick = lineForBackticks.indexOf("`");
|
|
15501
|
+
lineToSanitize = line.slice(0, firstTick);
|
|
15498
15502
|
}
|
|
15499
15503
|
const isDecorator = trimmed.startsWith("@");
|
|
15500
|
-
const cleanLine = sanitizeLine(
|
|
15504
|
+
const cleanLine = sanitizeLine(lineToSanitize);
|
|
15501
15505
|
const openBraces = (cleanLine.match(/{/g) || []).length;
|
|
15502
15506
|
const closeBraces = (cleanLine.match(/}/g) || []).length;
|
|
15503
15507
|
const openParens = (cleanLine.match(/\(/g) || []).length;
|
|
15504
15508
|
const closeParens = (cleanLine.match(/\)/g) || []).length;
|
|
15509
|
+
const openBrackets = (cleanLine.match(/\[/g) || []).length;
|
|
15510
|
+
const closeBrackets = (cleanLine.match(/\]/g) || []).length;
|
|
15505
15511
|
if (!foundMethodDefinition) {
|
|
15506
15512
|
if (isDecorator || currentDecoratorParenDepth > 0 || currentDecoratorBraceDepth > 0) {
|
|
15507
15513
|
currentDecoratorParenDepth += openParens - closeParens;
|
|
@@ -15520,11 +15526,12 @@ function deleteDeclaration(lines, startLine, name) {
|
|
|
15520
15526
|
}
|
|
15521
15527
|
foundMethodDefinition = true;
|
|
15522
15528
|
braceCount = openBraces - closeBraces;
|
|
15529
|
+
bracketCount = openBrackets - closeBrackets;
|
|
15523
15530
|
parenCount = openParens - closeParens;
|
|
15524
|
-
if (openBraces > 0 && parenCount === 0) {
|
|
15531
|
+
if ((openBraces > 0 || bracketCount > 0) && parenCount === 0) {
|
|
15525
15532
|
foundBodyOpening = true;
|
|
15526
15533
|
}
|
|
15527
|
-
if (foundBodyOpening && braceCount <= 0) {
|
|
15534
|
+
if (foundBodyOpening && braceCount <= 0 && bracketCount <= 0) {
|
|
15528
15535
|
endLine = i;
|
|
15529
15536
|
foundClosing = true;
|
|
15530
15537
|
break;
|
|
@@ -15533,11 +15540,12 @@ function deleteDeclaration(lines, startLine, name) {
|
|
|
15533
15540
|
}
|
|
15534
15541
|
} else {
|
|
15535
15542
|
braceCount += openBraces - closeBraces;
|
|
15543
|
+
bracketCount += openBrackets - closeBrackets;
|
|
15536
15544
|
parenCount += openParens - closeParens;
|
|
15537
|
-
if (!foundBodyOpening && openBraces > 0 && parenCount === 0) {
|
|
15545
|
+
if (!foundBodyOpening && (openBraces > 0 || openBrackets > 0) && parenCount === 0) {
|
|
15538
15546
|
foundBodyOpening = true;
|
|
15539
15547
|
}
|
|
15540
|
-
if (foundBodyOpening && braceCount <= 0) {
|
|
15548
|
+
if (foundBodyOpening && braceCount <= 0 && bracketCount <= 0) {
|
|
15541
15549
|
endLine = i;
|
|
15542
15550
|
foundClosing = true;
|
|
15543
15551
|
break;
|