@shipstatic/drop 0.3.0 → 0.3.1
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 +46 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +46 -5
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +3 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +3 -1
- package/dist/testing.js.map +1 -1
- package/dist/{useDrop-CEMSBb-M.d.cts → useDrop-q3T3LVH0.d.cts} +3 -0
- package/dist/{useDrop-CEMSBb-M.d.ts → useDrop-q3T3LVH0.d.ts} +3 -0
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -9384,7 +9384,7 @@ var require_mime_db = __commonJS({
|
|
|
9384
9384
|
}
|
|
9385
9385
|
});
|
|
9386
9386
|
|
|
9387
|
-
// node_modules/.pnpm/@shipstatic+types@0.7.
|
|
9387
|
+
// node_modules/.pnpm/@shipstatic+types@0.7.7/node_modules/@shipstatic/types/dist/index.js
|
|
9388
9388
|
var ErrorType;
|
|
9389
9389
|
(function(ErrorType2) {
|
|
9390
9390
|
ErrorType2["Validation"] = "validation_failed";
|
|
@@ -9406,6 +9406,14 @@ var ErrorType;
|
|
|
9406
9406
|
function isShipError(error) {
|
|
9407
9407
|
return error !== null && typeof error === "object" && "name" in error && error.name === "ShipError" && "status" in error;
|
|
9408
9408
|
}
|
|
9409
|
+
var UNBUILT_PROJECT_MARKERS = /* @__PURE__ */ new Set([
|
|
9410
|
+
"node_modules",
|
|
9411
|
+
"package.json"
|
|
9412
|
+
]);
|
|
9413
|
+
function hasUnbuiltMarker(filePath) {
|
|
9414
|
+
const segments = filePath.replace(/\\/g, "/").split("/").filter(Boolean);
|
|
9415
|
+
return segments.some((s) => UNBUILT_PROJECT_MARKERS.has(s));
|
|
9416
|
+
}
|
|
9409
9417
|
var FileValidationStatus = {
|
|
9410
9418
|
/** File is pending validation */
|
|
9411
9419
|
PENDING: "pending",
|
|
@@ -10023,6 +10031,9 @@ async function traverseFileTree(entry, files, currentPath = "") {
|
|
|
10023
10031
|
};
|
|
10024
10032
|
await readEntriesBatch();
|
|
10025
10033
|
for (const childEntry of allEntries) {
|
|
10034
|
+
if (childEntry.isDirectory && childEntry.name === "node_modules") {
|
|
10035
|
+
continue;
|
|
10036
|
+
}
|
|
10026
10037
|
const entryPath = childEntry.isDirectory ? currentPath ? `${currentPath}/${childEntry.name}` : childEntry.name : currentPath;
|
|
10027
10038
|
await traverseFileTree(childEntry, files, entryPath);
|
|
10028
10039
|
}
|
|
@@ -10035,7 +10046,8 @@ var initialState = {
|
|
|
10035
10046
|
value: "idle",
|
|
10036
10047
|
files: [],
|
|
10037
10048
|
sourceName: "",
|
|
10038
|
-
status: null
|
|
10049
|
+
status: null,
|
|
10050
|
+
needsBuild: false
|
|
10039
10051
|
};
|
|
10040
10052
|
function useDrop(options) {
|
|
10041
10053
|
const {
|
|
@@ -10068,7 +10080,8 @@ function useDrop(options) {
|
|
|
10068
10080
|
value: "processing",
|
|
10069
10081
|
files: [],
|
|
10070
10082
|
sourceName: "",
|
|
10071
|
-
status: { title: "Processing...", details: "Validating and preparing files." }
|
|
10083
|
+
status: { title: "Processing...", details: "Validating and preparing files." },
|
|
10084
|
+
needsBuild: false
|
|
10072
10085
|
});
|
|
10073
10086
|
let detectedSourceName = "";
|
|
10074
10087
|
try {
|
|
@@ -10102,8 +10115,18 @@ function useDrop(options) {
|
|
|
10102
10115
|
const webkitPath = f.webkitRelativePath;
|
|
10103
10116
|
return webkitPath && webkitPath.trim() ? webkitPath : f.name;
|
|
10104
10117
|
};
|
|
10105
|
-
|
|
10106
|
-
const
|
|
10118
|
+
let filePaths = allFiles.map(getFilePath);
|
|
10119
|
+
const needsBuild = filePaths.some((p) => hasUnbuiltMarker(p));
|
|
10120
|
+
if (needsBuild) {
|
|
10121
|
+
const filtered = allFiles.filter((f) => {
|
|
10122
|
+
const segments = getFilePath(f).replace(/\\/g, "/").split("/");
|
|
10123
|
+
return !segments.includes("node_modules");
|
|
10124
|
+
});
|
|
10125
|
+
allFiles.length = 0;
|
|
10126
|
+
allFiles.push(...filtered);
|
|
10127
|
+
filePaths = allFiles.map(getFilePath);
|
|
10128
|
+
}
|
|
10129
|
+
const validPaths = new Set(ship.filterJunk(filePaths, { allowUnbuilt: needsBuild }));
|
|
10107
10130
|
const cleanFiles = allFiles.filter((f) => validPaths.has(getFilePath(f)));
|
|
10108
10131
|
setState((prev) => ({
|
|
10109
10132
|
...prev,
|
|
@@ -10111,6 +10134,18 @@ function useDrop(options) {
|
|
|
10111
10134
|
}));
|
|
10112
10135
|
const processedFiles = cleanFiles.map((file) => createProcessedFile(file));
|
|
10113
10136
|
const finalFiles = stripPrefix ? stripCommonPrefix(processedFiles) : processedFiles;
|
|
10137
|
+
if (needsBuild) {
|
|
10138
|
+
const filesWithStatus2 = finalFiles.map((f) => ({ ...f, status: "ready" }));
|
|
10139
|
+
setState({
|
|
10140
|
+
value: "ready",
|
|
10141
|
+
files: filesWithStatus2,
|
|
10142
|
+
sourceName: detectedSourceName,
|
|
10143
|
+
needsBuild: true,
|
|
10144
|
+
status: { title: "Ready", details: `${filesWithStatus2.length} file(s) ready \u2014 project will be built` }
|
|
10145
|
+
});
|
|
10146
|
+
onFilesReady?.(filesWithStatus2);
|
|
10147
|
+
return;
|
|
10148
|
+
}
|
|
10114
10149
|
const validatableFiles = finalFiles.map((f) => ({
|
|
10115
10150
|
name: f.path,
|
|
10116
10151
|
// Use full path to match server-side validation
|
|
@@ -10131,6 +10166,7 @@ function useDrop(options) {
|
|
|
10131
10166
|
value: "error",
|
|
10132
10167
|
files: filesWithStatus,
|
|
10133
10168
|
sourceName: detectedSourceName,
|
|
10169
|
+
needsBuild: false,
|
|
10134
10170
|
status: {
|
|
10135
10171
|
title: "Validation Failed",
|
|
10136
10172
|
details: `${validation.errors.length} file(s) failed validation`,
|
|
@@ -10152,6 +10188,7 @@ function useDrop(options) {
|
|
|
10152
10188
|
value: "ready",
|
|
10153
10189
|
files: filesWithStatus,
|
|
10154
10190
|
sourceName: detectedSourceName,
|
|
10191
|
+
needsBuild: false,
|
|
10155
10192
|
status: {
|
|
10156
10193
|
title: "Ready",
|
|
10157
10194
|
details,
|
|
@@ -10168,6 +10205,7 @@ function useDrop(options) {
|
|
|
10168
10205
|
value: "ready",
|
|
10169
10206
|
files: filesWithStatus,
|
|
10170
10207
|
sourceName: detectedSourceName,
|
|
10208
|
+
needsBuild: false,
|
|
10171
10209
|
status: {
|
|
10172
10210
|
title: "All files excluded",
|
|
10173
10211
|
details: `${validation.warnings.length} file(s) excluded (empty files cannot be deployed)`,
|
|
@@ -10185,6 +10223,7 @@ function useDrop(options) {
|
|
|
10185
10223
|
value: "error",
|
|
10186
10224
|
files: filesWithStatus,
|
|
10187
10225
|
sourceName: detectedSourceName,
|
|
10226
|
+
needsBuild: false,
|
|
10188
10227
|
status: { title: noValidError.error, details: noValidError.details }
|
|
10189
10228
|
});
|
|
10190
10229
|
onValidationError?.(noValidError);
|
|
@@ -10203,6 +10242,7 @@ function useDrop(options) {
|
|
|
10203
10242
|
value: "error",
|
|
10204
10243
|
files: [],
|
|
10205
10244
|
sourceName: detectedSourceName,
|
|
10245
|
+
needsBuild: false,
|
|
10206
10246
|
status: {
|
|
10207
10247
|
title: clientError.error,
|
|
10208
10248
|
details: clientError.details,
|
|
@@ -10326,6 +10366,7 @@ function useDrop(options) {
|
|
|
10326
10366
|
files: state.files,
|
|
10327
10367
|
sourceName: state.sourceName,
|
|
10328
10368
|
status: state.status,
|
|
10369
|
+
needsBuild: state.needsBuild,
|
|
10329
10370
|
// Primary API: Prop getters
|
|
10330
10371
|
getDropzoneProps,
|
|
10331
10372
|
getInputProps,
|