versioned-d.ts-tools 0.8.2 → 0.8.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/version-remover.js +10 -2
- package/package.json +1 -1
package/dist/version-remover.js
CHANGED
|
@@ -112,8 +112,16 @@ function escapeRegExp(string) {
|
|
|
112
112
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
113
113
|
}
|
|
114
114
|
function removeExtraBlankLines(content) {
|
|
115
|
-
//
|
|
116
|
-
|
|
115
|
+
// Detect line ending style (CRLF or LF)
|
|
116
|
+
const hasCRLF = content.includes('\r\n');
|
|
117
|
+
if (hasCRLF) {
|
|
118
|
+
// For CRLF: Replace 3 or more consecutive line breaks with just 2
|
|
119
|
+
return content.replace(/(\r\n){3,}/g, '\r\n\r\n');
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// For LF: Replace 3 or more consecutive newlines with just 2
|
|
123
|
+
return content.replace(/\n{3,}/g, '\n\n');
|
|
124
|
+
}
|
|
117
125
|
}
|
|
118
126
|
// CLI entry point
|
|
119
127
|
if (require.main === module) {
|