@shipstatic/drop 0.3.1 → 0.3.2
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 +32 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10063,7 +10063,7 @@ function useDrop(options) {
|
|
|
10063
10063
|
const isDragging = state.value === "dragging";
|
|
10064
10064
|
const isInteractive = state.value === "idle" || state.value === "dragging" || state.value === "ready";
|
|
10065
10065
|
const hasError = state.value === "error";
|
|
10066
|
-
const validFiles = react.useMemo(() => state.files.filter((f) => f.status ===
|
|
10066
|
+
const validFiles = react.useMemo(() => state.files.filter((f) => f.status === FILE_STATUSES.READY), [state.files]);
|
|
10067
10067
|
const getFilesForUpload = react.useCallback(() => {
|
|
10068
10068
|
return validFiles.map((f) => f.file);
|
|
10069
10069
|
}, [validFiles]);
|
|
@@ -10134,8 +10134,37 @@ function useDrop(options) {
|
|
|
10134
10134
|
}));
|
|
10135
10135
|
const processedFiles = cleanFiles.map((file) => createProcessedFile(file));
|
|
10136
10136
|
const finalFiles = stripPrefix ? stripCommonPrefix(processedFiles) : processedFiles;
|
|
10137
|
+
if (finalFiles.length > 0) {
|
|
10138
|
+
const hasIndexHtml = needsBuild ? finalFiles.some((f) => f.path === "index.html" || f.path.endsWith("/index.html")) : finalFiles.some((f) => f.path === "index.html");
|
|
10139
|
+
if (!hasIndexHtml) {
|
|
10140
|
+
const message = needsBuild ? "No index.html found \u2014 every web project needs an index.html entry point" : "No index.html at root \u2014 the entry point must be in the top-level directory";
|
|
10141
|
+
const filesWithStatus2 = finalFiles.map((f) => ({
|
|
10142
|
+
...f,
|
|
10143
|
+
status: FILE_STATUSES.VALIDATION_FAILED,
|
|
10144
|
+
statusMessage: message
|
|
10145
|
+
}));
|
|
10146
|
+
setState({
|
|
10147
|
+
value: "error",
|
|
10148
|
+
files: filesWithStatus2,
|
|
10149
|
+
sourceName: detectedSourceName,
|
|
10150
|
+
needsBuild,
|
|
10151
|
+
status: {
|
|
10152
|
+
title: "Validation Failed",
|
|
10153
|
+
details: message,
|
|
10154
|
+
errors: [message]
|
|
10155
|
+
}
|
|
10156
|
+
});
|
|
10157
|
+
onValidationError?.({
|
|
10158
|
+
error: "Validation Failed",
|
|
10159
|
+
details: message,
|
|
10160
|
+
errors: [message],
|
|
10161
|
+
isClientError: true
|
|
10162
|
+
});
|
|
10163
|
+
return;
|
|
10164
|
+
}
|
|
10165
|
+
}
|
|
10137
10166
|
if (needsBuild) {
|
|
10138
|
-
const filesWithStatus2 = finalFiles.map((f) => ({ ...f, status:
|
|
10167
|
+
const filesWithStatus2 = finalFiles.map((f) => ({ ...f, status: FILE_STATUSES.READY }));
|
|
10139
10168
|
setState({
|
|
10140
10169
|
value: "ready",
|
|
10141
10170
|
files: filesWithStatus2,
|
|
@@ -10196,7 +10225,7 @@ function useDrop(options) {
|
|
|
10196
10225
|
}
|
|
10197
10226
|
});
|
|
10198
10227
|
onFilesReady?.(filesWithStatus.filter(
|
|
10199
|
-
(f, idx) => validation.files[idx]?.status ===
|
|
10228
|
+
(f, idx) => validation.files[idx]?.status === FILE_STATUSES.READY
|
|
10200
10229
|
));
|
|
10201
10230
|
} else {
|
|
10202
10231
|
const hasOnlyWarnings = validation.errors.length === 0 && validation.warnings.length > 0;
|