@stryke/path 0.4.7 → 0.4.9

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/README.md CHANGED
@@ -22,7 +22,7 @@ This package is part of Storm Software's **đŸŒŠī¸ Stryke** monorepo. Stryke pac
22
22
 
23
23
  <h3 align="center">đŸ’ģ Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
24
24
 
25
- [![Version](https://img.shields.io/badge/version-0.4.6-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/stryke/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
+ [![Version](https://img.shields.io/badge/version-0.4.7-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/stryke/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
26
26
 
27
27
  > [!IMPORTANT] This repository, and the apps, libraries, and tools contained
28
28
  > within, is still in it's initial development phase. As a result, bugs and
@@ -51,6 +51,7 @@ built-in \`path\` module
51
51
 
52
52
  <!-- START doctoc -->
53
53
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
54
+
54
55
  ## Table of Contents
55
56
 
56
57
  - [Installing](#installing)
@@ -20,24 +20,24 @@ var _correctPath = require("./correct-path.cjs");
20
20
  var _getWorkspaceRoot = require("./get-workspace-root.cjs");
21
21
  var _isFile = require("./is-file.cjs");
22
22
  var _joinPaths = require("./join-paths.cjs");
23
- function findFileName(n, {
24
- requireExtension: e,
23
+ function findFileName(e, {
24
+ requireExtension: n,
25
25
  withExtension: r
26
26
  } = {}) {
27
- const t = (0, _correctPath.normalizeWindowsPath)(n)?.split(n?.includes("\\") ? "\\" : "/")?.pop() ?? "";
28
- return e === !0 && !t.includes(".") ? _base.EMPTY_STRING : r === !1 && t.includes(".") ? t.split(".").slice(-1).join(".") || _base.EMPTY_STRING : t;
27
+ const t = (0, _correctPath.normalizeWindowsPath)(e)?.split(e?.includes("\\") ? "\\" : "/")?.pop() ?? "";
28
+ return n === !0 && !t.includes(".") ? _base.EMPTY_STRING : r === !1 && t.includes(".") ? t.split(".").slice(-1).join(".") || _base.EMPTY_STRING : t;
29
29
  }
30
- function findFilePath(n) {
31
- const e = (0, _correctPath.normalizeWindowsPath)(n);
32
- return e.replace(findFileName(e, {
30
+ function findFilePath(e) {
31
+ const n = (0, _correctPath.normalizeWindowsPath)(e);
32
+ return n.replace(findFileName(n, {
33
33
  requireExtension: !0
34
34
  }), "");
35
35
  }
36
- function findFolderName(n) {
37
- const e = findFilePath(n).split("/");
36
+ function findFolderName(e) {
37
+ const n = findFilePath(e).split("/");
38
38
  let r = "";
39
- for (let t = e.length - 1; t >= 0; t--) {
40
- const i = e[t];
39
+ for (let t = n.length - 1; t >= 0; t--) {
40
+ const i = n[t];
41
41
  if (i) {
42
42
  r = i;
43
43
  break;
@@ -45,33 +45,33 @@ function findFolderName(n) {
45
45
  }
46
46
  return r ?? _base.EMPTY_STRING;
47
47
  }
48
- function findFileExtension(n) {
49
- if (n === "..") return "";
50
- const e = /.(\.[^./]+|\.)$/.exec((0, _correctPath.normalizeWindowsPath)(n));
51
- return e && e[1] || _base.EMPTY_STRING;
48
+ function findFileExtension(e) {
49
+ if (e === "..") return "";
50
+ const n = /.(\.[^./]+|\.)$/.exec((0, _correctPath.normalizeWindowsPath)(e));
51
+ return n && n[1] || _base.EMPTY_STRING;
52
52
  }
53
- function hasFileName(n) {
54
- return !!findFileName(n);
53
+ function hasFileName(e) {
54
+ return !!findFileName(e);
55
55
  }
56
- function hasFilePath(n) {
57
- return !!findFilePath(n);
56
+ function hasFilePath(e) {
57
+ return !!findFilePath(e);
58
58
  }
59
- function resolvePath(n, e = (0, _getWorkspaceRoot.getWorkspaceRoot)()) {
60
- const r = (0, _correctPath.normalizeWindowsPath)(n).split("/");
59
+ function resolvePath(e, n = (0, _getWorkspaceRoot.getWorkspaceRoot)()) {
60
+ const r = (0, _correctPath.normalizeWindowsPath)(e).split("/");
61
61
  let t = "",
62
62
  i = !1;
63
63
  for (let o = r.length - 1; o >= -1 && !i; o--) {
64
- const s = o >= 0 ? r[o] : e;
64
+ const s = o >= 0 ? r[o] : n;
65
65
  !s || s.length === 0 || (t = (0, _joinPaths.joinPaths)(s, t), i = (0, _isFile.isAbsolutePath)(s));
66
66
  }
67
67
  return t = (0, _correctPath.normalizeString)(t, !i), i && !(0, _isFile.isAbsolutePath)(t) ? `/${t}` : t.length > 0 ? t : ".";
68
68
  }
69
- function resolvePaths(...n) {
70
- return resolvePath((0, _joinPaths.joinPaths)(...n.map(e => (0, _correctPath.normalizeWindowsPath)(e))));
69
+ function resolvePaths(...e) {
70
+ return resolvePath((0, _joinPaths.joinPaths)(...e.map(n => (0, _correctPath.normalizeWindowsPath)(n))));
71
71
  }
72
- function relativePath(n, e) {
73
- const r = resolvePath(n).replace(/^\/([A-Z]:)?$/i, "$1").split("/"),
74
- t = resolvePath(e).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
72
+ function relativePath(e, n) {
73
+ const r = resolvePath(e.replace(/\/$/, "")).replace(/^\/([A-Z]:)?$/i, "$1").split("/"),
74
+ t = resolvePath(n.replace(/\/$/, "")).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
75
75
  if (t[0][1] === ":" && r[0][1] === ":" && r[0] !== t[0]) return t.join("/");
76
76
  const i = [...r];
77
77
  for (const o of i) {
@@ -80,26 +80,26 @@ function relativePath(n, e) {
80
80
  }
81
81
  return [...r.map(() => ".."), ...t].join("/");
82
82
  }
83
- function relativeToWorkspaceRoot(n) {
84
- return relativePath(n, (0, _getWorkspaceRoot.getWorkspaceRoot)());
83
+ function relativeToWorkspaceRoot(e) {
84
+ return relativePath(e, (0, _getWorkspaceRoot.getWorkspaceRoot)());
85
85
  }
86
- function parsePath(n) {
87
- const e = /^[/\\]|^[a-z]:[/\\]/i.exec(n)?.[0]?.replace(/\\/g, "/") || "",
88
- r = (0, _correctPath.normalizeWindowsPath)(n),
86
+ function parsePath(e) {
87
+ const n = /^[/\\]|^[a-z]:[/\\]/i.exec(e)?.[0]?.replace(/\\/g, "/") || "",
88
+ r = (0, _correctPath.normalizeWindowsPath)(e),
89
89
  t = r.replace(/\/$/, "").split("/").slice(0, -1);
90
90
  t.length === 1 && /^[A-Z]:$/i.test(t[0]) && (t[0] += "/");
91
91
  const i = findFolderName(r),
92
- o = t.join("/") || ((0, _isFile.isAbsolutePath)(n) ? "/" : "."),
93
- s = findFileExtension(n);
92
+ o = t.join("/") || ((0, _isFile.isAbsolutePath)(e) ? "/" : "."),
93
+ s = findFileExtension(e);
94
94
  return {
95
- root: e,
95
+ root: n,
96
96
  dir: o,
97
97
  base: i,
98
98
  ext: s,
99
99
  name: i.slice(0, i.length - s.length)
100
100
  };
101
101
  }
102
- function renameFile(n, e) {
103
- const r = parsePath(n);
104
- return (0, _joinPaths.joinPaths)(r.dir, e.includes(".") ? e : e + r.ext);
102
+ function renameFile(e, n) {
103
+ const r = parsePath(e);
104
+ return (0, _joinPaths.joinPaths)(r.dir, n.includes(".") ? n : n + r.ext);
105
105
  }
@@ -1 +1 @@
1
- import{EMPTY_STRING as a}from"@stryke/types/base";import{normalizeString as p,normalizeWindowsPath as l}from"./correct-path";import{getWorkspaceRoot as f}from"./get-workspace-root";import{isAbsolutePath as c}from"./is-file";import{joinPaths as u}from"./join-paths";export function findFileName(n,{requireExtension:e,withExtension:r}={}){const t=l(n)?.split(n?.includes("\\")?"\\":"/")?.pop()??"";return e===!0&&!t.includes(".")?a:r===!1&&t.includes(".")?t.split(".").slice(-1).join(".")||a:t}export function findFilePath(n){const e=l(n);return e.replace(findFileName(e,{requireExtension:!0}),"")}export function findFolderName(n){const e=findFilePath(n).split("/");let r="";for(let t=e.length-1;t>=0;t--){const i=e[t];if(i){r=i;break}}return r??a}export function findFileExtension(n){if(n==="..")return"";const e=/.(\.[^./]+|\.)$/.exec(l(n));return e&&e[1]||a}export function hasFileName(n){return!!findFileName(n)}export function hasFilePath(n){return!!findFilePath(n)}export function resolvePath(n,e=f()){const r=l(n).split("/");let t="",i=!1;for(let o=r.length-1;o>=-1&&!i;o--){const s=o>=0?r[o]:e;!s||s.length===0||(t=u(s,t),i=c(s))}return t=p(t,!i),i&&!c(t)?`/${t}`:t.length>0?t:"."}export function resolvePaths(...n){return resolvePath(u(...n.map(e=>l(e))))}export function relativePath(n,e){const r=resolvePath(n).replace(/^\/([A-Z]:)?$/i,"$1").split("/"),t=resolvePath(e).replace(/^\/([A-Z]:)?$/i,"$1").split("/");if(t[0][1]===":"&&r[0][1]===":"&&r[0]!==t[0])return t.join("/");const i=[...r];for(const o of i){if(t[0]!==o)break;r.shift(),t.shift()}return[...r.map(()=>".."),...t].join("/")}export function relativeToWorkspaceRoot(n){return relativePath(n,f())}export function parsePath(n){const e=/^[/\\]|^[a-z]:[/\\]/i.exec(n)?.[0]?.replace(/\\/g,"/")||"",r=l(n),t=r.replace(/\/$/,"").split("/").slice(0,-1);t.length===1&&/^[A-Z]:$/i.test(t[0])&&(t[0]+="/");const i=findFolderName(r),o=t.join("/")||(c(n)?"/":"."),s=findFileExtension(n);return{root:e,dir:o,base:i,ext:s,name:i.slice(0,i.length-s.length)}}export function renameFile(n,e){const r=parsePath(n);return u(r.dir,e.includes(".")?e:e+r.ext)}
1
+ import{EMPTY_STRING as a}from"@stryke/types/base";import{normalizeString as f,normalizeWindowsPath as l}from"./correct-path";import{getWorkspaceRoot as u}from"./get-workspace-root";import{isAbsolutePath as c}from"./is-file";import{joinPaths as p}from"./join-paths";export function findFileName(e,{requireExtension:n,withExtension:r}={}){const t=l(e)?.split(e?.includes("\\")?"\\":"/")?.pop()??"";return n===!0&&!t.includes(".")?a:r===!1&&t.includes(".")?t.split(".").slice(-1).join(".")||a:t}export function findFilePath(e){const n=l(e);return n.replace(findFileName(n,{requireExtension:!0}),"")}export function findFolderName(e){const n=findFilePath(e).split("/");let r="";for(let t=n.length-1;t>=0;t--){const i=n[t];if(i){r=i;break}}return r??a}export function findFileExtension(e){if(e==="..")return"";const n=/.(\.[^./]+|\.)$/.exec(l(e));return n&&n[1]||a}export function hasFileName(e){return!!findFileName(e)}export function hasFilePath(e){return!!findFilePath(e)}export function resolvePath(e,n=u()){const r=l(e).split("/");let t="",i=!1;for(let o=r.length-1;o>=-1&&!i;o--){const s=o>=0?r[o]:n;!s||s.length===0||(t=p(s,t),i=c(s))}return t=f(t,!i),i&&!c(t)?`/${t}`:t.length>0?t:"."}export function resolvePaths(...e){return resolvePath(p(...e.map(n=>l(n))))}export function relativePath(e,n){const r=resolvePath(e.replace(/\/$/,"")).replace(/^\/([A-Z]:)?$/i,"$1").split("/"),t=resolvePath(n.replace(/\/$/,"")).replace(/^\/([A-Z]:)?$/i,"$1").split("/");if(t[0][1]===":"&&r[0][1]===":"&&r[0]!==t[0])return t.join("/");const i=[...r];for(const o of i){if(t[0]!==o)break;r.shift(),t.shift()}return[...r.map(()=>".."),...t].join("/")}export function relativeToWorkspaceRoot(e){return relativePath(e,u())}export function parsePath(e){const n=/^[/\\]|^[a-z]:[/\\]/i.exec(e)?.[0]?.replace(/\\/g,"/")||"",r=l(e),t=r.replace(/\/$/,"").split("/").slice(0,-1);t.length===1&&/^[A-Z]:$/i.test(t[0])&&(t[0]+="/");const i=findFolderName(r),o=t.join("/")||(c(e)?"/":"."),s=findFileExtension(e);return{root:n,dir:o,base:i,ext:s,name:i.slice(0,i.length-s.length)}}export function renameFile(e,n){const r=parsePath(e);return p(r.dir,n.includes(".")?n:n+r.ext)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/path",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "type": "module",
5
5
  "description": "A package containing various utilities that expand the functionality of NodeJs's built-in `path` module",
6
6
  "repository": {
@@ -9,12 +9,8 @@
9
9
  "directory": "packages/path"
10
10
  },
11
11
  "private": false,
12
- "dependencies": {
13
- "@storm-software/config-tools": "latest",
14
- "mlly": "1.7.4",
15
- "@stryke/types": ">=0.7.3"
16
- },
17
- "devDependencies": { "@stryke/types": "0.7.3", "@types/node": "^22.13.1" },
12
+ "dependencies": { "@storm-software/config-tools": "latest", "mlly": "1.7.4" },
13
+ "devDependencies": { "@stryke/types": "0.8.1", "@types/node": "^22.13.1" },
18
14
  "publishConfig": { "access": "public" },
19
15
  "sideEffects": false,
20
16
  "files": ["dist/**/*"],