checkpoint-cli 0.1.2 → 0.1.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 (2) hide show
  1. package/dist/index.js +13 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -79,17 +79,21 @@ function requireAuth() {
79
79
  }
80
80
  }
81
81
  /* ── Checkpoint Tracking Script (injected into HTML responses) ── */
82
- function trackingScript(checkpointOrigin) {
82
+ function trackingScript() {
83
83
  return `
84
84
  <script data-checkpoint>
85
85
  (function(){
86
- var origin=${JSON.stringify(checkpointOrigin)};
86
+ var lastPath='';
87
87
  function report(){
88
88
  try{
89
- window.parent.postMessage({
90
- type:'checkpoint:navigate',
91
- path:location.pathname+location.search
92
- },origin);
89
+ var p=location.pathname+location.search+location.hash;
90
+ if(p!==lastPath){
91
+ lastPath=p;
92
+ window.parent.postMessage({
93
+ type:'checkpoint:navigate',
94
+ path:p
95
+ },'*');
96
+ }
93
97
  }catch(e){}
94
98
  }
95
99
  report();
@@ -97,13 +101,14 @@ function trackingScript(checkpointOrigin) {
97
101
  history.pushState=function(){_ps.apply(this,arguments);report();};
98
102
  history.replaceState=function(){_rs.apply(this,arguments);report();};
99
103
  window.addEventListener('popstate',report);
104
+ window.addEventListener('hashchange',report);
105
+ setInterval(report,500);
100
106
  })();
101
107
  </script>`.trim();
102
108
  }
103
109
  /* ── Injection Proxy ── */
104
110
  function startInjectionProxy(targetPort) {
105
- const APP_URL = (0, config_js_1.getAppUrl)();
106
- const SCRIPT = trackingScript(APP_URL);
111
+ const SCRIPT = trackingScript();
107
112
  return new Promise((resolve, reject) => {
108
113
  const server = http_1.default.createServer((req, res) => {
109
114
  const fwdHeaders = { ...req.headers, host: `localhost:${targetPort}` };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "checkpoint-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Share your localhost with reviewers — get visual feedback directly on the page",
5
5
  "keywords": [
6
6
  "checkpoint",