@shipstatic/drop 2.13.0-beta.5 → 2.13.0
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/README.md +1 -1
- package/dist/index.cjs +18 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1090,6 +1090,7 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
1092
|
// src/entries.ts
|
|
1093
|
+
var UNREADABLE_DROP = "We couldn't read everything you dropped. Make sure the files are on this computer, then try again.";
|
|
1093
1094
|
function unreadable(path) {
|
|
1094
1095
|
return `We couldn't read ${path}. Make sure it's on this computer, then try again.`;
|
|
1095
1096
|
}
|
|
@@ -1242,27 +1243,29 @@ function useDrop({ ship }) {
|
|
|
1242
1243
|
setState((prev) => prev.isDragging ? { ...prev, isDragging: false } : prev);
|
|
1243
1244
|
const files = [];
|
|
1244
1245
|
const directories = [];
|
|
1246
|
+
let unreadable2 = false;
|
|
1245
1247
|
for (const item of Array.from(e.dataTransfer.items)) {
|
|
1246
1248
|
if (item.kind !== "file") continue;
|
|
1249
|
+
let entry;
|
|
1247
1250
|
try {
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
if (file) files.push(file);
|
|
1251
|
+
entry = item.webkitGetAsEntry?.();
|
|
1252
|
+
} catch {
|
|
1253
|
+
}
|
|
1254
|
+
if (entry?.isDirectory) {
|
|
1255
|
+
directories.push({ entry, path: entry.name });
|
|
1256
|
+
continue;
|
|
1257
|
+
}
|
|
1258
|
+
const file = item.getAsFile();
|
|
1259
|
+
if (file) {
|
|
1260
|
+
setRelativePath(file, file.name);
|
|
1261
|
+
files.push(file);
|
|
1262
|
+
} else {
|
|
1263
|
+
unreadable2 = true;
|
|
1262
1264
|
}
|
|
1263
1265
|
}
|
|
1264
|
-
if (directories.length === 0 && files.length === 0) return;
|
|
1266
|
+
if (directories.length === 0 && files.length === 0 && !unreadable2) return;
|
|
1265
1267
|
await prepare(async () => {
|
|
1268
|
+
if (unreadable2) throw new Error(UNREADABLE_DROP);
|
|
1266
1269
|
await Promise.all(directories.map((d) => traverseFileTree(d.entry, files, d.path)));
|
|
1267
1270
|
return files;
|
|
1268
1271
|
});
|