@shipstatic/drop 0.1.4 → 0.1.5

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.cjs CHANGED
@@ -11737,7 +11737,6 @@ async function extractZipToFiles(zipFile) {
11737
11737
  errors.push(`Skipped invalid path: ${path}`);
11738
11738
  continue;
11739
11739
  }
11740
- if (isJunkFile(sanitizedPath)) continue;
11741
11740
  try {
11742
11741
  const content = await entry.async("blob");
11743
11742
  const mimeType = getMimeType(sanitizedPath);
@@ -11775,11 +11774,6 @@ function normalizePath(path) {
11775
11774
  }
11776
11775
  return normalized.join("/");
11777
11776
  }
11778
- function isJunkFile(path) {
11779
- const basename = (path.split("/").pop() || "").toLowerCase();
11780
- const junkFiles = [".ds_store", "thumbs.db", "desktop.ini", "._.ds_store"];
11781
- return path.toLowerCase().startsWith("__macosx/") || junkFiles.includes(basename);
11782
- }
11783
11777
  function isZipFile(file) {
11784
11778
  return file.type === "application/zip" || file.type === "application/x-zip-compressed" || file.name.toLowerCase().endsWith(".zip");
11785
11779
  }
@@ -11893,9 +11887,16 @@ function useDrop(options) {
11893
11887
  } else {
11894
11888
  allFiles.push(...newFiles);
11895
11889
  }
11890
+ const getFilePath = (f) => {
11891
+ const webkitPath = f.webkitRelativePath;
11892
+ return webkitPath && webkitPath.trim() ? webkitPath : f.name;
11893
+ };
11894
+ const filePaths = allFiles.map(getFilePath);
11895
+ const validPaths = new Set(ship.filterJunk(filePaths));
11896
+ const cleanFiles = allFiles.filter((f) => validPaths.has(getFilePath(f)));
11896
11897
  setStatusText("Processing files...");
11897
11898
  const processedFiles = await Promise.all(
11898
- allFiles.map((file) => createProcessedFile(file))
11899
+ cleanFiles.map((file) => createProcessedFile(file))
11899
11900
  );
11900
11901
  const finalFiles = stripPrefix ? stripCommonPrefix(processedFiles) : processedFiles;
11901
11902
  const config = await ship$1.getConfig();
@@ -11989,7 +11990,6 @@ exports.createProcessedFile = createProcessedFile;
11989
11990
  exports.extractZipToFiles = extractZipToFiles;
11990
11991
  exports.formatFileSize = formatFileSize;
11991
11992
  exports.getValidFiles = getValidFiles;
11992
- exports.isJunkFile = isJunkFile;
11993
11993
  exports.isZipFile = isZipFile;
11994
11994
  exports.normalizePath = normalizePath;
11995
11995
  exports.stripCommonPrefix = stripCommonPrefix;