checkpoint-cli 0.3.0 → 0.3.2
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 +6 -5
- package/dist/tracking-script-minimal.js +2 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1269,7 +1269,8 @@ function trackingScript() {
|
|
|
1269
1269
|
}
|
|
1270
1270
|
/* ── Injection Proxy ── */
|
|
1271
1271
|
function startInjectionProxy(targetPort) {
|
|
1272
|
-
const
|
|
1272
|
+
const scriptBody = (0, tracking_script_minimal_js_1.buildMinimalTrackingScript)().replace(/<\/script/gi, '<\\/script');
|
|
1273
|
+
const SCRIPT = `<script data-checkpoint-script="minimal-v1">\n${scriptBody}\n</script>`;
|
|
1273
1274
|
return new Promise((resolve, reject) => {
|
|
1274
1275
|
const server = http_1.default.createServer((req, res) => {
|
|
1275
1276
|
const fwdHeaders = { ...req.headers, host: `localhost:${targetPort}` };
|
|
@@ -1292,12 +1293,12 @@ function startInjectionProxy(targetPort) {
|
|
|
1292
1293
|
proxyRes.on('data', (chunk) => chunks.push(chunk));
|
|
1293
1294
|
proxyRes.on('end', () => {
|
|
1294
1295
|
let body = Buffer.concat(chunks).toString('utf-8');
|
|
1295
|
-
if (!body.includes('data-checkpoint-script=')) {
|
|
1296
|
+
if (!body.includes('data-checkpoint-script="minimal-v1"')) {
|
|
1296
1297
|
if (body.includes('</head>')) {
|
|
1297
|
-
body = body.replace('</head>', SCRIPT + '\n</head>');
|
|
1298
|
+
body = body.replace('</head>', () => SCRIPT + '\n</head>');
|
|
1298
1299
|
}
|
|
1299
1300
|
else if (body.includes('</body>')) {
|
|
1300
|
-
body = body.replace('</body>', SCRIPT + '\n</body>');
|
|
1301
|
+
body = body.replace('</body>', () => SCRIPT + '\n</body>');
|
|
1301
1302
|
}
|
|
1302
1303
|
else {
|
|
1303
1304
|
body += SCRIPT;
|
|
@@ -1605,7 +1606,7 @@ const program = new commander_1.Command();
|
|
|
1605
1606
|
program
|
|
1606
1607
|
.name('checkpoint')
|
|
1607
1608
|
.description('Share your localhost with reviewers — get visual feedback directly on the page')
|
|
1608
|
-
.version('0.3.
|
|
1609
|
+
.version('0.3.2');
|
|
1609
1610
|
// ── checkpoint login ──
|
|
1610
1611
|
program
|
|
1611
1612
|
.command('login')
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildMinimalTrackingScript = buildMinimalTrackingScript;
|
|
4
4
|
function buildMinimalTrackingScript() {
|
|
5
|
-
return String.raw `
|
|
6
|
-
<script data-checkpoint-script="1">
|
|
7
|
-
(function(){
|
|
5
|
+
return String.raw `(function(){
|
|
8
6
|
var pickMode=false;
|
|
9
7
|
var pickMoveHandler=null;
|
|
10
8
|
var pickPointerDownHandler=null;
|
|
@@ -594,6 +592,5 @@ function buildMinimalTrackingScript() {
|
|
|
594
592
|
});
|
|
595
593
|
|
|
596
594
|
setInterval(reportNav,500);
|
|
597
|
-
})();
|
|
598
|
-
</script>`.trim();
|
|
595
|
+
})();`.trim();
|
|
599
596
|
}
|