draply-dev 1.0.5 → 1.0.7
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/bin/cli.js +9 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -222,6 +222,15 @@ Return ONLY the patch blocks.`;
|
|
|
222
222
|
if (newContent.includes(patch.search)) {
|
|
223
223
|
newContent = newContent.replace(patch.search, patch.replace);
|
|
224
224
|
applied++;
|
|
225
|
+
} else {
|
|
226
|
+
// Fallback to whitespace-agnostic matching
|
|
227
|
+
const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
228
|
+
const looseRegexStr = escapeRegExp(patch.search.trim()).replace(/\\s+/g, '\\s+');
|
|
229
|
+
const looseRegex = new RegExp(looseRegexStr);
|
|
230
|
+
if (looseRegex.test(newContent)) {
|
|
231
|
+
newContent = newContent.replace(looseRegex, patch.replace);
|
|
232
|
+
applied++;
|
|
233
|
+
}
|
|
225
234
|
}
|
|
226
235
|
}
|
|
227
236
|
|