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.
- package/dist/index.js +13 -8
- 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(
|
|
82
|
+
function trackingScript() {
|
|
83
83
|
return `
|
|
84
84
|
<script data-checkpoint>
|
|
85
85
|
(function(){
|
|
86
|
-
var
|
|
86
|
+
var lastPath='';
|
|
87
87
|
function report(){
|
|
88
88
|
try{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
|
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}` };
|