@gallop.software/studio 2.2.0 → 2.2.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.
@@ -11,7 +11,7 @@
11
11
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
12
12
  }
13
13
  </style>
14
- <script type="module" crossorigin src="/assets/index-DoxGS88r.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-7rndMerw.js"></script>
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -2311,6 +2311,36 @@ async function handleScanStream() {
2311
2311
  await cleanupEmptyFoldersRecursive(imagesDir);
2312
2312
  } catch {
2313
2313
  }
2314
+ sendEvent({ type: "cleanup", message: "Checking for orphaned entries..." });
2315
+ const orphanedEntries = [];
2316
+ const cdnUrls = meta._cdns || [];
2317
+ const r2PublicUrl = (process.env.CLOUDFLARE_R2_PUBLIC_URL || "").replace(/\/$/, "");
2318
+ for (const key of Object.keys(meta)) {
2319
+ if (key.startsWith("_")) continue;
2320
+ const entry = meta[key];
2321
+ if (!entry) continue;
2322
+ if (entry.c !== void 0) {
2323
+ if (entry.u === 1) {
2324
+ const localPath2 = getPublicPath(key);
2325
+ try {
2326
+ await fs8.access(localPath2);
2327
+ } catch {
2328
+ delete entry.u;
2329
+ }
2330
+ }
2331
+ continue;
2332
+ }
2333
+ const localPath = getPublicPath(key);
2334
+ try {
2335
+ await fs8.access(localPath);
2336
+ } catch {
2337
+ orphanedEntries.push(key);
2338
+ delete meta[key];
2339
+ }
2340
+ }
2341
+ if (orphanedEntries.length > 0) {
2342
+ sendEvent({ type: "cleanup", message: `Removed ${orphanedEntries.length} orphaned entries...` });
2343
+ }
2314
2344
  await saveMeta(meta);
2315
2345
  sendEvent({
2316
2346
  type: "complete",
@@ -2320,7 +2350,8 @@ async function handleScanStream() {
2320
2350
  errors: errors.length,
2321
2351
  renamedFiles: renamed,
2322
2352
  orphanedFiles: orphanedFiles.length > 0 ? orphanedFiles : void 0,
2323
- pendingUpdates: pendingUpdates.length
2353
+ pendingUpdates: pendingUpdates.length,
2354
+ orphanedEntries: orphanedEntries.length
2324
2355
  });
2325
2356
  } catch (error) {
2326
2357
  console.error("Scan failed:", error);