{"mappings":"uQAqBO,SAASA,EAAKC,EAAcC,GAA4B,GAC7D,OAAIA,EACKC,EAASF,GAETE,EAASF,EAAMG,EAAQH,G,CCN3B,SAASI,EAAcJ,GAC5B,OAAOK,EAAUL,GAAMM,QAAYC,OAAUC,EAAaC,GAAhB,KAA0B,G,CCL/D,SAASC,EAAUC,EAAcC,EAAU,OAAQC,EAAY,IACpE,MAAyB,UAArBC,QAAQC,SACH,GAAGJ,IAAOC,IAEZ,GAAGD,IAAOE,G,CCFZ,SAASG,EAAchB,EAAciB,GAE1C,MAAMC,EAAMf,EAAQH,GAIdmB,EAAiB,GAAGF,IAHHf,EAASF,EAAMkB,KAGcA,IAGpD,OAAOE,EAAKC,EAAQrB,GAAOmB,E,CCPtB,SAASG,EAActB,EAAcuB,GAE1C,MAAML,EAAMf,EAAQH,GAIdwB,EAAiB,GAHAtB,EAASF,EAAMkB,KAGKK,IAASL,IAGpD,OAAOE,EAAKC,EAAQrB,GAAOwB,E,CCVtB,SAASC,EAASd,EAAcC,EAAU,OAAQC,EAAY,OACnE,MAAyB,UAArBC,QAAQC,SACH,GAAGJ,IAAOC,IAEZ,GAAGD,IAAOE,G,CCRZ,SAASa,EAAoB1B,GAClC,MAAyB,UAArBc,QAAQC,SACHf,EAEF,KAAKA,C,CCFP,SAAS2B,EAAU3B,GACxB,MAAM4B,EAAkBzB,EAAQH,GAAM6B,OACtC,OAAO7B,EAAK8B,MAAM,GAAIF,E,CCAjB,SAASG,EAAW/B,EAAcgC,GAEvC,OAAOC,EAAejC,EAAMgC,E,CCOvB,SAASE,EAAaC,EAAmBC,GAG9C,MAAMC,EAAWC,EAASF,EAAYD,GAEtC,SAAeE,GAAyB,OAAbA,GAAsBA,EAASE,WAAW,KAAK9B,IAAU4B,IAAaG,EAAQL,G","sources":["src/name.ts","src/normalize-trim.ts","src/add-exe-ext.ts","src/add-name-prefix.ts","src/add-name-suffix.ts","src/add-sh-ext.ts","src/add-sh-relative-prefix.ts","src/remove-ext.ts","src/replace-ext.ts","src/is-path-inside.ts"],"sourcesContent":["import { basename, extname } from \"path\"\n\n/**\n * Get the name of the given file path.\n *\n * By default the file extension is included in the returned name. To remove the extension, set the second parameter to `false`.\n *\n * @example\n *\n * ```js\n * import { name } from \"patha\"\n *\n * name(\"path/to/file.md\") // gives \"file.md\"\n *\n * name(\"path/to/file.md\", false) // gives \"file\"\n * ```\n *\n * @param path The given file path\n * @param includeExtension If the name should include the file extension as well\n * @returns The base name without the extension\n */\nexport function name(path: string, includeExtension: boolean = true) {\n  if (includeExtension) {\n    return basename(path)\n  } else {\n    return basename(path, extname(path))\n  }\n}\n","import { normalize, sep } from \"path\"\nimport escapeRegexp from \"escape-string-regexp\"\n\n/**\n * Normalizes the path and removes the trailing slashes.\n *\n * @example\n *\n * ```js\n * import { normalize, normalizeTrim } from \"patha\"\n *\n * normalizeTrim(\"/foo/bar//baz/asdf/hello/../\") // gives \"/foo/bar/baz/asdf\"\n *\n * normalize(\"/foo/bar//baz/asdf/hello/../\") // gives \"/foo/bar/baz/asdf/\"\n * ```\n *\n * @param path The given file path\n * @returns The normalized and trimmed file path\n */\nexport function normalizeTrim(path: string) {\n  return normalize(path).replace(new RegExp(`${escapeRegexp(sep)}$`), \"\")\n}\n","/**\n * Add bin extension to the given binary name.\n *\n * @example\n *\n * ```js\n * import { addExeExt } from \"patha\"\n *\n * addExeExt(\"path/to/file-name\") // gives \"path/to/file-name.exe\" on Windows and \"path/to/file-name\" on others\n * ```\n *\n * @param name The name you want to add the shell extension to\n * @param win_ext Defaults to `.exe` on Windows\n * @param other_ext Defaults to `\"\"` On other platforms.\n */\nexport function addExeExt(name: string, win_ext = \".exe\", other_ext = \"\") {\n  if (process.platform === \"win32\") {\n    return `${name}${win_ext}`\n  }\n  return `${name}${other_ext}`\n}\n","import { basename, dirname, extname, join } from \"path\"\n\n/**\n * Adds a prefix to the start of the name of the given path\n *\n * @example\n *\n * ```js\n * import { addNamePrefix } from \"patha\"\n *\n * addNamePrefix(\"path/to/file-name.ext\", \"new-\") // gives \"path/to/new-file-name.ext\"\n * ```\n *\n * @param path The given file path\n * @param prefix The prefix to add to the start of the file name\n * @returns The path with a prefix added to its file name\n */\nexport function addNamePrefix(path: string, prefix: string) {\n  // get the extension and the file name\n  const ext = extname(path)\n  const nameWithoutExt = basename(path, ext)\n\n  // add the name prefix\n  const NameWithPrefix = `${prefix}${nameWithoutExt}${ext}`\n\n  // add the dirname back\n  return join(dirname(path), NameWithPrefix)\n}\n","import { basename, dirname, extname, join } from \"path\"\n\n/**\n * Adds a suffix to the end of the name of the given path\n *\n * @example\n *\n * ```js\n * import { addNameSuffix } from \"patha\"\n *\n * addNameSuffix(\"path/to/file-name.ext\", \"-old\") // gives \"path/to/file-name-old.ext\"\n *\n * addNameSuffix(\"path/to/file-name.ext\", \".test\") // gives \"path/to/file-name.test.ext\"\n * ```\n *\n * @param path The given file path\n * @param suffix The suffix to add to the end of the file name\n * @returns The path with a suffix added to its file name\n */\nexport function addNameSuffix(path: string, suffix: string) {\n  // get the extension and the file name\n  const ext = extname(path)\n  const nameWithoutExt = basename(path, ext)\n\n  // add the name suffix\n  const NameWithSuffix = `${nameWithoutExt}${suffix}${ext}`\n\n  // add the dirname back\n  return join(dirname(path), NameWithSuffix)\n}\n","/**\n * Add a native shell extension to the given name.\n *\n * @example\n *\n * ```js\n * import { addShExt } from \"patha\"\n *\n * addShExt(\"path/to/file-name\") // gives \"path/to/file-name.cmd\" on Windows and \"path/to/file-name.sh\" on others\n *\n * addShExt(\"path/to/file-name\", \".bat\") // gives \"path/to/file-name.bat\" on Windows and \"path/to/file-name.sh\" on others\n * ```\n *\n * @param name The name you want to add the shell extension to\n * @param win_ext `.cmd` on Windows\n * @param other_ext `.sh` On others.\n * @returns The file path with the shell extension added\n */\nexport function addShExt(name: string, win_ext = \".cmd\", other_ext = \".sh\") {\n  if (process.platform === \"win32\") {\n    return `${name}${win_ext}`\n  }\n  return `${name}${other_ext}`\n}\n","/**\n * Prefix a `./` for unix shell and nothing for `cmd`.\n *\n * @example\n *\n * ```js\n * import { addShRelativePrefix } from \"patha\"\n *\n * addShRelativePrefix(\"some/file-name\") // gives \"some/file-name\" on Windows and \"./some/file-name\" on others.\n * ```\n *\n * @param path The given path\n * @returns The path with `./` added on Unix\n */\nexport function addShRelativePrefix(path: string) {\n  if (process.platform === \"win32\") {\n    return path\n  }\n  return `./${path}`\n}\n","import { extname } from \"path\"\n\n/**\n * Remove a path's extension.\n *\n * @example\n *\n * ```js\n * import { removeExt } from \"patha\"\n *\n * removeExt(\"some/dir/file.ext\") // gives \"some/dir/file\"\n * ```\n *\n * @param path The given path\n * @returns The path without its file extension\n */\nexport function removeExt(path: string) {\n  const extensionLength = extname(path).length\n  return path.slice(0, -extensionLength)\n}\n","import replaceExtOrig from \"replace-ext\"\n\n/**\n * Replaces the extension from path with extension and returns the updated path string.\n *\n * Does not replace the extension if path is not a string or is empty.\n *\n * @example\n *\n * ```js\n * import { replaceExt } from \"patha\"\n *\n * replaceExt(\"path/to/file.md\", \".html\") // gives \"path/to/file.html\"\n * ```\n *\n * @param path The given path\n * @param extension The extension to replace\n */\nexport function replaceExt(path: string, extension: string) {\n  // TODO replaceExt should not change `/` to `\\\\` on Windows\n  return replaceExtOrig(path, extension)\n}\n","import { relative, resolve, sep } from \"path\"\n\n/**\n * Check if a path is inside another path.\n *\n * Note that relative paths are resolved against `process.cwd()` to make them absolute.\n *\n * This function does not check if the paths exist and it only works with strings.\n *\n * @example\n *\n * ```js\n * import { isPathInside } from \"patha\"\n *\n * isPathInside(\"a/b/c\", \"a/b\")\n * //=> true\n *\n * isPathInside(\"a/b/c\", \"x/y\")\n * //=> false\n *\n * isPathInside(\"a/b/c\", \"a/b/c\")\n * //=> false\n *\n * isPathInside(\"/Users/some/dev/aa\", \"/Users/some\")\n * //=> true\n * ```\n */\nexport function isPathInside(childPath: string, parentPath: string): boolean {\n  // copied from is-path-inside because the package uses node:path that can't be bundled for the browser\n\n  const relation = relative(parentPath, childPath)\n\n  return Boolean(relation && relation !== \"..\" && !relation.startsWith(`..${sep}`) && relation !== resolve(childPath))\n}\n"],"names":["$ab8cbb9c91c3fc8d$export$a8ff84c12d48cfa6","path","includeExtension","$4284d296eeab76c6$re_export$basename","$4284d296eeab76c6$re_export$extname","$aa9824502803c937$export$873fead74fe2f1ff","$4284d296eeab76c6$re_export$normalize","replace","RegExp","$eGezC$escapestringregexp","$4284d296eeab76c6$re_export$sep","$8f024fa53a6107d5$export$2d20c564cade3c93","name","win_ext","other_ext","process","platform","$5d6f7d32fbf83c55$export$3e333f8cb13439c","prefix","ext","NameWithPrefix","$4284d296eeab76c6$re_export$join","$4284d296eeab76c6$re_export$dirname","$f979c20735ecc5ca$export$3b60a3e9bd1aef9d","suffix","NameWithSuffix","$f80cbc77bed8d4e7$export$609be29b80b555e1","$9e54c3cfd7ecda87$export$e1f23f8d3e53fe6","$8a9614e7829001cf$export$19c5468f88f6e968","extensionLength","length","slice","$a57074c9987ffe3b$export$e9c34737ac8e53d2","extension","$eGezC$replaceext","$fb939986c5760d03$export$7d0573375890d05c","childPath","parentPath","relation","$4284d296eeab76c6$re_export$relative","startsWith","$4284d296eeab76c6$re_export$resolve"],"version":3,"file":"index.node.mjs.map","sourceRoot":"../"}