@shipstatic/drop 2.10.4-beta.7 → 2.10.4-beta.9
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 +33 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1119,13 +1119,12 @@ function useDrop({ ship }) {
|
|
|
1119
1119
|
[state.files]
|
|
1120
1120
|
);
|
|
1121
1121
|
const getFilesForUpload = useCallback(() => validFiles.map((f) => f.file), [validFiles]);
|
|
1122
|
-
const
|
|
1123
|
-
async (
|
|
1122
|
+
const prepare = useCallback(
|
|
1123
|
+
async (collect) => {
|
|
1124
1124
|
if (runRef.current) {
|
|
1125
1125
|
console.warn("File processing already in progress. Ignoring duplicate call.");
|
|
1126
1126
|
return;
|
|
1127
1127
|
}
|
|
1128
|
-
if (!newFiles || newFiles.length === 0) return;
|
|
1129
1128
|
const run = new AbortController();
|
|
1130
1129
|
runRef.current = run;
|
|
1131
1130
|
setState({
|
|
@@ -1134,11 +1133,24 @@ function useDrop({ ship }) {
|
|
|
1134
1133
|
status: { title: "Processing...", details: "Validating and preparing files." }
|
|
1135
1134
|
});
|
|
1136
1135
|
try {
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1136
|
+
const [files, limits] = await Promise.all([
|
|
1137
|
+
collect(),
|
|
1138
|
+
ship.getLimits({ signal: run.signal })
|
|
1139
|
+
]);
|
|
1140
|
+
if (run.signal.aborted) return;
|
|
1141
|
+
if (files.length === 0) {
|
|
1142
|
+
setState({
|
|
1143
|
+
...initialState,
|
|
1144
|
+
phase: "error",
|
|
1145
|
+
status: { title: "Empty Folder", details: "It has no files to deploy." }
|
|
1146
|
+
});
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
const outcome = await processFiles(files, {
|
|
1150
|
+
limits,
|
|
1151
|
+
// The pipeline says its status before its first wait, so a
|
|
1152
|
+
// cancelled run has none left to say.
|
|
1153
|
+
onStatus: (status) => setState((prev) => ({ ...prev, status }))
|
|
1142
1154
|
});
|
|
1143
1155
|
if (run.signal.aborted) return;
|
|
1144
1156
|
setState({
|
|
@@ -1165,6 +1177,13 @@ function useDrop({ ship }) {
|
|
|
1165
1177
|
},
|
|
1166
1178
|
[ship]
|
|
1167
1179
|
);
|
|
1180
|
+
const processFiles2 = useCallback(
|
|
1181
|
+
async (newFiles) => {
|
|
1182
|
+
if (!newFiles || newFiles.length === 0) return;
|
|
1183
|
+
await prepare(async () => newFiles);
|
|
1184
|
+
},
|
|
1185
|
+
[prepare]
|
|
1186
|
+
);
|
|
1168
1187
|
const reset = useCallback(() => {
|
|
1169
1188
|
runRef.current?.abort();
|
|
1170
1189
|
runRef.current = null;
|
|
@@ -1203,13 +1222,13 @@ function useDrop({ ship }) {
|
|
|
1203
1222
|
if (file) files.push(file);
|
|
1204
1223
|
}
|
|
1205
1224
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1225
|
+
if (directories.length === 0 && files.length === 0) return;
|
|
1226
|
+
await prepare(async () => {
|
|
1227
|
+
await Promise.all(directories.map((d) => traverseFileTree(d.entry, files, d.path)));
|
|
1228
|
+
return files;
|
|
1229
|
+
});
|
|
1211
1230
|
},
|
|
1212
|
-
[
|
|
1231
|
+
[prepare]
|
|
1213
1232
|
);
|
|
1214
1233
|
const handleInputChange = useCallback(
|
|
1215
1234
|
(e) => {
|