pruny 1.44.4 → 1.44.5
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 +11 -6
- 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;
|
|
@@ -15502,6 +15503,8 @@ function deleteDeclaration(lines, startLine, name) {
|
|
|
15502
15503
|
const closeBraces = (cleanLine.match(/}/g) || []).length;
|
|
15503
15504
|
const openParens = (cleanLine.match(/\(/g) || []).length;
|
|
15504
15505
|
const closeParens = (cleanLine.match(/\)/g) || []).length;
|
|
15506
|
+
const openBrackets = (cleanLine.match(/\[/g) || []).length;
|
|
15507
|
+
const closeBrackets = (cleanLine.match(/\]/g) || []).length;
|
|
15505
15508
|
if (!foundMethodDefinition) {
|
|
15506
15509
|
if (isDecorator || currentDecoratorParenDepth > 0 || currentDecoratorBraceDepth > 0) {
|
|
15507
15510
|
currentDecoratorParenDepth += openParens - closeParens;
|
|
@@ -15520,11 +15523,12 @@ function deleteDeclaration(lines, startLine, name) {
|
|
|
15520
15523
|
}
|
|
15521
15524
|
foundMethodDefinition = true;
|
|
15522
15525
|
braceCount = openBraces - closeBraces;
|
|
15526
|
+
bracketCount = openBrackets - closeBrackets;
|
|
15523
15527
|
parenCount = openParens - closeParens;
|
|
15524
|
-
if (openBraces > 0 && parenCount === 0) {
|
|
15528
|
+
if ((openBraces > 0 || bracketCount > 0) && parenCount === 0) {
|
|
15525
15529
|
foundBodyOpening = true;
|
|
15526
15530
|
}
|
|
15527
|
-
if (foundBodyOpening && braceCount <= 0) {
|
|
15531
|
+
if (foundBodyOpening && braceCount <= 0 && bracketCount <= 0) {
|
|
15528
15532
|
endLine = i;
|
|
15529
15533
|
foundClosing = true;
|
|
15530
15534
|
break;
|
|
@@ -15533,11 +15537,12 @@ function deleteDeclaration(lines, startLine, name) {
|
|
|
15533
15537
|
}
|
|
15534
15538
|
} else {
|
|
15535
15539
|
braceCount += openBraces - closeBraces;
|
|
15540
|
+
bracketCount += openBrackets - closeBrackets;
|
|
15536
15541
|
parenCount += openParens - closeParens;
|
|
15537
|
-
if (!foundBodyOpening && openBraces > 0 && parenCount === 0) {
|
|
15542
|
+
if (!foundBodyOpening && (openBraces > 0 || openBrackets > 0) && parenCount === 0) {
|
|
15538
15543
|
foundBodyOpening = true;
|
|
15539
15544
|
}
|
|
15540
|
-
if (foundBodyOpening && braceCount <= 0) {
|
|
15545
|
+
if (foundBodyOpening && braceCount <= 0 && bracketCount <= 0) {
|
|
15541
15546
|
endLine = i;
|
|
15542
15547
|
foundClosing = true;
|
|
15543
15548
|
break;
|