@shipstatic/ship 0.1.4 → 0.1.6
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/browser.js +52 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli.cjs +6 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -24
- package/dist/index.d.ts +10 -24
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser-files-4HSSOKZU.js +0 -2
- package/dist/browser-files-4HSSOKZU.js.map +0 -1
- package/dist/browser-files-YFSJYLHP.browser.js +0 -2
- package/dist/browser-files-YFSJYLHP.browser.js.map +0 -1
- package/dist/chunk-4VJL7GMP.browser.js +0 -2
- package/dist/chunk-4VJL7GMP.browser.js.map +0 -1
- package/dist/chunk-GO2GMAFT.js +0 -2
- package/dist/chunk-GO2GMAFT.js.map +0 -1
- package/dist/chunk-KBFFWP3K.browser.js +0 -2
- package/dist/chunk-KBFFWP3K.browser.js.map +0 -1
- package/dist/chunk-OJ6FY5CZ.js +0 -2
- package/dist/chunk-OJ6FY5CZ.js.map +0 -1
- package/dist/chunk-Z566D7DF.browser.js +0 -2
- package/dist/chunk-Z566D7DF.browser.js.map +0 -1
- package/dist/index.browser.js +0 -20
- package/dist/index.browser.js.map +0 -1
- package/dist/lib-SI4AR47O.browser.js +0 -6
- package/dist/lib-SI4AR47O.browser.js.map +0 -1
- package/dist/path-3OU57R5J.browser.js +0 -2
- package/dist/path-3OU57R5J.browser.js.map +0 -1
- package/dist/path-6I7MXXVI.js +0 -2
- package/dist/path-6I7MXXVI.js.map +0 -1
- package/dist/spark-md5-DLLZAUJQ.browser.js +0 -2
- package/dist/spark-md5-DLLZAUJQ.browser.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/path.ts"],"sourcesContent":["/**\n * @file Path helper utilities that work in both browser and Node.js environments.\n * Provides environment-agnostic path manipulation functions.\n */\n\n/**\n * Finds the common parent directory from an array of paths.\n * This function is the single shared implementation to be used by both browser and Node.js environments.\n * \n * @param paths - Array of paths to analyze for common parent directory.\n * @param separator - Path separator character (e.g., '/' for browser, path.sep for Node.js).\n * @returns The common parent directory path, or an empty string if none is found.\n */\nexport function findCommonParentDirectory(paths: string[], separator: string): string {\n // Validate input\n if (!paths || !Array.isArray(paths) || paths.length === 0) {\n return '';\n }\n \n // Filter out empty paths and paths without separators\n const validPaths = paths.filter(p => p && typeof p === 'string' && p.includes(separator));\n \n if (validPaths.length === 0) {\n return '';\n }\n\n // Special case for single path: return the directory containing this path\n if (validPaths.length === 1) {\n const path = validPaths[0];\n const lastSepIndex = path.lastIndexOf(separator);\n if (lastSepIndex > -1) {\n // Return the directory part without the file name\n return path.substring(0, lastSepIndex);\n }\n return ''; // No directory part found\n }\n\n // Sort paths alphabetically to easily find the common prefix\n const sortedPaths = [...validPaths].sort();\n const firstPath = sortedPaths[0];\n const lastPath = sortedPaths[sortedPaths.length - 1];\n \n // Find the length of the common prefix\n let i = 0;\n while (i < firstPath.length && i < lastPath.length && firstPath[i] === lastPath[i]) {\n i++;\n }\n\n const commonPrefix = firstPath.substring(0, i);\n\n // The prefix must be a directory. If it doesn't end with a separator,\n // find the last separator to get the parent directory.\n if (commonPrefix.endsWith(separator)) {\n // It's a full directory path that matches, so return it without the trailing slash\n return commonPrefix.slice(0, -1);\n }\n\n const lastSepIndex = commonPrefix.lastIndexOf(separator);\n if (lastSepIndex > -1) {\n return commonPrefix.substring(0, lastSepIndex);\n }\n\n return ''; // No common directory\n}\n\n/**\n * Simple helper to find common parent of absolute paths using the system path separator.\n * More declarative wrapper around findCommonParentDirectory for Node.js usage.\n * @param absolutePaths - Array of absolute file paths\n * @returns Common parent directory path or empty string if none found\n */\nexport function findCommonParent(absolutePaths: string[]): string {\n if (typeof require === 'undefined') {\n // Browser environment - use forward slash\n return findCommonParentDirectory(absolutePaths, '/');\n }\n \n // Node.js environment - use system separator\n const path = require('path');\n return findCommonParentDirectory(absolutePaths, path.sep);\n}\n\n\n/**\n * Converts backslashes to forward slashes for cross-platform compatibility.\n * Does not remove leading slashes (preserves absolute paths).\n * @param path - The path to normalize\n * @returns Path with forward slashes\n */\nexport function normalizeSlashes(path: string): string {\n return path.replace(/\\\\/g, '/');\n}\n\n/**\n * Normalizes a path for web usage by converting backslashes to forward slashes\n * and removing leading slashes.\n * @param path - The path to normalize\n * @returns Normalized path suitable for web deployment\n */\nexport function normalizeWebPath(path: string): string {\n return path.replace(/\\\\/g, '/').replace(/^\\/+/, '');\n}\n\n/**\n * Ensures a path is relative by normalizing it and removing any leading slashes.\n * @param path - The path to make relative\n * @returns Relative path suitable for web deployment\n */\nexport function ensureRelativePath(path: string): string {\n return normalizeWebPath(path);\n}\n"],"mappings":"i1BAaO,SAASA,EAA0BC,EAAiBC,EAA2B,CAEpF,GAAI,CAACD,GAAS,CAAC,MAAM,QAAQA,CAAK,GAAKA,EAAM,SAAW,EACtD,MAAO,GAIT,IAAME,EAAaF,EAAM,OAAOG,GAAKA,GAAK,OAAOA,GAAM,UAAYA,EAAE,SAASF,CAAS,CAAC,EAExF,GAAIC,EAAW,SAAW,EACxB,MAAO,GAIT,GAAIA,EAAW,SAAW,EAAG,CAC3B,IAAME,EAAOF,EAAW,CAAC,EACnBG,EAAeD,EAAK,YAAYH,CAAS,EAC/C,OAAII,EAAe,GAEVD,EAAK,UAAU,EAAGC,CAAY,EAEhC,EACT,CAGA,IAAMC,EAAc,CAAC,GAAGJ,CAAU,EAAE,KAAK,EACnCK,EAAYD,EAAY,CAAC,EACzBE,EAAWF,EAAYA,EAAY,OAAS,CAAC,EAG/CG,EAAI,EACR,KAAOA,EAAIF,EAAU,QAAUE,EAAID,EAAS,QAAUD,EAAUE,CAAC,IAAMD,EAASC,CAAC,GAC/EA,IAGF,IAAMC,EAAeH,EAAU,UAAU,EAAGE,CAAC,EAI7C,GAAIC,EAAa,SAAST,CAAS,EAEjC,OAAOS,EAAa,MAAM,EAAG,EAAE,EAGjC,IAAML,EAAeK,EAAa,YAAYT,CAAS,EACvD,OAAII,EAAe,GACVK,EAAa,UAAU,EAAGL,CAAY,EAGxC,EACT,CAQO,SAASM,EAAiBC,EAAiC,CAChE,GAAI,OAAOC,EAAY,IAErB,OAAOd,EAA0Ba,EAAe,GAAG,EAIrD,IAAMR,EAAO,EAAQ,MAAM,EAC3B,OAAOL,EAA0Ba,EAAeR,EAAK,GAAG,CAC1D,CASO,SAASU,EAAiBV,EAAsB,CACrD,OAAOA,EAAK,QAAQ,MAAO,GAAG,CAChC,CAQO,SAASW,EAAiBX,EAAsB,CACrD,OAAOA,EAAK,QAAQ,MAAO,GAAG,EAAE,QAAQ,OAAQ,EAAE,CACpD,CAOO,SAASY,EAAmBZ,EAAsB,CACvD,OAAOW,EAAiBX,CAAI,CAC9B","names":["findCommonParentDirectory","paths","separator","validPaths","p","path","lastSepIndex","sortedPaths","firstPath","lastPath","i","commonPrefix","findCommonParent","absolutePaths","__require","normalizeSlashes","normalizeWebPath","ensureRelativePath"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as g}from"./chunk-KBFFWP3K.browser.js";function a(n,t){if(!n||!Array.isArray(n)||n.length===0)return"";let i=n.filter(e=>e&&typeof e=="string"&&e.includes(t));if(i.length===0)return"";if(i.length===1){let e=i[0],c=e.lastIndexOf(t);return c>-1?e.substring(0,c):""}let o=[...i].sort(),u=o[0],l=o[o.length-1],r=0;for(;r<u.length&&r<l.length&&u[r]===l[r];)r++;let s=u.substring(0,r);if(s.endsWith(t))return s.slice(0,-1);let f=s.lastIndexOf(t);return f>-1?s.substring(0,f):""}function d(n){if(typeof g>"u")return a(n,"/");let t=g("path");return a(n,t.sep)}function x(n){return n.replace(/\\/g,"/")}function h(n){return n.replace(/\\/g,"/").replace(/^\/+/,"")}function m(n){return h(n)}export{a,d as b,x as c,h as d,m as e};
|
|
2
|
-
//# sourceMappingURL=chunk-Z566D7DF.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/path.ts"],"sourcesContent":["/**\n * @file Path helper utilities that work in both browser and Node.js environments.\n * Provides environment-agnostic path manipulation functions.\n */\n\n/**\n * Finds the common parent directory from an array of paths.\n * This function is the single shared implementation to be used by both browser and Node.js environments.\n * \n * @param paths - Array of paths to analyze for common parent directory.\n * @param separator - Path separator character (e.g., '/' for browser, path.sep for Node.js).\n * @returns The common parent directory path, or an empty string if none is found.\n */\nexport function findCommonParentDirectory(paths: string[], separator: string): string {\n // Validate input\n if (!paths || !Array.isArray(paths) || paths.length === 0) {\n return '';\n }\n \n // Filter out empty paths and paths without separators\n const validPaths = paths.filter(p => p && typeof p === 'string' && p.includes(separator));\n \n if (validPaths.length === 0) {\n return '';\n }\n\n // Special case for single path: return the directory containing this path\n if (validPaths.length === 1) {\n const path = validPaths[0];\n const lastSepIndex = path.lastIndexOf(separator);\n if (lastSepIndex > -1) {\n // Return the directory part without the file name\n return path.substring(0, lastSepIndex);\n }\n return ''; // No directory part found\n }\n\n // Sort paths alphabetically to easily find the common prefix\n const sortedPaths = [...validPaths].sort();\n const firstPath = sortedPaths[0];\n const lastPath = sortedPaths[sortedPaths.length - 1];\n \n // Find the length of the common prefix\n let i = 0;\n while (i < firstPath.length && i < lastPath.length && firstPath[i] === lastPath[i]) {\n i++;\n }\n\n const commonPrefix = firstPath.substring(0, i);\n\n // The prefix must be a directory. If it doesn't end with a separator,\n // find the last separator to get the parent directory.\n if (commonPrefix.endsWith(separator)) {\n // It's a full directory path that matches, so return it without the trailing slash\n return commonPrefix.slice(0, -1);\n }\n\n const lastSepIndex = commonPrefix.lastIndexOf(separator);\n if (lastSepIndex > -1) {\n return commonPrefix.substring(0, lastSepIndex);\n }\n\n return ''; // No common directory\n}\n\n/**\n * Simple helper to find common parent of absolute paths using the system path separator.\n * More declarative wrapper around findCommonParentDirectory for Node.js usage.\n * @param absolutePaths - Array of absolute file paths\n * @returns Common parent directory path or empty string if none found\n */\nexport function findCommonParent(absolutePaths: string[]): string {\n if (typeof require === 'undefined') {\n // Browser environment - use forward slash\n return findCommonParentDirectory(absolutePaths, '/');\n }\n \n // Node.js environment - use system separator\n const path = require('path');\n return findCommonParentDirectory(absolutePaths, path.sep);\n}\n\n\n/**\n * Converts backslashes to forward slashes for cross-platform compatibility.\n * Does not remove leading slashes (preserves absolute paths).\n * @param path - The path to normalize\n * @returns Path with forward slashes\n */\nexport function normalizeSlashes(path: string): string {\n return path.replace(/\\\\/g, '/');\n}\n\n/**\n * Normalizes a path for web usage by converting backslashes to forward slashes\n * and removing leading slashes.\n * @param path - The path to normalize\n * @returns Normalized path suitable for web deployment\n */\nexport function normalizeWebPath(path: string): string {\n return path.replace(/\\\\/g, '/').replace(/^\\/+/, '');\n}\n\n/**\n * Ensures a path is relative by normalizing it and removing any leading slashes.\n * @param path - The path to make relative\n * @returns Relative path suitable for web deployment\n */\nexport function ensureRelativePath(path: string): string {\n return normalizeWebPath(path);\n}\n"],"mappings":"gDAaO,SAASA,EAA0BC,EAAiBC,EAA2B,CAEpF,GAAI,CAACD,GAAS,CAAC,MAAM,QAAQA,CAAK,GAAKA,EAAM,SAAW,EACtD,MAAO,GAIT,IAAME,EAAaF,EAAM,OAAOG,GAAKA,GAAK,OAAOA,GAAM,UAAYA,EAAE,SAASF,CAAS,CAAC,EAExF,GAAIC,EAAW,SAAW,EACxB,MAAO,GAIT,GAAIA,EAAW,SAAW,EAAG,CAC3B,IAAME,EAAOF,EAAW,CAAC,EACnBG,EAAeD,EAAK,YAAYH,CAAS,EAC/C,OAAII,EAAe,GAEVD,EAAK,UAAU,EAAGC,CAAY,EAEhC,EACT,CAGA,IAAMC,EAAc,CAAC,GAAGJ,CAAU,EAAE,KAAK,EACnCK,EAAYD,EAAY,CAAC,EACzBE,EAAWF,EAAYA,EAAY,OAAS,CAAC,EAG/CG,EAAI,EACR,KAAOA,EAAIF,EAAU,QAAUE,EAAID,EAAS,QAAUD,EAAUE,CAAC,IAAMD,EAASC,CAAC,GAC/EA,IAGF,IAAMC,EAAeH,EAAU,UAAU,EAAGE,CAAC,EAI7C,GAAIC,EAAa,SAAST,CAAS,EAEjC,OAAOS,EAAa,MAAM,EAAG,EAAE,EAGjC,IAAML,EAAeK,EAAa,YAAYT,CAAS,EACvD,OAAII,EAAe,GACVK,EAAa,UAAU,EAAGL,CAAY,EAGxC,EACT,CAQO,SAASM,EAAiBC,EAAiC,CAChE,GAAI,OAAOC,EAAY,IAErB,OAAOd,EAA0Ba,EAAe,GAAG,EAIrD,IAAMR,EAAO,EAAQ,MAAM,EAC3B,OAAOL,EAA0Ba,EAAeR,EAAK,GAAG,CAC1D,CASO,SAASU,EAAiBV,EAAsB,CACrD,OAAOA,EAAK,QAAQ,MAAO,GAAG,CAChC,CAQO,SAASW,EAAiBX,EAAsB,CACrD,OAAOA,EAAK,QAAQ,MAAO,GAAG,EAAE,QAAQ,OAAQ,EAAE,CACpD,CAOO,SAASY,EAAmBZ,EAAsB,CACvD,OAAOW,EAAiBX,CAAI,CAC9B","names":["findCommonParentDirectory","paths","separator","validPaths","p","path","lastSepIndex","sortedPaths","firstPath","lastPath","i","commonPrefix","findCommonParent","absolutePaths","__require","normalizeSlashes","normalizeWebPath","ensureRelativePath"]}
|