@shipstatic/drop 0.1.7 → 0.1.8
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 +31 -4
- package/dist/index.cjs +55 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +55 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,9 +35,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
35
|
|
|
36
36
|
// node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js
|
|
37
37
|
var require_jszip_min = __commonJS({
|
|
38
|
-
"node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js"(exports, module) {
|
|
38
|
+
"node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js"(exports$1, module) {
|
|
39
39
|
!(function(e) {
|
|
40
|
-
if ("object" == typeof exports && "undefined" != typeof module) module.exports = e();
|
|
40
|
+
if ("object" == typeof exports$1 && "undefined" != typeof module) module.exports = e();
|
|
41
41
|
else if ("function" == typeof define && define.amd) define([], e);
|
|
42
42
|
else {
|
|
43
43
|
("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e();
|
|
@@ -2347,7 +2347,7 @@ var require_jszip_min = __commonJS({
|
|
|
2347
2347
|
|
|
2348
2348
|
// node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/db.json
|
|
2349
2349
|
var require_db = __commonJS({
|
|
2350
|
-
"node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/db.json"(exports, module) {
|
|
2350
|
+
"node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/db.json"(exports$1, module) {
|
|
2351
2351
|
module.exports = {
|
|
2352
2352
|
"application/1d-interleaved-parityfec": {
|
|
2353
2353
|
source: "iana"
|
|
@@ -11695,7 +11695,7 @@ var require_db = __commonJS({
|
|
|
11695
11695
|
|
|
11696
11696
|
// node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/index.js
|
|
11697
11697
|
var require_mime_db = __commonJS({
|
|
11698
|
-
"node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/index.js"(exports, module) {
|
|
11698
|
+
"node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/index.js"(exports$1, module) {
|
|
11699
11699
|
module.exports = require_db();
|
|
11700
11700
|
}
|
|
11701
11701
|
});
|
|
@@ -11833,35 +11833,39 @@ function stripCommonPrefix(files) {
|
|
|
11833
11833
|
}));
|
|
11834
11834
|
}
|
|
11835
11835
|
async function traverseFileTree(entry, files, currentPath = "") {
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
const
|
|
11851
|
-
|
|
11852
|
-
|
|
11836
|
+
try {
|
|
11837
|
+
if (entry.isFile) {
|
|
11838
|
+
const file = await new Promise((resolve, reject) => {
|
|
11839
|
+
entry.file(resolve, reject);
|
|
11840
|
+
});
|
|
11841
|
+
const relativePath = currentPath ? `${currentPath}/${file.name}` : file.name;
|
|
11842
|
+
Object.defineProperty(file, "webkitRelativePath", {
|
|
11843
|
+
value: relativePath,
|
|
11844
|
+
writable: false
|
|
11845
|
+
});
|
|
11846
|
+
files.push(file);
|
|
11847
|
+
} else if (entry.isDirectory) {
|
|
11848
|
+
const dirReader = entry.createReader();
|
|
11849
|
+
let allEntries = [];
|
|
11850
|
+
const readEntriesBatch = async () => {
|
|
11851
|
+
const batch = await new Promise(
|
|
11852
|
+
(resolve, reject) => {
|
|
11853
|
+
dirReader.readEntries(resolve, reject);
|
|
11854
|
+
}
|
|
11855
|
+
);
|
|
11856
|
+
if (batch.length > 0) {
|
|
11857
|
+
allEntries = allEntries.concat(batch);
|
|
11858
|
+
await readEntriesBatch();
|
|
11853
11859
|
}
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11860
|
+
};
|
|
11861
|
+
await readEntriesBatch();
|
|
11862
|
+
for (const childEntry of allEntries) {
|
|
11863
|
+
const entryPath = childEntry.isDirectory ? currentPath ? `${currentPath}/${childEntry.name}` : childEntry.name : currentPath;
|
|
11864
|
+
await traverseFileTree(childEntry, files, entryPath);
|
|
11858
11865
|
}
|
|
11859
|
-
};
|
|
11860
|
-
await readEntriesBatch();
|
|
11861
|
-
for (const childEntry of allEntries) {
|
|
11862
|
-
const entryPath = childEntry.isDirectory ? currentPath ? `${currentPath}/${childEntry.name}` : childEntry.name : currentPath;
|
|
11863
|
-
await traverseFileTree(childEntry, files, entryPath);
|
|
11864
11866
|
}
|
|
11867
|
+
} catch (error) {
|
|
11868
|
+
console.warn(`Error traversing file tree for entry ${entry.name}:`, error);
|
|
11865
11869
|
}
|
|
11866
11870
|
}
|
|
11867
11871
|
function useDrop(options) {
|
|
@@ -12027,14 +12031,27 @@ function useDrop(options) {
|
|
|
12027
12031
|
let hasEntries = false;
|
|
12028
12032
|
for (const item of items) {
|
|
12029
12033
|
if (item.kind === "file") {
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12034
|
+
try {
|
|
12035
|
+
const entry = item.webkitGetAsEntry?.();
|
|
12036
|
+
if (entry) {
|
|
12037
|
+
hasEntries = true;
|
|
12038
|
+
await traverseFileTree(
|
|
12039
|
+
entry,
|
|
12040
|
+
files,
|
|
12041
|
+
entry.isDirectory ? entry.name : ""
|
|
12042
|
+
);
|
|
12043
|
+
} else {
|
|
12044
|
+
const file = item.getAsFile();
|
|
12045
|
+
if (file) {
|
|
12046
|
+
files.push(file);
|
|
12047
|
+
}
|
|
12048
|
+
}
|
|
12049
|
+
} catch (error) {
|
|
12050
|
+
console.warn("Error processing drop item:", error);
|
|
12051
|
+
const file = item.getAsFile();
|
|
12052
|
+
if (file) {
|
|
12053
|
+
files.push(file);
|
|
12054
|
+
}
|
|
12038
12055
|
}
|
|
12039
12056
|
}
|
|
12040
12057
|
}
|