@shipstatic/drop 0.2.15 → 0.2.17

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 CHANGED
@@ -11702,7 +11702,7 @@ var require_mime_db = __commonJS({
11702
11702
  }
11703
11703
  });
11704
11704
 
11705
- // node_modules/.pnpm/@shipstatic+types@0.4.23/node_modules/@shipstatic/types/dist/index.js
11705
+ // node_modules/.pnpm/@shipstatic+types@0.4.25/node_modules/@shipstatic/types/dist/index.js
11706
11706
  var ErrorType;
11707
11707
  (function(ErrorType2) {
11708
11708
  ErrorType2["Validation"] = "validation_failed";
@@ -11722,10 +11722,15 @@ var ErrorType;
11722
11722
  auth: /* @__PURE__ */ new Set([ErrorType.Authentication])
11723
11723
  });
11724
11724
  var FileValidationStatus = {
11725
+ /** File is pending validation */
11725
11726
  PENDING: "pending",
11727
+ /** File failed during processing (before validation) */
11726
11728
  PROCESSING_ERROR: "processing_error",
11727
- EMPTY_FILE: "empty_file",
11729
+ /** File was excluded by validation warning (not an error) */
11730
+ EXCLUDED: "excluded",
11731
+ /** File failed validation (blocks deployment) */
11728
11732
  VALIDATION_FAILED: "validation_failed",
11733
+ /** File passed validation and is ready for deployment */
11729
11734
  READY: "ready"
11730
11735
  };
11731
11736
 
@@ -11756,7 +11761,7 @@ for (const type in import_mime_db.default) {
11756
11761
  }
11757
11762
  function getMimeType(path) {
11758
11763
  const extension = path.includes(".") ? path.substring(path.lastIndexOf(".") + 1).toLowerCase() : "";
11759
- return extensionToMimeMap[extension] || "application/octet-stream";
11764
+ return extensionToMimeMap[extension] || "";
11760
11765
  }
11761
11766
 
11762
11767
  // src/utils/zipExtractor.ts
@@ -12019,40 +12024,72 @@ function useDrop(options) {
12019
12024
  status: validation.files[idx]?.status || processedFile.status,
12020
12025
  statusMessage: validation.files[idx]?.statusMessage || processedFile.statusMessage
12021
12026
  }));
12022
- if (validation.error) {
12027
+ if (!validation.canDeploy) {
12028
+ const errorMessages = validation.errors.map(
12029
+ (err) => `${err.file}: ${err.message}`
12030
+ );
12023
12031
  setState({
12024
12032
  value: "error",
12025
12033
  files: filesWithStatus,
12026
12034
  sourceName: detectedSourceName,
12027
12035
  status: {
12028
- title: validation.error.error,
12029
- details: validation.error.details,
12030
- errors: validation.error.errors
12036
+ title: "Validation Failed",
12037
+ details: `${validation.errors.length} file(s) failed validation`,
12038
+ errors: errorMessages
12031
12039
  }
12032
12040
  });
12033
- onValidationError?.(validation.error);
12041
+ onValidationError?.({
12042
+ error: "Validation Failed",
12043
+ details: `${validation.errors.length} error(s)`,
12044
+ errors: errorMessages,
12045
+ isClientError: true
12046
+ });
12034
12047
  } else if (validation.validFiles.length > 0) {
12048
+ let details = `${validation.validFiles.length} file(s) ready`;
12049
+ if (validation.warnings.length > 0) {
12050
+ details += ` (${validation.warnings.length} empty file(s) excluded)`;
12051
+ }
12035
12052
  setState({
12036
12053
  value: "ready",
12037
12054
  files: filesWithStatus,
12038
12055
  sourceName: detectedSourceName,
12039
- status: { title: "Ready", details: `${validation.validFiles.length} file(s) are ready.` }
12056
+ status: {
12057
+ title: "Ready",
12058
+ details,
12059
+ warnings: validation.warnings.length > 0 ? validation.warnings.map((w) => `${w.file}: ${w.message}`) : void 0
12060
+ }
12040
12061
  });
12041
- onFilesReady?.(filesWithStatus.filter((f, idx) => validation.files[idx]?.status === "ready"));
12062
+ onFilesReady?.(filesWithStatus.filter(
12063
+ (f, idx) => validation.files[idx]?.status === "ready"
12064
+ ));
12042
12065
  } else {
12043
- const noValidError = {
12044
- error: "No Valid Files",
12045
- details: "None of the provided files could be processed.",
12046
- errors: [],
12047
- isClientError: true
12048
- };
12049
- setState({
12050
- value: "error",
12051
- files: filesWithStatus,
12052
- sourceName: detectedSourceName,
12053
- status: { title: noValidError.error, details: noValidError.details }
12054
- });
12055
- onValidationError?.(noValidError);
12066
+ const hasOnlyWarnings = validation.errors.length === 0 && validation.warnings.length > 0;
12067
+ if (hasOnlyWarnings) {
12068
+ setState({
12069
+ value: "ready",
12070
+ files: filesWithStatus,
12071
+ sourceName: detectedSourceName,
12072
+ status: {
12073
+ title: "All files excluded",
12074
+ details: `${validation.warnings.length} file(s) excluded (empty files cannot be deployed)`,
12075
+ warnings: validation.warnings.map((w) => `${w.file}: ${w.message}`)
12076
+ }
12077
+ });
12078
+ } else {
12079
+ const noValidError = {
12080
+ error: "No Valid Files",
12081
+ details: "None of the provided files could be processed.",
12082
+ errors: [],
12083
+ isClientError: true
12084
+ };
12085
+ setState({
12086
+ value: "error",
12087
+ files: filesWithStatus,
12088
+ sourceName: detectedSourceName,
12089
+ status: { title: noValidError.error, details: noValidError.details }
12090
+ });
12091
+ onValidationError?.(noValidError);
12092
+ }
12056
12093
  }
12057
12094
  } catch (error) {
12058
12095
  const processingError = {
@@ -12094,7 +12131,6 @@ function useDrop(options) {
12094
12131
  const errorStatuses = [
12095
12132
  FILE_STATUSES.VALIDATION_FAILED,
12096
12133
  FILE_STATUSES.PROCESSING_ERROR,
12097
- FILE_STATUSES.EMPTY_FILE,
12098
12134
  FILE_STATUSES.ERROR
12099
12135
  ];
12100
12136
  const hasErrors = prev.files.some((f) => errorStatuses.includes(f.status));