@shipstatic/drop 0.1.4 → 0.1.5
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 +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -18
- package/dist/index.d.ts +1 -18
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -152,26 +152,9 @@ declare function extractZipToFiles(zipFile: File): Promise<ZipExtractionResult>;
|
|
|
152
152
|
* normalizePath('/absolute/path.txt') → 'absolute/path.txt'
|
|
153
153
|
*/
|
|
154
154
|
declare function normalizePath(path: string): string;
|
|
155
|
-
/**
|
|
156
|
-
* Check if a file path is a junk file that should be filtered out
|
|
157
|
-
* Filters common system files like .DS_Store, Thumbs.db, desktop.ini,
|
|
158
|
-
* and macOS resource fork metadata in __MACOSX directories
|
|
159
|
-
*
|
|
160
|
-
* Case-insensitive matching to handle files from different operating systems
|
|
161
|
-
* (Windows file systems are case-insensitive, so Thumbs.db === THUMBS.DB)
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* isJunkFile('.DS_Store') → true
|
|
165
|
-
* isJunkFile('.ds_store') → true (case-insensitive)
|
|
166
|
-
* isJunkFile('THUMBS.DB') → true (case-insensitive)
|
|
167
|
-
* isJunkFile('folder/.DS_Store') → true
|
|
168
|
-
* isJunkFile('__MACOSX/file.txt') → true
|
|
169
|
-
* isJunkFile('mydsstore.txt') → false
|
|
170
|
-
*/
|
|
171
|
-
declare function isJunkFile(path: string): boolean;
|
|
172
155
|
/**
|
|
173
156
|
* Check if a file is a ZIP file based on MIME type or extension
|
|
174
157
|
*/
|
|
175
158
|
declare function isZipFile(file: File): boolean;
|
|
176
159
|
|
|
177
|
-
export { type ClientError, type DropOptions, type DropReturn, FILE_STATUSES, type FileStatus, type ProcessedFile, type ZipExtractionResult, createProcessedFile, extractZipToFiles, formatFileSize, getValidFiles,
|
|
160
|
+
export { type ClientError, type DropOptions, type DropReturn, FILE_STATUSES, type FileStatus, type ProcessedFile, type ZipExtractionResult, createProcessedFile, extractZipToFiles, formatFileSize, getValidFiles, isZipFile, normalizePath, stripCommonPrefix, useDrop };
|
package/dist/index.d.ts
CHANGED
|
@@ -152,26 +152,9 @@ declare function extractZipToFiles(zipFile: File): Promise<ZipExtractionResult>;
|
|
|
152
152
|
* normalizePath('/absolute/path.txt') → 'absolute/path.txt'
|
|
153
153
|
*/
|
|
154
154
|
declare function normalizePath(path: string): string;
|
|
155
|
-
/**
|
|
156
|
-
* Check if a file path is a junk file that should be filtered out
|
|
157
|
-
* Filters common system files like .DS_Store, Thumbs.db, desktop.ini,
|
|
158
|
-
* and macOS resource fork metadata in __MACOSX directories
|
|
159
|
-
*
|
|
160
|
-
* Case-insensitive matching to handle files from different operating systems
|
|
161
|
-
* (Windows file systems are case-insensitive, so Thumbs.db === THUMBS.DB)
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* isJunkFile('.DS_Store') → true
|
|
165
|
-
* isJunkFile('.ds_store') → true (case-insensitive)
|
|
166
|
-
* isJunkFile('THUMBS.DB') → true (case-insensitive)
|
|
167
|
-
* isJunkFile('folder/.DS_Store') → true
|
|
168
|
-
* isJunkFile('__MACOSX/file.txt') → true
|
|
169
|
-
* isJunkFile('mydsstore.txt') → false
|
|
170
|
-
*/
|
|
171
|
-
declare function isJunkFile(path: string): boolean;
|
|
172
155
|
/**
|
|
173
156
|
* Check if a file is a ZIP file based on MIME type or extension
|
|
174
157
|
*/
|
|
175
158
|
declare function isZipFile(file: File): boolean;
|
|
176
159
|
|
|
177
|
-
export { type ClientError, type DropOptions, type DropReturn, FILE_STATUSES, type FileStatus, type ProcessedFile, type ZipExtractionResult, createProcessedFile, extractZipToFiles, formatFileSize, getValidFiles,
|
|
160
|
+
export { type ClientError, type DropOptions, type DropReturn, FILE_STATUSES, type FileStatus, type ProcessedFile, type ZipExtractionResult, createProcessedFile, extractZipToFiles, formatFileSize, getValidFiles, isZipFile, normalizePath, stripCommonPrefix, useDrop };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useRef, useCallback } from 'react';
|
|
2
|
-
import { formatFileSize as formatFileSize$1, getValidFiles as getValidFiles$1, validateFiles } from '@shipstatic/ship';
|
|
2
|
+
import { formatFileSize as formatFileSize$1, getValidFiles as getValidFiles$1, filterJunk, validateFiles } from '@shipstatic/ship';
|
|
3
3
|
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -11735,7 +11735,6 @@ async function extractZipToFiles(zipFile) {
|
|
|
11735
11735
|
errors.push(`Skipped invalid path: ${path}`);
|
|
11736
11736
|
continue;
|
|
11737
11737
|
}
|
|
11738
|
-
if (isJunkFile(sanitizedPath)) continue;
|
|
11739
11738
|
try {
|
|
11740
11739
|
const content = await entry.async("blob");
|
|
11741
11740
|
const mimeType = getMimeType(sanitizedPath);
|
|
@@ -11773,11 +11772,6 @@ function normalizePath(path) {
|
|
|
11773
11772
|
}
|
|
11774
11773
|
return normalized.join("/");
|
|
11775
11774
|
}
|
|
11776
|
-
function isJunkFile(path) {
|
|
11777
|
-
const basename = (path.split("/").pop() || "").toLowerCase();
|
|
11778
|
-
const junkFiles = [".ds_store", "thumbs.db", "desktop.ini", "._.ds_store"];
|
|
11779
|
-
return path.toLowerCase().startsWith("__macosx/") || junkFiles.includes(basename);
|
|
11780
|
-
}
|
|
11781
11775
|
function isZipFile(file) {
|
|
11782
11776
|
return file.type === "application/zip" || file.type === "application/x-zip-compressed" || file.name.toLowerCase().endsWith(".zip");
|
|
11783
11777
|
}
|
|
@@ -11891,9 +11885,16 @@ function useDrop(options) {
|
|
|
11891
11885
|
} else {
|
|
11892
11886
|
allFiles.push(...newFiles);
|
|
11893
11887
|
}
|
|
11888
|
+
const getFilePath = (f) => {
|
|
11889
|
+
const webkitPath = f.webkitRelativePath;
|
|
11890
|
+
return webkitPath && webkitPath.trim() ? webkitPath : f.name;
|
|
11891
|
+
};
|
|
11892
|
+
const filePaths = allFiles.map(getFilePath);
|
|
11893
|
+
const validPaths = new Set(filterJunk(filePaths));
|
|
11894
|
+
const cleanFiles = allFiles.filter((f) => validPaths.has(getFilePath(f)));
|
|
11894
11895
|
setStatusText("Processing files...");
|
|
11895
11896
|
const processedFiles = await Promise.all(
|
|
11896
|
-
|
|
11897
|
+
cleanFiles.map((file) => createProcessedFile(file))
|
|
11897
11898
|
);
|
|
11898
11899
|
const finalFiles = stripPrefix ? stripCommonPrefix(processedFiles) : processedFiles;
|
|
11899
11900
|
const config = await ship.getConfig();
|
|
@@ -11982,6 +11983,6 @@ mime-db/index.js:
|
|
|
11982
11983
|
*)
|
|
11983
11984
|
*/
|
|
11984
11985
|
|
|
11985
|
-
export { FILE_STATUSES, createProcessedFile, extractZipToFiles, formatFileSize, getValidFiles,
|
|
11986
|
+
export { FILE_STATUSES, createProcessedFile, extractZipToFiles, formatFileSize, getValidFiles, isZipFile, normalizePath, stripCommonPrefix, useDrop };
|
|
11986
11987
|
//# sourceMappingURL=index.js.map
|
|
11987
11988
|
//# sourceMappingURL=index.js.map
|