draply-dev 1.5.2 → 1.5.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.
Files changed (3) hide show
  1. package/bin/cli.js +5 -2
  2. package/package.json +1 -1
  3. package/src/overlay.js +1024 -1015
package/bin/cli.js CHANGED
@@ -33,13 +33,16 @@ if (args.includes('--version') || args.includes('-v')) {
33
33
  const targetPort = parseInt(args.filter(a => !a.startsWith('-'))[0]) || 3000;
34
34
  const proxyPort = parseInt(args.filter(a => !a.startsWith('-'))[1]) || 4000;
35
35
  const targetHost = args.filter(a => !a.startsWith('-'))[2] || 'localhost';
36
- const OVERLAY_JS = fs.readFileSync(path.join(__dirname, '../src/overlay.js'), 'utf8');
37
36
  // Unique marker that does NOT appear inside overlay.js itself
38
37
  const MARKER = 'data-ps-done="1"';
39
- const INJECT_TAG = `\n<link rel="stylesheet" href="/draply.css">\n<script ${MARKER}>\n${OVERLAY_JS}\n</script>`;
40
38
 
41
39
  function injectOverlay(html) {
42
40
  if (html.includes(MARKER)) return html;
41
+
42
+ // Read overlay.js per request to allow hot-reloading during development
43
+ const OVERLAY_JS = fs.readFileSync(path.join(__dirname, '../src/overlay.js'), 'utf8');
44
+ const INJECT_TAG = `\n<link rel="stylesheet" href="/draply.css">\n<script ${MARKER}>\n${OVERLAY_JS}\n</script>`;
45
+
43
46
  if (html.includes('</body>')) return html.replace(/<\/body>/i, () => INJECT_TAG + '\n</body>');
44
47
  if (html.includes('</html>')) return html.replace(/<\/html>/i, () => INJECT_TAG + '\n</html>');
45
48
  return html + INJECT_TAG;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draply-dev",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
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",