@stryke/fs 0.33.38 → 0.33.40

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/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  # Changelog for Stryke - Fs
4
4
 
5
+ ## [0.33.39](https://github.com/storm-software/stryke/releases/tag/fs%400.33.39) (01/27/2026)
6
+
7
+ ### Updated Dependencies
8
+
9
+ - Updated **path** to **v0.26.3**
10
+
11
+ ## [0.33.38](https://github.com/storm-software/stryke/releases/tag/fs%400.33.38) (01/26/2026)
12
+
13
+ ### Updated Dependencies
14
+
15
+ - Updated **string-format** to **v0.13.6**
16
+ - Updated **type-checks** to **v0.5.22**
17
+ - Updated **convert** to **v0.6.37**
18
+ - Updated **helpers** to **v0.9.39**
19
+ - Updated **types** to **v0.10.36**
20
+ - Updated **json** to **v0.9.40**
21
+ - Updated **path** to **v0.26.2**
22
+
5
23
  ## [0.33.37](https://github.com/storm-software/stryke/releases/tag/fs%400.33.37) (01/25/2026)
6
24
 
7
25
  ### Updated Dependencies
@@ -47,10 +47,10 @@ function findFileName(filePath, options = {}) {
47
47
  */
48
48
  function findFilePath(filePath, options = {}) {
49
49
  const normalizedPath = require_correct_path.normalizeWindowsPath(filePath);
50
- const result = normalizedPath.replace(findFileName(normalizedPath, {
50
+ const result = normalizedPath.replace(/* @__PURE__ */ new RegExp(`\/${findFileName(normalizedPath, {
51
51
  requireExtension: false,
52
52
  ...options
53
- }), "");
53
+ })}$`), "");
54
54
  return result === "/" ? result : result.replace(/\/$/, "");
55
55
  }
56
56
  /**
@@ -44,10 +44,10 @@ function findFileName(filePath, options = {}) {
44
44
  */
45
45
  function findFilePath(filePath, options = {}) {
46
46
  const normalizedPath = normalizeWindowsPath(filePath);
47
- const result = normalizedPath.replace(findFileName(normalizedPath, {
47
+ const result = normalizedPath.replace(/* @__PURE__ */ new RegExp(`\/${findFileName(normalizedPath, {
48
48
  requireExtension: false,
49
49
  ...options
50
- }), "");
50
+ })}$`), "");
51
51
  return result === "/" ? result : result.replace(/\/$/, "");
52
52
  }
53
53
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"file-path-fns.mjs","names":["currentDir"],"sources":["../../../../path/src/file-path-fns.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { EMPTY_STRING } from \"@stryke/types/base\";\nimport _path from \"node:path\";\nimport { normalizeString, normalizeWindowsPath } from \"./correct-path\";\nimport { cwd as currentDir } from \"./cwd\";\nimport { isAbsolute, isAbsolutePath } from \"./is-type\";\nimport { joinPaths } from \"./join-paths\";\nimport {\n FILE_EXTENSION_REGEX,\n FULL_FILE_EXTENSION_REGEX,\n ROOT_FOLDER_REGEX\n} from \"./regex\";\n\nexport interface FindFileNameOptions extends FindFileExtensionOptions {\n /**\n * Require the file extension to be present in the file name.\n *\n * @defaultValue false\n */\n requireExtension?: boolean;\n\n /**\n * Return the file extension as part of the full file name result.\n *\n * @defaultValue true\n */\n withExtension?: boolean;\n}\n\n/**\n * Find the file name from a file path.\n *\n * @example\n * ```ts\n * const fileName = findFileName(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // fileName = \"file.txt\"\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file name\n */\nexport function findFileName(\n filePath: string,\n options: FindFileNameOptions = {}\n): string {\n const { requireExtension = false, withExtension = true } = options;\n const result =\n normalizeWindowsPath(filePath)\n ?.split(filePath?.includes(\"\\\\\") ? \"\\\\\" : \"/\")\n ?.pop() ?? \"\";\n\n if (requireExtension === true && !result.includes(\".\")) {\n return EMPTY_STRING;\n }\n\n if (withExtension === false && result.includes(\".\")) {\n return (\n result.replace(`.${findFileExtension(result, options) ?? \"\"}`, \"\") ||\n EMPTY_STRING\n );\n }\n\n return result;\n}\n\n/**\n * Find the full file path's directories from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link _path.dirname} function in Node's path module.\n *\n * @example\n * ```ts\n * const folderPath = findFilePath(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // folderPath = \"C:\\\\Users\\\\user\\\\Documents\"\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The full file path's directories\n */\nexport function findFilePath(\n filePath: string,\n options: FindFileNameOptions = {}\n): string {\n const normalizedPath = normalizeWindowsPath(filePath);\n\n const result = normalizedPath.replace(\n findFileName(normalizedPath, { requireExtension: false, ...options }),\n \"\"\n );\n\n return result === \"/\" ? result : result.replace(/\\/$/, \"\");\n}\n\nexport const dirname = findFilePath;\n\n/**\n * Find the top most folder containing the file from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link _path.basename} function in Node's path module.\n * If you're looking for the full path of the folder (for example: `C:\\\\Users\\\\user\\\\Documents` instead of just `Documents`) containing the file, use {@link findFilePath} instead.\n *\n * @example\n * const folderPath = findFolderName(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // folderPath = \"Documents\"\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The folder containing the file\n */\nexport function findFolderName(\n filePath: string,\n options?: FindFileNameOptions\n): string {\n const segments = findFilePath(filePath, options).split(\"/\");\n\n let lastSegment = \"\";\n for (let i = segments.length - 1; i >= 0; i--) {\n const val = segments[i];\n if (val) {\n lastSegment = val;\n break;\n }\n }\n\n // if (\n // folderPath.lastIndexOf(\"\\\\\") === folderPath.length - 1 ||\n // folderPath.lastIndexOf(\"/\") === folderPath.length - 1\n // ) {\n // folderPath = folderPath.slice(0, Math.max(0, folderPath.length - 1));\n // }\n\n return lastSegment ?? EMPTY_STRING;\n}\n\nexport const basename = findFolderName;\n\nexport interface FindFileExtensionOptions {\n /**\n * Return the full file extension including `.d` and `.map` if present.\n *\n * @defaultValue false\n */\n fullExtension?: boolean;\n}\n\n/**\n * Find the file extension from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link path.extname} function in Node's path module.\n * The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.\n *\n * @example\n * ```ts\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.config.ts\"); // Returns \"ts\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.d.ts\"); // Returns \"ts\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.d.ts\", { fullExtension: true }); // Returns \"d.ts\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.ts.map\"); // Returns \"ts\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.ts.map\", { fullExtension: true }); // Returns \"ts.map\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file\"); // Returns undefined\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file extension or undefined if no extension is found\n */\nexport function findFileExtension(\n filePath: string,\n options?: FindFileExtensionOptions\n): string | undefined {\n if (filePath.endsWith(\".\") || filePath.endsWith(\"/\")) {\n return undefined;\n }\n\n const match = (\n options?.fullExtension ? FULL_FILE_EXTENSION_REGEX : FILE_EXTENSION_REGEX\n ).exec(normalizeWindowsPath(filePath));\n\n return match && match.length > 0 && isSetString(match[0])\n ? match[0].replace(\".\", \"\")\n : undefined;\n}\n\nexport const extname = findFileExtension;\n\n/**\n * Find the file extension including the `\".\"` character prefix from a file path.\n *\n * @remarks\n * The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file extension (including the `\".\"` prefix) or undefined if no extension is found\n */\nexport function findFileDotExtension(\n filePath: string,\n options?: FindFileExtensionOptions\n): string | undefined {\n const ext = findFileExtension(filePath, options);\n\n return ext ? `.${ext}` : undefined;\n}\n\n/**\n * Find the file extension from a file path or an empty string.\n *\n * @remarks\n * The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file extension or an empty string if no extension is found\n */\nexport function findFileExtensionSafe(\n filePath: string,\n options?: FindFileExtensionOptions\n): string {\n return findFileExtension(filePath, options) ?? EMPTY_STRING;\n}\n\n/**\n * Find the file extension including the `\".\"` character prefix from a file path or an empty string.\n *\n * @remarks\n * The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file extension (including the `\".\"` prefix) or an empty string if no extension is found\n */\nexport function findFileDotExtensionSafe(\n filePath: string,\n options?: FindFileExtensionOptions\n): string {\n const ext = findFileExtension(filePath, options);\n\n return ext ? `.${ext}` : \"\";\n}\n\n/**\n * Check if a file path has a file name.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file name\n */\nexport function hasFileName(filePath: string): boolean {\n return Boolean(findFileName(filePath));\n}\n\n/**\n * Check if a file path has a file path.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file path\n */\nexport function hasFilePath(filePath: string): boolean {\n return Boolean(findFilePath(filePath));\n}\n\n/**\n * Check if a file path has a folder name.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a folder name\n */\nexport function hasFolderName(filePath: string): boolean {\n return Boolean(findFolderName(filePath));\n}\n\n/**\n * Check if a file path has a file extension.\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns An indicator specifying if the file path has a file extension\n */\nexport function hasFileExtension(\n filePath: string,\n options?: FindFileExtensionOptions\n): boolean {\n return Boolean(findFileExtension(filePath, options));\n}\n\n/**\n * Resolve the file path to an absolute path.\n *\n * @param path - The path to resolve\n * @param cwd - The current working directory\n * @returns The resolved path\n */\nexport function resolvePath(path: string, cwd = currentDir()) {\n // Normalize windows arguments\n const paths = normalizeWindowsPath(path).split(\"/\");\n\n let resolvedPath = \"\";\n let resolvedAbsolute = false;\n\n for (\n let index = paths.length - 1;\n index >= -1 && !resolvedAbsolute;\n index--\n ) {\n const path = index >= 0 ? paths[index] : cwd;\n\n // Skip empty entries\n if (!path || path.length === 0) {\n continue;\n }\n\n resolvedPath = joinPaths(path, resolvedPath);\n resolvedAbsolute = isAbsolutePath(path);\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {\n return `/${resolvedPath}`;\n }\n\n return resolvedPath.length > 0 ? resolvedPath : \".\";\n}\n\nexport function resolve(...paths: string[]) {\n // Normalize windows arguments\n paths = paths.map(argument => normalizeWindowsPath(argument));\n\n let resolvedPath = \"\";\n let resolvedAbsolute = false;\n\n for (\n let index = paths.length - 1;\n index >= -1 && !resolvedAbsolute;\n index--\n ) {\n const path = index >= 0 ? paths[index] : currentDir();\n\n // Skip empty entries\n if (!path || path.length === 0) {\n continue;\n }\n\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = isAbsolute(path);\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute && !isAbsolute(resolvedPath)) {\n return `/${resolvedPath}`;\n }\n\n return resolvedPath.length > 0 ? resolvedPath : \".\";\n}\n\n/**\n * Resolve the file path to an absolute path.\n *\n * @param paths - The paths to resolve\n * @returns The resolved path\n */\nexport function resolvePaths(...paths: string[]) {\n return resolvePath(\n joinPaths(...paths.map(path => normalizeWindowsPath(path)))\n );\n}\n\n/**\n * Get the relative path from one file to another.\n *\n * @remarks\n * This function is similar to the `path.relative` function in Node's path module.\n *\n * @param from - The base path to start from\n * @param to - The target path to resolve relative to the base path\n * @returns The relative path from the base path to the target path\n */\nexport function relative(from: string, to: string) {\n // we cast these because `split` will always be at least one string\n const _from = resolve(from).replace(ROOT_FOLDER_REGEX, \"$1\").split(\"/\") as [\n string,\n ...string[]\n ];\n const _to = resolve(to).replace(ROOT_FOLDER_REGEX, \"$1\").split(\"/\") as [\n string,\n ...string[]\n ];\n\n // Different windows drive letters\n if (_to[0][1] === \":\" && _from[0][1] === \":\" && _from[0] !== _to[0]) {\n return _to.join(\"/\");\n }\n\n const _fromCopy = [..._from];\n for (const segment of _fromCopy) {\n if (_to[0] !== segment) {\n break;\n }\n _from.shift();\n _to.shift();\n }\n return [..._from.map(() => \"..\"), ..._to].join(\"/\");\n}\n\n/**\n * Get the relative path from one file to another.\n *\n * @remarks\n * This function wraps the `path.relative` function in Node's path module.\n *\n * @param from - The base path to start from\n * @param to - The target path to resolve relative to the base path\n * @param withEndSlash - Whether to include a trailing slash at the end of the path\n * @returns The relative path from the base path to the target path\n */\nexport function relativePath(from: string, to: string, withEndSlash = false) {\n return relative(\n withEndSlash !== true ? from.replace(/\\/$/, \"\") : from,\n withEndSlash !== true ? to.replace(/\\/$/, \"\") : to\n );\n}\n\n/**\n * Find the file path relative to the workspace root path.\n *\n * @param filePath - The file path to process\n * @returns The resolved file path\n */\nexport function relativeToCurrentDir(filePath: string) {\n return relativePath(filePath, currentDir());\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function parsePath(path: string, options?: FindFileNameOptions) {\n // The root of the path such as '/' or 'c:\\'\n const root =\n /^[/\\\\]|^[a-z]:[/\\\\]/i.exec(path)?.[0]?.replace(/\\\\/g, \"/\") || \"\";\n\n const normalizedPath = normalizeWindowsPath(path);\n\n const segments = normalizedPath.replace(/\\/$/, \"\").split(\"/\").slice(0, -1);\n if (segments.length === 1 && /^[A-Z]:$/i.test(segments[0] as string)) {\n segments[0] += \"/\";\n }\n\n const base = findFolderName(normalizedPath, options);\n const dir = segments.join(\"/\") || (isAbsolutePath(path) ? \"/\" : \".\");\n const ext = findFileExtensionSafe(path, options);\n\n return {\n root,\n dir,\n base,\n ext,\n name: base.slice(0, base.length - ext.length)\n };\n}\n\n/**\n * Rename the file name with a new name.\n *\n * @param filePath - The current file path being processed\n * @param newFileName - The updated file name being processed\n * @param options - Options to control the file name extraction\n * @returns The modified or unmodified file path.\n */\nexport function renameFile(\n filePath: string,\n newFileName: string,\n options?: FindFileNameOptions\n): string {\n const file = parsePath(filePath, options);\n\n return joinPaths(\n file.dir,\n newFileName.includes(\".\") ? newFileName : newFileName + file.ext\n );\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"file-path-fns.mjs","names":["currentDir"],"sources":["../../../../path/src/file-path-fns.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { EMPTY_STRING } from \"@stryke/types/base\";\nimport _path from \"node:path\";\nimport { normalizeString, normalizeWindowsPath } from \"./correct-path\";\nimport { cwd as currentDir } from \"./cwd\";\nimport { isAbsolute, isAbsolutePath } from \"./is-type\";\nimport { joinPaths } from \"./join-paths\";\nimport {\n FILE_EXTENSION_REGEX,\n FULL_FILE_EXTENSION_REGEX,\n ROOT_FOLDER_REGEX\n} from \"./regex\";\n\nexport interface FindFileNameOptions extends FindFileExtensionOptions {\n /**\n * Require the file extension to be present in the file name.\n *\n * @defaultValue false\n */\n requireExtension?: boolean;\n\n /**\n * Return the file extension as part of the full file name result.\n *\n * @defaultValue true\n */\n withExtension?: boolean;\n}\n\n/**\n * Find the file name from a file path.\n *\n * @example\n * ```ts\n * const fileName = findFileName(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // fileName = \"file.txt\"\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file name\n */\nexport function findFileName(\n filePath: string,\n options: FindFileNameOptions = {}\n): string {\n const { requireExtension = false, withExtension = true } = options;\n const result =\n normalizeWindowsPath(filePath)\n ?.split(filePath?.includes(\"\\\\\") ? \"\\\\\" : \"/\")\n ?.pop() ?? \"\";\n\n if (requireExtension === true && !result.includes(\".\")) {\n return EMPTY_STRING;\n }\n\n if (withExtension === false && result.includes(\".\")) {\n return (\n result.replace(`.${findFileExtension(result, options) ?? \"\"}`, \"\") ||\n EMPTY_STRING\n );\n }\n\n return result;\n}\n\n/**\n * Find the full file path's directories from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link _path.dirname} function in Node's path module.\n *\n * @example\n * ```ts\n * const folderPath = findFilePath(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // folderPath = \"C:\\\\Users\\\\user\\\\Documents\"\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The full file path's directories\n */\nexport function findFilePath(\n filePath: string,\n options: FindFileNameOptions = {}\n): string {\n const normalizedPath = normalizeWindowsPath(filePath);\n\n const result = normalizedPath.replace(\n new RegExp(\n `\\/${findFileName(normalizedPath, { requireExtension: false, ...options })}$`\n ),\n \"\"\n );\n\n return result === \"/\" ? result : result.replace(/\\/$/, \"\");\n}\n\nexport const dirname = findFilePath;\n\n/**\n * Find the top most folder containing the file from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link _path.basename} function in Node's path module.\n * If you're looking for the full path of the folder (for example: `C:\\\\Users\\\\user\\\\Documents` instead of just `Documents`) containing the file, use {@link findFilePath} instead.\n *\n * @example\n * const folderPath = findFolderName(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // folderPath = \"Documents\"\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The folder containing the file\n */\nexport function findFolderName(\n filePath: string,\n options?: FindFileNameOptions\n): string {\n const segments = findFilePath(filePath, options).split(\"/\");\n\n let lastSegment = \"\";\n for (let i = segments.length - 1; i >= 0; i--) {\n const val = segments[i];\n if (val) {\n lastSegment = val;\n break;\n }\n }\n\n // if (\n // folderPath.lastIndexOf(\"\\\\\") === folderPath.length - 1 ||\n // folderPath.lastIndexOf(\"/\") === folderPath.length - 1\n // ) {\n // folderPath = folderPath.slice(0, Math.max(0, folderPath.length - 1));\n // }\n\n return lastSegment ?? EMPTY_STRING;\n}\n\nexport const basename = findFolderName;\n\nexport interface FindFileExtensionOptions {\n /**\n * Return the full file extension including `.d` and `.map` if present.\n *\n * @defaultValue false\n */\n fullExtension?: boolean;\n}\n\n/**\n * Find the file extension from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link path.extname} function in Node's path module.\n * The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.\n *\n * @example\n * ```ts\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.config.ts\"); // Returns \"ts\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.d.ts\"); // Returns \"ts\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.d.ts\", { fullExtension: true }); // Returns \"d.ts\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.ts.map\"); // Returns \"ts\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.ts.map\", { fullExtension: true }); // Returns \"ts.map\"\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file\"); // Returns undefined\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file extension or undefined if no extension is found\n */\nexport function findFileExtension(\n filePath: string,\n options?: FindFileExtensionOptions\n): string | undefined {\n if (filePath.endsWith(\".\") || filePath.endsWith(\"/\")) {\n return undefined;\n }\n\n const match = (\n options?.fullExtension ? FULL_FILE_EXTENSION_REGEX : FILE_EXTENSION_REGEX\n ).exec(normalizeWindowsPath(filePath));\n\n return match && match.length > 0 && isSetString(match[0])\n ? match[0].replace(\".\", \"\")\n : undefined;\n}\n\nexport const extname = findFileExtension;\n\n/**\n * Find the file extension including the `\".\"` character prefix from a file path.\n *\n * @remarks\n * The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file extension (including the `\".\"` prefix) or undefined if no extension is found\n */\nexport function findFileDotExtension(\n filePath: string,\n options?: FindFileExtensionOptions\n): string | undefined {\n const ext = findFileExtension(filePath, options);\n\n return ext ? `.${ext}` : undefined;\n}\n\n/**\n * Find the file extension from a file path or an empty string.\n *\n * @remarks\n * The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file extension or an empty string if no extension is found\n */\nexport function findFileExtensionSafe(\n filePath: string,\n options?: FindFileExtensionOptions\n): string {\n return findFileExtension(filePath, options) ?? EMPTY_STRING;\n}\n\n/**\n * Find the file extension including the `\".\"` character prefix from a file path or an empty string.\n *\n * @remarks\n * The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file extension (including the `\".\"` prefix) or an empty string if no extension is found\n */\nexport function findFileDotExtensionSafe(\n filePath: string,\n options?: FindFileExtensionOptions\n): string {\n const ext = findFileExtension(filePath, options);\n\n return ext ? `.${ext}` : \"\";\n}\n\n/**\n * Check if a file path has a file name.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file name\n */\nexport function hasFileName(filePath: string): boolean {\n return Boolean(findFileName(filePath));\n}\n\n/**\n * Check if a file path has a file path.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file path\n */\nexport function hasFilePath(filePath: string): boolean {\n return Boolean(findFilePath(filePath));\n}\n\n/**\n * Check if a file path has a folder name.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a folder name\n */\nexport function hasFolderName(filePath: string): boolean {\n return Boolean(findFolderName(filePath));\n}\n\n/**\n * Check if a file path has a file extension.\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns An indicator specifying if the file path has a file extension\n */\nexport function hasFileExtension(\n filePath: string,\n options?: FindFileExtensionOptions\n): boolean {\n return Boolean(findFileExtension(filePath, options));\n}\n\n/**\n * Resolve the file path to an absolute path.\n *\n * @param path - The path to resolve\n * @param cwd - The current working directory\n * @returns The resolved path\n */\nexport function resolvePath(path: string, cwd = currentDir()) {\n // Normalize windows arguments\n const paths = normalizeWindowsPath(path).split(\"/\");\n\n let resolvedPath = \"\";\n let resolvedAbsolute = false;\n\n for (\n let index = paths.length - 1;\n index >= -1 && !resolvedAbsolute;\n index--\n ) {\n const path = index >= 0 ? paths[index] : cwd;\n\n // Skip empty entries\n if (!path || path.length === 0) {\n continue;\n }\n\n resolvedPath = joinPaths(path, resolvedPath);\n resolvedAbsolute = isAbsolutePath(path);\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {\n return `/${resolvedPath}`;\n }\n\n return resolvedPath.length > 0 ? resolvedPath : \".\";\n}\n\nexport function resolve(...paths: string[]) {\n // Normalize windows arguments\n paths = paths.map(argument => normalizeWindowsPath(argument));\n\n let resolvedPath = \"\";\n let resolvedAbsolute = false;\n\n for (\n let index = paths.length - 1;\n index >= -1 && !resolvedAbsolute;\n index--\n ) {\n const path = index >= 0 ? paths[index] : currentDir();\n\n // Skip empty entries\n if (!path || path.length === 0) {\n continue;\n }\n\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = isAbsolute(path);\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute && !isAbsolute(resolvedPath)) {\n return `/${resolvedPath}`;\n }\n\n return resolvedPath.length > 0 ? resolvedPath : \".\";\n}\n\n/**\n * Resolve the file path to an absolute path.\n *\n * @param paths - The paths to resolve\n * @returns The resolved path\n */\nexport function resolvePaths(...paths: string[]) {\n return resolvePath(\n joinPaths(...paths.map(path => normalizeWindowsPath(path)))\n );\n}\n\n/**\n * Get the relative path from one file to another.\n *\n * @remarks\n * This function is similar to the `path.relative` function in Node's path module.\n *\n * @param from - The base path to start from\n * @param to - The target path to resolve relative to the base path\n * @returns The relative path from the base path to the target path\n */\nexport function relative(from: string, to: string) {\n // we cast these because `split` will always be at least one string\n const _from = resolve(from).replace(ROOT_FOLDER_REGEX, \"$1\").split(\"/\") as [\n string,\n ...string[]\n ];\n const _to = resolve(to).replace(ROOT_FOLDER_REGEX, \"$1\").split(\"/\") as [\n string,\n ...string[]\n ];\n\n // Different windows drive letters\n if (_to[0][1] === \":\" && _from[0][1] === \":\" && _from[0] !== _to[0]) {\n return _to.join(\"/\");\n }\n\n const _fromCopy = [..._from];\n for (const segment of _fromCopy) {\n if (_to[0] !== segment) {\n break;\n }\n _from.shift();\n _to.shift();\n }\n return [..._from.map(() => \"..\"), ..._to].join(\"/\");\n}\n\n/**\n * Get the relative path from one file to another.\n *\n * @remarks\n * This function wraps the `path.relative` function in Node's path module.\n *\n * @param from - The base path to start from\n * @param to - The target path to resolve relative to the base path\n * @param withEndSlash - Whether to include a trailing slash at the end of the path\n * @returns The relative path from the base path to the target path\n */\nexport function relativePath(from: string, to: string, withEndSlash = false) {\n return relative(\n withEndSlash !== true ? from.replace(/\\/$/, \"\") : from,\n withEndSlash !== true ? to.replace(/\\/$/, \"\") : to\n );\n}\n\n/**\n * Find the file path relative to the workspace root path.\n *\n * @param filePath - The file path to process\n * @returns The resolved file path\n */\nexport function relativeToCurrentDir(filePath: string) {\n return relativePath(filePath, currentDir());\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function parsePath(path: string, options?: FindFileNameOptions) {\n // The root of the path such as '/' or 'c:\\'\n const root =\n /^[/\\\\]|^[a-z]:[/\\\\]/i.exec(path)?.[0]?.replace(/\\\\/g, \"/\") || \"\";\n\n const normalizedPath = normalizeWindowsPath(path);\n\n const segments = normalizedPath.replace(/\\/$/, \"\").split(\"/\").slice(0, -1);\n if (segments.length === 1 && /^[A-Z]:$/i.test(segments[0] as string)) {\n segments[0] += \"/\";\n }\n\n const base = findFolderName(normalizedPath, options);\n const dir = segments.join(\"/\") || (isAbsolutePath(path) ? \"/\" : \".\");\n const ext = findFileExtensionSafe(path, options);\n\n return {\n root,\n dir,\n base,\n ext,\n name: base.slice(0, base.length - ext.length)\n };\n}\n\n/**\n * Rename the file name with a new name.\n *\n * @param filePath - The current file path being processed\n * @param newFileName - The updated file name being processed\n * @param options - Options to control the file name extraction\n * @returns The modified or unmodified file path.\n */\nexport function renameFile(\n filePath: string,\n newFileName: string,\n options?: FindFileNameOptions\n): string {\n const file = parsePath(filePath, options);\n\n return joinPaths(\n file.dir,\n newFileName.includes(\".\") ? newFileName : newFileName + file.ext\n );\n}\n"],"mappings":"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"}
@@ -1,5 +1,6 @@
1
1
  const require_regex = require('./regex.cjs');
2
2
  const require_is_type = require('./is-type.cjs');
3
+ const require_slash = require('./slash.cjs');
3
4
 
4
5
  //#region ../path/src/join-paths.ts
5
6
  function normalizeWindowsPath(input = "") {
@@ -27,23 +28,38 @@ function correctPaths(path) {
27
28
  }
28
29
  /**
29
30
  * Joins all given path segments together using the platform-specific separator as a delimiter.
30
- * The resulting path is normalized to remove any redundant or unnecessary segments.
31
+ *
32
+ * @remarks
33
+ * Multiple segments can be provided as separate arguments. The resulting path is normalized to remove any redundant or unnecessary segments.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { joinPaths } from 'stryke/path';
38
+ *
39
+ * const fullPath = joinPaths('folder1', 'folder2', '..', 'folder3', 'file.txt');
40
+ * console.log(fullPath); // Output: 'folder1/folder3/file.txt'
41
+ *
42
+ * const absolutePath = joinPaths('/root', 'folder', '.', 'subfolder', 'file.txt');
43
+ * console.log(absolutePath); // Output: '/root/folder/subfolder/file.txt'
44
+ *
45
+ * const windowsPath = joinPaths('C:\\', 'Users', 'Public', '..', 'Documents', 'file.txt');
46
+ * console.log(windowsPath); // Output: 'C:/Users/Documents/file.txt'
47
+ *
48
+ * const uncPath = joinPaths('\\\\Server\\Share', 'Folder', 'File.txt');
49
+ * console.log(uncPath); // Output: '//Server/Share/Folder/File.txt'
50
+ * ```
31
51
  *
32
52
  * @param segments - The path segments to join.
33
53
  * @returns The joined and normalized path string.
34
54
  */
35
55
  function joinPaths(...segments) {
36
- let path = "";
37
- for (const seg of segments) {
38
- if (!seg) continue;
39
- if (path.length > 0) {
40
- const pathTrailing = path[path.length - 1] === "/";
41
- const segLeading = seg[0] === "/";
42
- if (pathTrailing && segLeading) path += seg.slice(1);
43
- else path += pathTrailing || segLeading ? seg : `/${seg}`;
44
- } else path += seg;
56
+ let result = "";
57
+ for (const segment of segments) if (segment && require_slash.slash(segment).replaceAll(/\//g, "") !== ".") {
58
+ if (result) if (require_slash.slash(segment).replaceAll(/\//g, "") === "..") result = require_slash.slash(result).replace(/\/+$/, "").replace(/\/*[^/]+$/, "");
59
+ else result = `${require_slash.slash(result).replace(/\/+$/, "")}/${require_slash.slash(segment).replace(/^\/+/, "")}`;
60
+ else if (require_slash.slash(segment).replaceAll(/\//g, "") !== "..") result = segment;
45
61
  }
46
- return correctPaths(path);
62
+ return correctPaths(result);
47
63
  }
48
64
  /**
49
65
  * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
@@ -1,5 +1,6 @@
1
1
  import { DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, UNC_REGEX } from "./regex.mjs";
2
2
  import { isAbsolute } from "./is-type.mjs";
3
+ import { slash } from "./slash.mjs";
3
4
 
4
5
  //#region ../path/src/join-paths.ts
5
6
  function normalizeWindowsPath(input = "") {
@@ -27,23 +28,38 @@ function correctPaths(path) {
27
28
  }
28
29
  /**
29
30
  * Joins all given path segments together using the platform-specific separator as a delimiter.
30
- * The resulting path is normalized to remove any redundant or unnecessary segments.
31
+ *
32
+ * @remarks
33
+ * Multiple segments can be provided as separate arguments. The resulting path is normalized to remove any redundant or unnecessary segments.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { joinPaths } from 'stryke/path';
38
+ *
39
+ * const fullPath = joinPaths('folder1', 'folder2', '..', 'folder3', 'file.txt');
40
+ * console.log(fullPath); // Output: 'folder1/folder3/file.txt'
41
+ *
42
+ * const absolutePath = joinPaths('/root', 'folder', '.', 'subfolder', 'file.txt');
43
+ * console.log(absolutePath); // Output: '/root/folder/subfolder/file.txt'
44
+ *
45
+ * const windowsPath = joinPaths('C:\\', 'Users', 'Public', '..', 'Documents', 'file.txt');
46
+ * console.log(windowsPath); // Output: 'C:/Users/Documents/file.txt'
47
+ *
48
+ * const uncPath = joinPaths('\\\\Server\\Share', 'Folder', 'File.txt');
49
+ * console.log(uncPath); // Output: '//Server/Share/Folder/File.txt'
50
+ * ```
31
51
  *
32
52
  * @param segments - The path segments to join.
33
53
  * @returns The joined and normalized path string.
34
54
  */
35
55
  function joinPaths(...segments) {
36
- let path = "";
37
- for (const seg of segments) {
38
- if (!seg) continue;
39
- if (path.length > 0) {
40
- const pathTrailing = path[path.length - 1] === "/";
41
- const segLeading = seg[0] === "/";
42
- if (pathTrailing && segLeading) path += seg.slice(1);
43
- else path += pathTrailing || segLeading ? seg : `/${seg}`;
44
- } else path += seg;
56
+ let result = "";
57
+ for (const segment of segments) if (segment && slash(segment).replaceAll(/\//g, "") !== ".") {
58
+ if (result) if (slash(segment).replaceAll(/\//g, "") === "..") result = slash(result).replace(/\/+$/, "").replace(/\/*[^/]+$/, "");
59
+ else result = `${slash(result).replace(/\/+$/, "")}/${slash(segment).replace(/^\/+/, "")}`;
60
+ else if (slash(segment).replaceAll(/\//g, "") !== "..") result = segment;
45
61
  }
46
- return correctPaths(path);
62
+ return correctPaths(result);
47
63
  }
48
64
  /**
49
65
  * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
@@ -1 +1 @@
1
- {"version":3,"file":"join-paths.mjs","names":["char: string | null"],"sources":["../../../../path/src/join-paths.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isAbsolute } from \"./is-type\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\n\n// Util to normalize windows paths to posix\nfunction normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n return input\n .replace(/\\\\/g, \"/\")\n .replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\nfunction correctPaths(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n // Normalize windows argument\n path = normalizeWindowsPath(path);\n\n const isUNCPath = path.match(UNC_REGEX);\n const isPathAbsolute = isAbsolute(path);\n const trailingSeparator = path[path.length - 1] === \"/\";\n\n // Normalize the path\n path = normalizeString(path, !isPathAbsolute);\n\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n if (trailingSeparator) {\n path += \"/\";\n }\n if (DRIVE_LETTER_REGEX.test(path)) {\n path += \"/\";\n }\n\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n\n return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n}\n\n/**\n * Joins all given path segments together using the platform-specific separator as a delimiter.\n * The resulting path is normalized to remove any redundant or unnecessary segments.\n *\n * @param segments - The path segments to join.\n * @returns The joined and normalized path string.\n */\nexport function joinPaths(...segments: string[]): string {\n let path = \"\";\n\n for (const seg of segments) {\n if (!seg) {\n continue;\n }\n if (path.length > 0) {\n const pathTrailing = path[path.length - 1] === \"/\";\n const segLeading = seg[0] === \"/\";\n const both = pathTrailing && segLeading;\n if (both) {\n path += seg.slice(1);\n } else {\n path += pathTrailing || segLeading ? seg : `/${seg}`;\n }\n } else {\n path += seg;\n }\n }\n\n return correctPaths(path);\n}\n\nexport const join = joinPaths;\n\n/**\n * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n *\n * @param path - The path to normalize.\n * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n * @returns the normalized path string.\n */\nfunction normalizeString(path: string, allowAboveRoot: boolean) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char: string | null = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n // casted because we know it exists thanks to the length check\n char = path[index] as string;\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) {\n // NOOP\n } else if (dots === 2) {\n if (\n res.length < 2 ||\n lastSegmentLength !== 2 ||\n res[res.length - 1] !== \".\" ||\n res[res.length - 2] !== \".\"\n ) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n"],"mappings":";;;;AA0BA,SAAS,qBAAqB,QAAQ,IAAI;AACxC,KAAI,CAAC,MACH,QAAO;AAET,QAAO,MACJ,QAAQ,OAAO,IAAI,CACnB,QAAQ,2BAA0B,MAAK,EAAE,aAAa,CAAC;;AAG5D,SAAS,aAAa,MAAe;AACnC,KAAI,CAAC,QAAQ,KAAK,WAAW,EAC3B,QAAO;AAIT,QAAO,qBAAqB,KAAK;CAEjC,MAAM,YAAY,KAAK,MAAM,UAAU;CACvC,MAAM,iBAAiB,WAAW,KAAK;CACvC,MAAM,oBAAoB,KAAK,KAAK,SAAS,OAAO;AAGpD,QAAO,gBAAgB,MAAM,CAAC,eAAe;AAE7C,KAAI,KAAK,WAAW,GAAG;AACrB,MAAI,eACF,QAAO;AAET,SAAO,oBAAoB,OAAO;;AAEpC,KAAI,kBACF,SAAQ;AAEV,KAAI,mBAAmB,KAAK,KAAK,CAC/B,SAAQ;AAGV,KAAI,WAAW;AACb,MAAI,CAAC,eACH,QAAO,OAAO;AAEhB,SAAO,KAAK;;AAGd,QAAO,kBAAkB,CAAC,WAAW,KAAK,GAAG,IAAI,SAAS;;;;;;;;;AAU5D,SAAgB,UAAU,GAAG,UAA4B;CACvD,IAAI,OAAO;AAEX,MAAK,MAAM,OAAO,UAAU;AAC1B,MAAI,CAAC,IACH;AAEF,MAAI,KAAK,SAAS,GAAG;GACnB,MAAM,eAAe,KAAK,KAAK,SAAS,OAAO;GAC/C,MAAM,aAAa,IAAI,OAAO;AAE9B,OADa,gBAAgB,WAE3B,SAAQ,IAAI,MAAM,EAAE;OAEpB,SAAQ,gBAAgB,aAAa,MAAM,IAAI;QAGjD,SAAQ;;AAIZ,QAAO,aAAa,KAAK;;;;;;;;;AAY3B,SAAS,gBAAgB,MAAc,gBAAyB;CAC9D,IAAI,MAAM;CACV,IAAI,oBAAoB;CACxB,IAAI,YAAY;CAChB,IAAI,OAAO;CACX,IAAIA,OAAsB;AAC1B,MAAK,IAAI,QAAQ,GAAG,SAAS,KAAK,QAAQ,EAAE,OAAO;AACjD,MAAI,QAAQ,KAAK,OAEf,QAAO,KAAK;WACH,SAAS,IAClB;MAEA,QAAO;AAET,MAAI,SAAS,KAAK;AAChB,OAAI,cAAc,QAAQ,KAAK,SAAS,GAAG,YAEhC,SAAS,GAAG;AACrB,QACE,IAAI,SAAS,KACb,sBAAsB,KACtB,IAAI,IAAI,SAAS,OAAO,OACxB,IAAI,IAAI,SAAS,OAAO,KAExB;SAAI,IAAI,SAAS,GAAG;MAClB,MAAM,iBAAiB,IAAI,YAAY,IAAI;AAC3C,UAAI,mBAAmB,IAAI;AACzB,aAAM;AACN,2BAAoB;aACf;AACL,aAAM,IAAI,MAAM,GAAG,eAAe;AAClC,2BAAoB,IAAI,SAAS,IAAI,IAAI,YAAY,IAAI;;AAE3D,kBAAY;AACZ,aAAO;AACP;gBACS,IAAI,SAAS,GAAG;AACzB,YAAM;AACN,0BAAoB;AACpB,kBAAY;AACZ,aAAO;AACP;;;AAGJ,QAAI,gBAAgB;AAClB,YAAO,IAAI,SAAS,IAAI,QAAQ;AAChC,yBAAoB;;UAEjB;AACL,QAAI,IAAI,SAAS,EACf,QAAO,IAAI,KAAK,MAAM,YAAY,GAAG,MAAM;QAE3C,OAAM,KAAK,MAAM,YAAY,GAAG,MAAM;AAExC,wBAAoB,QAAQ,YAAY;;AAE1C,eAAY;AACZ,UAAO;aACE,SAAS,OAAO,SAAS,GAClC,GAAE;MAEF,QAAO;;AAGX,QAAO"}
1
+ {"version":3,"file":"join-paths.mjs","names":["char: string | null"],"sources":["../../../../path/src/join-paths.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isAbsolute } from \"./is-type\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\nimport { slash } from \"./slash\";\n\n// Util to normalize windows paths to posix\nfunction normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n return input\n .replace(/\\\\/g, \"/\")\n .replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\nfunction correctPaths(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n // Normalize windows argument\n path = normalizeWindowsPath(path);\n\n const isUNCPath = path.match(UNC_REGEX);\n const isPathAbsolute = isAbsolute(path);\n const trailingSeparator = path[path.length - 1] === \"/\";\n\n // Normalize the path\n path = normalizeString(path, !isPathAbsolute);\n\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n if (trailingSeparator) {\n path += \"/\";\n }\n if (DRIVE_LETTER_REGEX.test(path)) {\n path += \"/\";\n }\n\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n\n return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n}\n\n/**\n * Joins all given path segments together using the platform-specific separator as a delimiter.\n *\n * @remarks\n * Multiple segments can be provided as separate arguments. The resulting path is normalized to remove any redundant or unnecessary segments.\n *\n * @example\n * ```ts\n * import { joinPaths } from 'stryke/path';\n *\n * const fullPath = joinPaths('folder1', 'folder2', '..', 'folder3', 'file.txt');\n * console.log(fullPath); // Output: 'folder1/folder3/file.txt'\n *\n * const absolutePath = joinPaths('/root', 'folder', '.', 'subfolder', 'file.txt');\n * console.log(absolutePath); // Output: '/root/folder/subfolder/file.txt'\n *\n * const windowsPath = joinPaths('C:\\\\', 'Users', 'Public', '..', 'Documents', 'file.txt');\n * console.log(windowsPath); // Output: 'C:/Users/Documents/file.txt'\n *\n * const uncPath = joinPaths('\\\\\\\\Server\\\\Share', 'Folder', 'File.txt');\n * console.log(uncPath); // Output: '//Server/Share/Folder/File.txt'\n * ```\n *\n * @param segments - The path segments to join.\n * @returns The joined and normalized path string.\n */\nexport function joinPaths(...segments: string[]): string {\n let result = \"\";\n for (const segment of segments) {\n if (segment && slash(segment).replaceAll(/\\//g, \"\") !== \".\") {\n if (result) {\n if (slash(segment).replaceAll(/\\//g, \"\") === \"..\") {\n result = slash(result)\n .replace(/\\/+$/, \"\")\n .replace(/\\/*[^/]+$/, \"\");\n } else {\n result = `${slash(result).replace(/\\/+$/, \"\")}/${slash(\n segment\n ).replace(/^\\/+/, \"\")}`;\n }\n } else if (slash(segment).replaceAll(/\\//g, \"\") !== \"..\") {\n result = segment;\n }\n }\n }\n\n return correctPaths(result);\n}\n\nexport const join = joinPaths;\n\n/**\n * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n *\n * @param path - The path to normalize.\n * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n * @returns the normalized path string.\n */\nfunction normalizeString(path: string, allowAboveRoot: boolean) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char: string | null = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n // casted because we know it exists thanks to the length check\n char = path[index] as string;\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) {\n // NOOP\n } else if (dots === 2) {\n if (\n res.length < 2 ||\n lastSegmentLength !== 2 ||\n res[res.length - 1] !== \".\" ||\n res[res.length - 2] !== \".\"\n ) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n"],"mappings":";;;;;AA2BA,SAAS,qBAAqB,QAAQ,IAAI;AACxC,KAAI,CAAC,MACH,QAAO;AAET,QAAO,MACJ,QAAQ,OAAO,IAAI,CACnB,QAAQ,2BAA0B,MAAK,EAAE,aAAa,CAAC;;AAG5D,SAAS,aAAa,MAAe;AACnC,KAAI,CAAC,QAAQ,KAAK,WAAW,EAC3B,QAAO;AAIT,QAAO,qBAAqB,KAAK;CAEjC,MAAM,YAAY,KAAK,MAAM,UAAU;CACvC,MAAM,iBAAiB,WAAW,KAAK;CACvC,MAAM,oBAAoB,KAAK,KAAK,SAAS,OAAO;AAGpD,QAAO,gBAAgB,MAAM,CAAC,eAAe;AAE7C,KAAI,KAAK,WAAW,GAAG;AACrB,MAAI,eACF,QAAO;AAET,SAAO,oBAAoB,OAAO;;AAEpC,KAAI,kBACF,SAAQ;AAEV,KAAI,mBAAmB,KAAK,KAAK,CAC/B,SAAQ;AAGV,KAAI,WAAW;AACb,MAAI,CAAC,eACH,QAAO,OAAO;AAEhB,SAAO,KAAK;;AAGd,QAAO,kBAAkB,CAAC,WAAW,KAAK,GAAG,IAAI,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6B5D,SAAgB,UAAU,GAAG,UAA4B;CACvD,IAAI,SAAS;AACb,MAAK,MAAM,WAAW,SACpB,KAAI,WAAW,MAAM,QAAQ,CAAC,WAAW,OAAO,GAAG,KAAK,KACtD;MAAI,OACF,KAAI,MAAM,QAAQ,CAAC,WAAW,OAAO,GAAG,KAAK,KAC3C,UAAS,MAAM,OAAO,CACnB,QAAQ,QAAQ,GAAG,CACnB,QAAQ,aAAa,GAAG;MAE3B,UAAS,GAAG,MAAM,OAAO,CAAC,QAAQ,QAAQ,GAAG,CAAC,GAAG,MAC/C,QACD,CAAC,QAAQ,QAAQ,GAAG;WAEd,MAAM,QAAQ,CAAC,WAAW,OAAO,GAAG,KAAK,KAClD,UAAS;;AAKf,QAAO,aAAa,OAAO;;;;;;;;;AAY7B,SAAS,gBAAgB,MAAc,gBAAyB;CAC9D,IAAI,MAAM;CACV,IAAI,oBAAoB;CACxB,IAAI,YAAY;CAChB,IAAI,OAAO;CACX,IAAIA,OAAsB;AAC1B,MAAK,IAAI,QAAQ,GAAG,SAAS,KAAK,QAAQ,EAAE,OAAO;AACjD,MAAI,QAAQ,KAAK,OAEf,QAAO,KAAK;WACH,SAAS,IAClB;MAEA,QAAO;AAET,MAAI,SAAS,KAAK;AAChB,OAAI,cAAc,QAAQ,KAAK,SAAS,GAAG,YAEhC,SAAS,GAAG;AACrB,QACE,IAAI,SAAS,KACb,sBAAsB,KACtB,IAAI,IAAI,SAAS,OAAO,OACxB,IAAI,IAAI,SAAS,OAAO,KAExB;SAAI,IAAI,SAAS,GAAG;MAClB,MAAM,iBAAiB,IAAI,YAAY,IAAI;AAC3C,UAAI,mBAAmB,IAAI;AACzB,aAAM;AACN,2BAAoB;aACf;AACL,aAAM,IAAI,MAAM,GAAG,eAAe;AAClC,2BAAoB,IAAI,SAAS,IAAI,IAAI,YAAY,IAAI;;AAE3D,kBAAY;AACZ,aAAO;AACP;gBACS,IAAI,SAAS,GAAG;AACzB,YAAM;AACN,0BAAoB;AACpB,kBAAY;AACZ,aAAO;AACP;;;AAGJ,QAAI,gBAAgB;AAClB,YAAO,IAAI,SAAS,IAAI,QAAQ;AAChC,yBAAoB;;UAEjB;AACL,QAAI,IAAI,SAAS,EACf,QAAO,IAAI,KAAK,MAAM,YAAY,GAAG,MAAM;QAE3C,OAAM,KAAK,MAAM,YAAY,GAAG,MAAM;AAExC,wBAAoB,QAAQ,YAAY;;AAE1C,eAAY;AACZ,UAAO;aACE,SAAS,OAAO,SAAS,GAClC,GAAE;MAEF,QAAO;;AAGX,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/fs",
3
- "version": "0.33.38",
3
+ "version": "0.33.40",
4
4
  "type": "module",
5
5
  "description": "A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.",
6
6
  "repository": {
@@ -103,16 +103,16 @@
103
103
  "./*": "./*"
104
104
  },
105
105
  "types": "./dist/index.d.cts",
106
- "peerDependencies": { "nx": "^22.4.2" },
106
+ "peerDependencies": { "nx": "^22.4.3" },
107
107
  "peerDependenciesMeta": { "nx": { "optional": true } },
108
108
  "dependencies": {
109
109
  "@antfu/install-pkg": "^1.1.0",
110
110
  "@ltd/j-toml": "^1.38.0",
111
111
  "@storm-software/config-tools": "^1.189.0",
112
- "@stryke/convert": "^0.6.37",
113
- "@stryke/helpers": "^0.9.39",
114
- "@stryke/path": "^0.26.2",
115
- "@stryke/string-format": "^0.13.6",
112
+ "@stryke/convert": "^0.6.38",
113
+ "@stryke/helpers": "^0.9.40",
114
+ "@stryke/path": "^0.26.4",
115
+ "@stryke/string-format": "^0.13.7",
116
116
  "chalk": "^5.6.2",
117
117
  "defu": "^6.1.4",
118
118
  "glob": "^11.1.0",
@@ -124,10 +124,10 @@
124
124
  "devDependencies": {
125
125
  "@types/node": "^24.10.9",
126
126
  "@types/semver": "^7.7.1",
127
- "nx": "^22.4.2",
127
+ "nx": "^22.4.3",
128
128
  "tinyexec": "^0.3.2",
129
129
  "tsdown": "^0.17.2"
130
130
  },
131
131
  "publishConfig": { "access": "public" },
132
- "gitHead": "e6880b328f3e8390a4ffd440c1bfc335de4e76c4"
132
+ "gitHead": "ae55e5a440fb5738c0b76220f291c84b287ef643"
133
133
  }