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