@gallop.software/studio 2.1.13 → 2.1.15

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-Cug_vb5C.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-NaPJ8Bxp.js"></script>
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -1599,6 +1599,13 @@ async function handleUnprocessStream(request) {
1599
1599
  `));
1600
1600
  };
1601
1601
  try {
1602
+ let isHiddenOrSystemFile3 = function(filename) {
1603
+ if (filename.startsWith(".")) return true;
1604
+ const windowsFiles = ["thumbs.db", "desktop.ini", "ehthumbs.db", "ehthumbs_vista.db"];
1605
+ if (windowsFiles.includes(filename.toLowerCase())) return true;
1606
+ return false;
1607
+ };
1608
+ var isHiddenOrSystemFile2 = isHiddenOrSystemFile3;
1602
1609
  const meta = await loadMeta();
1603
1610
  const cdnUrls = getCdnUrls(meta);
1604
1611
  const removed = [];
@@ -1657,6 +1664,40 @@ async function handleUnprocessStream(request) {
1657
1664
  sendEvent({ type: "cleanup", message: "Purging CDN cache..." });
1658
1665
  await purgeCloudflareCache(urlsToPurge);
1659
1666
  }
1667
+ sendEvent({ type: "cleanup", message: "Cleaning up empty folders..." });
1668
+ async function cleanEmptyFolders(dir) {
1669
+ try {
1670
+ const entries = await fs7.readdir(dir, { withFileTypes: true });
1671
+ let isEmpty = true;
1672
+ for (const entry of entries) {
1673
+ if (entry.isDirectory()) {
1674
+ const subDirEmpty = await cleanEmptyFolders(path7.join(dir, entry.name));
1675
+ if (!subDirEmpty) isEmpty = false;
1676
+ } else if (!isHiddenOrSystemFile3(entry.name)) {
1677
+ isEmpty = false;
1678
+ }
1679
+ }
1680
+ if (isEmpty) {
1681
+ for (const entry of entries) {
1682
+ if (!entry.isDirectory() && isHiddenOrSystemFile3(entry.name)) {
1683
+ try {
1684
+ await fs7.unlink(path7.join(dir, entry.name));
1685
+ } catch {
1686
+ }
1687
+ }
1688
+ }
1689
+ await fs7.rmdir(dir);
1690
+ }
1691
+ return isEmpty;
1692
+ } catch {
1693
+ return true;
1694
+ }
1695
+ }
1696
+ const imagesDir = getPublicPath("images");
1697
+ try {
1698
+ await cleanEmptyFolders(imagesDir);
1699
+ } catch {
1700
+ }
1660
1701
  let message = `Removed thumbnails from ${removed.length} image${removed.length !== 1 ? "s" : ""}.`;
1661
1702
  if (skipped.length > 0) {
1662
1703
  message += ` ${skipped.length} image${skipped.length !== 1 ? "s" : ""} had no thumbnails.`;