@promakeai/inspector 0.1.0 → 0.1.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/plugin.d.ts.map +1 -1
- package/dist/plugin.js +61 -0
- package/package.json +1 -1
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,wBAAgB,eAAe,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,wBAAgB,eAAe,IAAI,MAAM,CA4vCxC"}
|
package/dist/plugin.js
CHANGED
|
@@ -1245,6 +1245,67 @@ export function inspectorPlugin() {
|
|
|
1245
1245
|
console.log('🏷️ Badge auto-enabled for preview.promake.ai');
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
|
+
// 🖼️ Auto cache-bust all images on page load
|
|
1249
|
+
// This ensures images are always fresh when page is refreshed/reloaded
|
|
1250
|
+
function cacheBustAllImages() {
|
|
1251
|
+
const timestamp = Date.now();
|
|
1252
|
+
let imageCount = 0;
|
|
1253
|
+
|
|
1254
|
+
// Cache-bust all <img> tags
|
|
1255
|
+
const images = document.querySelectorAll('img');
|
|
1256
|
+
images.forEach((img) => {
|
|
1257
|
+
if (img.src && !img.src.startsWith('data:')) {
|
|
1258
|
+
try {
|
|
1259
|
+
const url = new URL(img.src);
|
|
1260
|
+
// Remove old cache busting params
|
|
1261
|
+
url.searchParams.delete('_t');
|
|
1262
|
+
url.searchParams.delete('_cache_bust');
|
|
1263
|
+
url.searchParams.delete('v');
|
|
1264
|
+
// Add new timestamp
|
|
1265
|
+
url.searchParams.set('_t', timestamp.toString());
|
|
1266
|
+
img.src = url.toString();
|
|
1267
|
+
imageCount++;
|
|
1268
|
+
} catch (e) {
|
|
1269
|
+
// Ignore invalid URLs
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
|
|
1274
|
+
// Cache-bust background images
|
|
1275
|
+
const allElements = document.querySelectorAll('*');
|
|
1276
|
+
allElements.forEach((el) => {
|
|
1277
|
+
const bgImage = window.getComputedStyle(el).backgroundImage;
|
|
1278
|
+
if (bgImage && bgImage !== 'none' && bgImage.includes('url(')) {
|
|
1279
|
+
const urlMatch = bgImage.match(/url\(['"]?([^'"]+)['"]?\)/);
|
|
1280
|
+
if (urlMatch && urlMatch[1] && !urlMatch[1].startsWith('data:')) {
|
|
1281
|
+
try {
|
|
1282
|
+
const url = new URL(urlMatch[1], window.location.origin);
|
|
1283
|
+
url.searchParams.delete('_t');
|
|
1284
|
+
url.searchParams.delete('_cache_bust');
|
|
1285
|
+
url.searchParams.delete('v');
|
|
1286
|
+
url.searchParams.set('_t', timestamp.toString());
|
|
1287
|
+
el.style.backgroundImage = 'url("' + url.toString() + '")';
|
|
1288
|
+
imageCount++;
|
|
1289
|
+
} catch (e) {
|
|
1290
|
+
// Ignore invalid URLs
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
if (imageCount > 0) {
|
|
1297
|
+
console.log('🖼️ [INSPECTOR] Cache-busted ' + imageCount + ' images on page load');
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// Run cache-bust after DOM is fully loaded
|
|
1302
|
+
if (document.readyState === 'loading') {
|
|
1303
|
+
document.addEventListener('DOMContentLoaded', cacheBustAllImages);
|
|
1304
|
+
} else {
|
|
1305
|
+
// DOM already loaded, run immediately
|
|
1306
|
+
cacheBustAllImages();
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1248
1309
|
console.log('🔍 Inspector plugin loaded');
|
|
1249
1310
|
})();
|
|
1250
1311
|
`,
|