draply-dev 1.0.4 → 1.0.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.
Files changed (2) hide show
  1. package/bin/cli.js +11 -2
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -18,8 +18,8 @@ const INJECT_TAG = `\n<link rel="stylesheet" href="/draply.css">\n<script ${MARK
18
18
 
19
19
  function injectOverlay(html) {
20
20
  if (html.includes(MARKER)) return html;
21
- if (html.includes('</body>')) return html.replace(/<\/body>/i, INJECT_TAG + '\n</body>');
22
- if (html.includes('</html>')) return html.replace(/<\/html>/i, INJECT_TAG + '\n</html>');
21
+ if (html.includes('</body>')) return html.replace(/<\/body>/i, () => INJECT_TAG + '\n</body>');
22
+ if (html.includes('</html>')) return html.replace(/<\/html>/i, () => INJECT_TAG + '\n</html>');
23
23
  return html + INJECT_TAG;
24
24
  }
25
25
 
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draply-dev",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Visual overlay for any frontend project — move, resize, restyle live in the browser, save to CSS",
5
5
  "author": "Arman",
6
6
  "type": "commonjs",