versioned-d.ts-tools 0.8.1 → 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.
@@ -104,11 +104,25 @@ function removeVersion(sourceDtsPath, outputFilePath, versionString, configFileP
104
104
  console.warn(`Warning: Could not parse configuration file ${configFilePath}: ${error.message}`);
105
105
  }
106
106
  }
107
+ // Clean up extra blank lines (reduce 3+ consecutive newlines to max 2)
108
+ wholeDts = removeExtraBlankLines(wholeDts);
107
109
  fsx.writeFileSync(outputFilePath, wholeDts);
108
110
  }
109
111
  function escapeRegExp(string) {
110
112
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
111
113
  }
114
+ function removeExtraBlankLines(content) {
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
+ }
125
+ }
112
126
  // CLI entry point
113
127
  if (require.main === module) {
114
128
  const args = process.argv.slice(2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "versioned-d.ts-tools",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "Tools for managing versioned TypeScript definition files",
5
5
  "main": "dist/index.js",
6
6
  "bin": {