@storm-software/config-tools 1.190.119 → 1.190.120

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.
Files changed (114) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +20 -1532
  3. package/bin/config.js +19 -1527
  4. package/dist/config-file/get-config-file.cjs +80 -25
  5. package/dist/config-file/get-config-file.js +79 -24
  6. package/dist/config-file/index.cjs +1 -29
  7. package/dist/config-file/index.js +1 -29
  8. package/dist/create-storm-config.cjs +138 -26
  9. package/dist/create-storm-config.js +140 -28
  10. package/dist/env/get-env.cjs +221 -6
  11. package/dist/env/get-env.js +221 -6
  12. package/dist/env/index.cjs +2 -18
  13. package/dist/env/index.js +2 -18
  14. package/dist/env/set-env.cjs +383 -8
  15. package/dist/env/set-env.js +382 -7
  16. package/dist/get-config.cjs +28 -27
  17. package/dist/get-config.js +29 -28
  18. package/dist/index.cjs +7 -201
  19. package/dist/index.js +7 -201
  20. package/dist/logger/chalk.cjs +32 -4
  21. package/dist/logger/chalk.js +31 -3
  22. package/dist/logger/console-icons.cjs +15 -6
  23. package/dist/logger/console-icons.js +14 -5
  24. package/dist/logger/console.cjs +191 -37
  25. package/dist/logger/console.js +176 -22
  26. package/dist/logger/create-logger.cjs +25 -12
  27. package/dist/logger/create-logger.js +24 -11
  28. package/dist/logger/format-timestamp.cjs +4 -4
  29. package/dist/logger/format-timestamp.js +3 -3
  30. package/dist/logger/get-log-level.cjs +60 -7
  31. package/dist/logger/get-log-level.js +59 -6
  32. package/dist/logger/index.cjs +7 -61
  33. package/dist/logger/index.js +7 -61
  34. package/dist/logger/is-unicode-supported.cjs +10 -4
  35. package/dist/logger/is-unicode-supported.js +9 -3
  36. package/dist/types.cjs +25 -5
  37. package/dist/types.js +24 -4
  38. package/dist/utilities/apply-workspace-tokens.cjs +72 -9
  39. package/dist/utilities/apply-workspace-tokens.js +71 -8
  40. package/dist/utilities/colors.cjs +76 -7
  41. package/dist/utilities/colors.js +75 -6
  42. package/dist/utilities/correct-paths.cjs +231 -32
  43. package/dist/utilities/correct-paths.js +215 -16
  44. package/dist/utilities/file-path-utils.cjs +29 -7
  45. package/dist/utilities/file-path-utils.js +28 -6
  46. package/dist/utilities/find-up.cjs +21 -4
  47. package/dist/utilities/find-up.js +20 -3
  48. package/dist/utilities/find-workspace-root.cjs +74 -7
  49. package/dist/utilities/find-workspace-root.js +73 -6
  50. package/dist/utilities/get-default-config.cjs +90 -6
  51. package/dist/utilities/get-default-config.js +90 -6
  52. package/dist/utilities/index.cjs +9 -109
  53. package/dist/utilities/index.js +9 -109
  54. package/dist/utilities/process-handler.cjs +46 -11
  55. package/dist/utilities/process-handler.js +47 -12
  56. package/dist/utilities/run.cjs +34 -6
  57. package/dist/utilities/run.js +33 -5
  58. package/dist/utilities/toml.cjs +42 -24
  59. package/dist/utilities/toml.js +35 -17
  60. package/package.json +4 -4
  61. package/dist/chunk-24B36RDB.cjs +0 -81
  62. package/dist/chunk-27N3QEX5.js +0 -40
  63. package/dist/chunk-2AVLCXLT.js +0 -0
  64. package/dist/chunk-2RLMTBVZ.js +0 -233
  65. package/dist/chunk-2WBD2G3E.cjs +0 -38
  66. package/dist/chunk-3COHMHPU.cjs +0 -1
  67. package/dist/chunk-4Q45WJYQ.js +0 -165
  68. package/dist/chunk-5C7PIENF.js +0 -92
  69. package/dist/chunk-5J2SS4QU.js +0 -83
  70. package/dist/chunk-65SWKEHV.cjs +0 -1
  71. package/dist/chunk-6Y623TCS.cjs +0 -40
  72. package/dist/chunk-7PV6L7I7.cjs +0 -1
  73. package/dist/chunk-7QBTVNMR.cjs +0 -30
  74. package/dist/chunk-BDATZ3UB.cjs +0 -233
  75. package/dist/chunk-BZRTSWH4.cjs +0 -395
  76. package/dist/chunk-D3FRXXDE.js +0 -947
  77. package/dist/chunk-DTGT4OI3.cjs +0 -14
  78. package/dist/chunk-EC2KPWRG.cjs +0 -24
  79. package/dist/chunk-EENQN6N2.js +0 -40
  80. package/dist/chunk-ENI4UUSK.cjs +0 -35
  81. package/dist/chunk-FJNXECWU.js +0 -395
  82. package/dist/chunk-FMDVBSP6.cjs +0 -83
  83. package/dist/chunk-G2MK47WL.js +0 -14
  84. package/dist/chunk-HFS7WJVW.js +0 -81
  85. package/dist/chunk-HVVJHTFS.js +0 -36
  86. package/dist/chunk-IWD6YQKX.cjs +0 -1
  87. package/dist/chunk-IWQRXQ4N.cjs +0 -84
  88. package/dist/chunk-JK4TT5IV.js +0 -35
  89. package/dist/chunk-JWLDCEBZ.cjs +0 -70
  90. package/dist/chunk-JZAYHDV3.js +0 -8
  91. package/dist/chunk-KSMN3HSC.js +0 -38
  92. package/dist/chunk-L6UNTUC4.js +0 -0
  93. package/dist/chunk-LOY6ICHZ.cjs +0 -36
  94. package/dist/chunk-MBG2FTBL.cjs +0 -47
  95. package/dist/chunk-MQG74XF7.js +0 -102
  96. package/dist/chunk-MSAQEGBK.cjs +0 -92
  97. package/dist/chunk-NJFLUTGH.cjs +0 -25
  98. package/dist/chunk-PCYB64MB.cjs +0 -40
  99. package/dist/chunk-RALMUN5C.js +0 -30
  100. package/dist/chunk-RRKB32OH.js +0 -0
  101. package/dist/chunk-RUKM6FCF.js +0 -25
  102. package/dist/chunk-SIW7AXUG.js +0 -56
  103. package/dist/chunk-SLICWTO2.cjs +0 -165
  104. package/dist/chunk-SO3FWVXC.js +0 -84
  105. package/dist/chunk-SXPH7ILL.js +0 -70
  106. package/dist/chunk-T7YISGRS.cjs +0 -102
  107. package/dist/chunk-TZZRLM5J.cjs +0 -947
  108. package/dist/chunk-UJ77IBHD.cjs +0 -233
  109. package/dist/chunk-UKGRDKIH.js +0 -0
  110. package/dist/chunk-V3GMJ4TX.js +0 -233
  111. package/dist/chunk-WQJYIPSL.cjs +0 -8
  112. package/dist/chunk-YBVOKYAM.cjs +0 -56
  113. package/dist/chunk-YX4736HU.js +0 -47
  114. package/dist/chunk-ZFNAUMQS.js +0 -24
@@ -1,32 +1,231 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
- var _chunkBDATZ3UBcjs = require('../chunk-BDATZ3UB.cjs');
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
- exports.basename = _chunkBDATZ3UBcjs.basename; exports.correctPaths = _chunkBDATZ3UBcjs.correctPaths; exports.dirname = _chunkBDATZ3UBcjs.dirname; exports.extname = _chunkBDATZ3UBcjs.extname; exports.format = _chunkBDATZ3UBcjs.format; exports.isAbsolute = _chunkBDATZ3UBcjs.isAbsolute; exports.joinPaths = _chunkBDATZ3UBcjs.joinPaths; exports.normalizeString = _chunkBDATZ3UBcjs.normalizeString; exports.normalizeWindowsPath = _chunkBDATZ3UBcjs.normalizeWindowsPath; exports.parse = _chunkBDATZ3UBcjs.parse; exports.relative = _chunkBDATZ3UBcjs.relative; exports.resolve = _chunkBDATZ3UBcjs.resolve; exports.sep = _chunkBDATZ3UBcjs.sep; exports.toNamespacedPath = _chunkBDATZ3UBcjs.toNamespacedPath;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
2
+ function normalizeWindowsPath(input = "") {
3
+ if (!input) {
4
+ return input;
5
+ }
6
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
7
+ }
8
+ const _UNC_REGEX = /^[/\\]{2}/;
9
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
10
+ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
11
+ const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
12
+ const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
13
+ const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
14
+ const sep = "/";
15
+ const correctPaths = function(path) {
16
+ if (!path || path.length === 0) {
17
+ return ".";
18
+ }
19
+ path = normalizeWindowsPath(path);
20
+ const isUNCPath = _optionalChain([path, 'optionalAccess', _ => _.match, 'call', _2 => _2(_UNC_REGEX)]);
21
+ const isPathAbsolute = isAbsolute(path);
22
+ const trailingSeparator = path[path.length - 1] === "/";
23
+ path = normalizeString(path, !isPathAbsolute);
24
+ if (path.length === 0) {
25
+ if (isPathAbsolute) {
26
+ return "/";
27
+ }
28
+ return trailingSeparator ? "./" : ".";
29
+ }
30
+ if (trailingSeparator) {
31
+ path += "/";
32
+ }
33
+ if (_DRIVE_LETTER_RE.test(path)) {
34
+ path += "/";
35
+ }
36
+ if (isUNCPath) {
37
+ if (!isPathAbsolute) {
38
+ return `//./${path}`;
39
+ }
40
+ return `//${path}`;
41
+ }
42
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
43
+ };
44
+ const joinPaths = function(...segments) {
45
+ let path = "";
46
+ for (const seg of segments) {
47
+ if (!seg) {
48
+ continue;
49
+ }
50
+ if (path.length > 0) {
51
+ const pathTrailing = path[path.length - 1] === "/";
52
+ const segLeading = seg[0] === "/";
53
+ const both = pathTrailing && segLeading;
54
+ if (both) {
55
+ path += seg.slice(1);
56
+ } else {
57
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
58
+ }
59
+ } else {
60
+ path += seg;
61
+ }
62
+ }
63
+ return correctPaths(path);
64
+ };
65
+ function cwd() {
66
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
67
+ return process.cwd().replace(/\\/g, "/");
68
+ }
69
+ return "/";
70
+ }
71
+ const resolve = function(...arguments_) {
72
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
73
+ let resolvedPath = "";
74
+ let resolvedAbsolute = false;
75
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
76
+ const path = index >= 0 ? arguments_[index] : cwd();
77
+ if (!path || path.length === 0) {
78
+ continue;
79
+ }
80
+ resolvedPath = `${path}/${resolvedPath}`;
81
+ resolvedAbsolute = isAbsolute(path);
82
+ }
83
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
84
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
85
+ return `/${resolvedPath}`;
86
+ }
87
+ return resolvedPath.length > 0 ? resolvedPath : ".";
88
+ };
89
+ function normalizeString(path, allowAboveRoot) {
90
+ let res = "";
91
+ let lastSegmentLength = 0;
92
+ let lastSlash = -1;
93
+ let dots = 0;
94
+ let char = null;
95
+ for (let index = 0; index <= path.length; ++index) {
96
+ if (index < path.length) {
97
+ char = path[index];
98
+ } else if (char === "/") {
99
+ break;
100
+ } else {
101
+ char = "/";
102
+ }
103
+ if (char === "/") {
104
+ if (lastSlash === index - 1 || dots === 1) {
105
+ } else if (dots === 2) {
106
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
107
+ if (res.length > 2) {
108
+ const lastSlashIndex = res.lastIndexOf("/");
109
+ if (lastSlashIndex === -1) {
110
+ res = "";
111
+ lastSegmentLength = 0;
112
+ } else {
113
+ res = res.slice(0, lastSlashIndex);
114
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
115
+ }
116
+ lastSlash = index;
117
+ dots = 0;
118
+ continue;
119
+ } else if (res.length > 0) {
120
+ res = "";
121
+ lastSegmentLength = 0;
122
+ lastSlash = index;
123
+ dots = 0;
124
+ continue;
125
+ }
126
+ }
127
+ if (allowAboveRoot) {
128
+ res += res.length > 0 ? "/.." : "..";
129
+ lastSegmentLength = 2;
130
+ }
131
+ } else {
132
+ if (res.length > 0) {
133
+ res += `/${path.slice(lastSlash + 1, index)}`;
134
+ } else {
135
+ res = path.slice(lastSlash + 1, index);
136
+ }
137
+ lastSegmentLength = index - lastSlash - 1;
138
+ }
139
+ lastSlash = index;
140
+ dots = 0;
141
+ } else if (char === "." && dots !== -1) {
142
+ ++dots;
143
+ } else {
144
+ dots = -1;
145
+ }
146
+ }
147
+ return res;
148
+ }
149
+ const isAbsolute = function(p) {
150
+ return _IS_ABSOLUTE_RE.test(p);
151
+ };
152
+ const toNamespacedPath = function(p) {
153
+ return normalizeWindowsPath(p);
154
+ };
155
+ const extname = function(p) {
156
+ if (p === "..") return "";
157
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
158
+ return match && match[1] || "";
159
+ };
160
+ const relative = function(from, to) {
161
+ const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
162
+ const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
163
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
164
+ return _to.join("/");
165
+ }
166
+ const _fromCopy = [..._from];
167
+ for (const segment of _fromCopy) {
168
+ if (_to[0] !== segment) {
169
+ break;
170
+ }
171
+ _from.shift();
172
+ _to.shift();
173
+ }
174
+ return [..._from.map(() => ".."), ..._to].join("/");
175
+ };
176
+ const dirname = function(p) {
177
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
178
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
179
+ segments[0] += "/";
180
+ }
181
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
182
+ };
183
+ const format = function(p) {
184
+ const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
185
+ const segments = [p.root, p.dir, _nullishCoalesce(p.base, () => ( (_nullishCoalesce(p.name, () => ( ""))) + ext))].filter(
186
+ Boolean
187
+ );
188
+ return normalizeWindowsPath(
189
+ p.root ? resolve(...segments) : segments.join("/")
190
+ );
191
+ };
192
+ const basename = function(p, extension) {
193
+ const segments = normalizeWindowsPath(p).split("/");
194
+ let lastSegment = "";
195
+ for (let i = segments.length - 1; i >= 0; i--) {
196
+ const val = segments[i];
197
+ if (val) {
198
+ lastSegment = val;
199
+ break;
200
+ }
201
+ }
202
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
203
+ };
204
+ const parse = function(p) {
205
+ const root = _optionalChain([_PATH_ROOT_RE, 'access', _3 => _3.exec, 'call', _4 => _4(p), 'optionalAccess', _5 => _5[0], 'optionalAccess', _6 => _6.replace, 'call', _7 => _7(/\\/g, "/")]) || "";
206
+ const base = basename(p);
207
+ const extension = extname(base);
208
+ return {
209
+ root,
210
+ dir: dirname(p),
211
+ base,
212
+ ext: extension,
213
+ name: base.slice(0, base.length - extension.length)
214
+ };
215
+ };
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+ exports.basename = basename; exports.correctPaths = correctPaths; exports.dirname = dirname; exports.extname = extname; exports.format = format; exports.isAbsolute = isAbsolute; exports.joinPaths = joinPaths; exports.normalizeString = normalizeString; exports.normalizeWindowsPath = normalizeWindowsPath; exports.parse = parse; exports.relative = relative; exports.resolve = resolve; exports.sep = sep; exports.toNamespacedPath = toNamespacedPath;
@@ -1,19 +1,218 @@
1
- import {
2
- basename,
3
- correctPaths,
4
- dirname,
5
- extname,
6
- format,
7
- isAbsolute,
8
- joinPaths,
9
- normalizeString,
10
- normalizeWindowsPath,
11
- parse,
12
- relative,
13
- resolve,
14
- sep,
15
- toNamespacedPath
16
- } from "../chunk-V3GMJ4TX.js";
1
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
2
+ function normalizeWindowsPath(input = "") {
3
+ if (!input) {
4
+ return input;
5
+ }
6
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
7
+ }
8
+ const _UNC_REGEX = /^[/\\]{2}/;
9
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
10
+ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
11
+ const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
12
+ const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
13
+ const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
14
+ const sep = "/";
15
+ const correctPaths = function(path) {
16
+ if (!path || path.length === 0) {
17
+ return ".";
18
+ }
19
+ path = normalizeWindowsPath(path);
20
+ const isUNCPath = path?.match(_UNC_REGEX);
21
+ const isPathAbsolute = isAbsolute(path);
22
+ const trailingSeparator = path[path.length - 1] === "/";
23
+ path = normalizeString(path, !isPathAbsolute);
24
+ if (path.length === 0) {
25
+ if (isPathAbsolute) {
26
+ return "/";
27
+ }
28
+ return trailingSeparator ? "./" : ".";
29
+ }
30
+ if (trailingSeparator) {
31
+ path += "/";
32
+ }
33
+ if (_DRIVE_LETTER_RE.test(path)) {
34
+ path += "/";
35
+ }
36
+ if (isUNCPath) {
37
+ if (!isPathAbsolute) {
38
+ return `//./${path}`;
39
+ }
40
+ return `//${path}`;
41
+ }
42
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
43
+ };
44
+ const joinPaths = function(...segments) {
45
+ let path = "";
46
+ for (const seg of segments) {
47
+ if (!seg) {
48
+ continue;
49
+ }
50
+ if (path.length > 0) {
51
+ const pathTrailing = path[path.length - 1] === "/";
52
+ const segLeading = seg[0] === "/";
53
+ const both = pathTrailing && segLeading;
54
+ if (both) {
55
+ path += seg.slice(1);
56
+ } else {
57
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
58
+ }
59
+ } else {
60
+ path += seg;
61
+ }
62
+ }
63
+ return correctPaths(path);
64
+ };
65
+ function cwd() {
66
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
67
+ return process.cwd().replace(/\\/g, "/");
68
+ }
69
+ return "/";
70
+ }
71
+ const resolve = function(...arguments_) {
72
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
73
+ let resolvedPath = "";
74
+ let resolvedAbsolute = false;
75
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
76
+ const path = index >= 0 ? arguments_[index] : cwd();
77
+ if (!path || path.length === 0) {
78
+ continue;
79
+ }
80
+ resolvedPath = `${path}/${resolvedPath}`;
81
+ resolvedAbsolute = isAbsolute(path);
82
+ }
83
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
84
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
85
+ return `/${resolvedPath}`;
86
+ }
87
+ return resolvedPath.length > 0 ? resolvedPath : ".";
88
+ };
89
+ function normalizeString(path, allowAboveRoot) {
90
+ let res = "";
91
+ let lastSegmentLength = 0;
92
+ let lastSlash = -1;
93
+ let dots = 0;
94
+ let char = null;
95
+ for (let index = 0; index <= path.length; ++index) {
96
+ if (index < path.length) {
97
+ char = path[index];
98
+ } else if (char === "/") {
99
+ break;
100
+ } else {
101
+ char = "/";
102
+ }
103
+ if (char === "/") {
104
+ if (lastSlash === index - 1 || dots === 1) {
105
+ } else if (dots === 2) {
106
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
107
+ if (res.length > 2) {
108
+ const lastSlashIndex = res.lastIndexOf("/");
109
+ if (lastSlashIndex === -1) {
110
+ res = "";
111
+ lastSegmentLength = 0;
112
+ } else {
113
+ res = res.slice(0, lastSlashIndex);
114
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
115
+ }
116
+ lastSlash = index;
117
+ dots = 0;
118
+ continue;
119
+ } else if (res.length > 0) {
120
+ res = "";
121
+ lastSegmentLength = 0;
122
+ lastSlash = index;
123
+ dots = 0;
124
+ continue;
125
+ }
126
+ }
127
+ if (allowAboveRoot) {
128
+ res += res.length > 0 ? "/.." : "..";
129
+ lastSegmentLength = 2;
130
+ }
131
+ } else {
132
+ if (res.length > 0) {
133
+ res += `/${path.slice(lastSlash + 1, index)}`;
134
+ } else {
135
+ res = path.slice(lastSlash + 1, index);
136
+ }
137
+ lastSegmentLength = index - lastSlash - 1;
138
+ }
139
+ lastSlash = index;
140
+ dots = 0;
141
+ } else if (char === "." && dots !== -1) {
142
+ ++dots;
143
+ } else {
144
+ dots = -1;
145
+ }
146
+ }
147
+ return res;
148
+ }
149
+ const isAbsolute = function(p) {
150
+ return _IS_ABSOLUTE_RE.test(p);
151
+ };
152
+ const toNamespacedPath = function(p) {
153
+ return normalizeWindowsPath(p);
154
+ };
155
+ const extname = function(p) {
156
+ if (p === "..") return "";
157
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
158
+ return match && match[1] || "";
159
+ };
160
+ const relative = function(from, to) {
161
+ const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
162
+ const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
163
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
164
+ return _to.join("/");
165
+ }
166
+ const _fromCopy = [..._from];
167
+ for (const segment of _fromCopy) {
168
+ if (_to[0] !== segment) {
169
+ break;
170
+ }
171
+ _from.shift();
172
+ _to.shift();
173
+ }
174
+ return [..._from.map(() => ".."), ..._to].join("/");
175
+ };
176
+ const dirname = function(p) {
177
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
178
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
179
+ segments[0] += "/";
180
+ }
181
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
182
+ };
183
+ const format = function(p) {
184
+ const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
185
+ const segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
186
+ Boolean
187
+ );
188
+ return normalizeWindowsPath(
189
+ p.root ? resolve(...segments) : segments.join("/")
190
+ );
191
+ };
192
+ const basename = function(p, extension) {
193
+ const segments = normalizeWindowsPath(p).split("/");
194
+ let lastSegment = "";
195
+ for (let i = segments.length - 1; i >= 0; i--) {
196
+ const val = segments[i];
197
+ if (val) {
198
+ lastSegment = val;
199
+ break;
200
+ }
201
+ }
202
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
203
+ };
204
+ const parse = function(p) {
205
+ const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
206
+ const base = basename(p);
207
+ const extension = extname(base);
208
+ return {
209
+ root,
210
+ dir: dirname(p),
211
+ base,
212
+ ext: extension,
213
+ name: base.slice(0, base.length - extension.length)
214
+ };
215
+ };
17
216
  export {
18
217
  basename,
19
218
  correctPaths,
@@ -1,11 +1,33 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _correctpaths = require('./correct-paths');
2
+ const removeExtension = (filePath) => {
3
+ const result = !filePath || (_optionalChain([filePath, 'optionalAccess', _ => _.match, 'call', _2 => _2(/./g)]) || []).length <= 1 ? "." : filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
4
+ if (result.startsWith("./")) {
5
+ return result.substring(2);
6
+ }
7
+ if (result.startsWith(".") || result.startsWith("/")) {
8
+ return result.substring(1);
9
+ }
10
+ return result;
11
+ };
12
+ function findFileName(filePath, { requireExtension, withExtension } = {}) {
13
+ const result = _nullishCoalesce(_optionalChain([_correctpaths.normalizeWindowsPath.call(void 0, filePath), 'optionalAccess', _3 => _3.split, 'call', _4 => _4(_optionalChain([filePath, 'optionalAccess', _5 => _5.includes, 'call', _6 => _6("\\")]) ? "\\" : "/"), 'optionalAccess', _7 => _7.pop, 'call', _8 => _8()]), () => ( ""));
14
+ if (requireExtension === true && !result.includes(".")) {
15
+ return "";
16
+ }
17
+ if (withExtension === false && result.includes(".")) {
18
+ return result.split(".").slice(-1).join(".") || "";
19
+ }
20
+ return result;
21
+ }
22
+ function findFilePath(filePath) {
23
+ const normalizedPath = _correctpaths.normalizeWindowsPath.call(void 0, filePath);
24
+ return normalizedPath.replace(
25
+ findFileName(normalizedPath, { requireExtension: true }),
26
+ ""
27
+ );
28
+ }
2
29
 
3
30
 
4
31
 
5
- var _chunk2WBD2G3Ecjs = require('../chunk-2WBD2G3E.cjs');
6
- require('../chunk-BDATZ3UB.cjs');
7
32
 
8
-
9
-
10
-
11
- exports.findFileName = _chunk2WBD2G3Ecjs.findFileName; exports.findFilePath = _chunk2WBD2G3Ecjs.findFilePath; exports.removeExtension = _chunk2WBD2G3Ecjs.removeExtension;
33
+ exports.findFileName = findFileName; exports.findFilePath = findFilePath; exports.removeExtension = removeExtension;
@@ -1,9 +1,31 @@
1
- import {
2
- findFileName,
3
- findFilePath,
4
- removeExtension
5
- } from "../chunk-KSMN3HSC.js";
6
- import "../chunk-V3GMJ4TX.js";
1
+ import { normalizeWindowsPath } from "./correct-paths";
2
+ const removeExtension = (filePath) => {
3
+ const result = !filePath || (filePath?.match(/./g) || []).length <= 1 ? "." : filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
4
+ if (result.startsWith("./")) {
5
+ return result.substring(2);
6
+ }
7
+ if (result.startsWith(".") || result.startsWith("/")) {
8
+ return result.substring(1);
9
+ }
10
+ return result;
11
+ };
12
+ function findFileName(filePath, { requireExtension, withExtension } = {}) {
13
+ const result = normalizeWindowsPath(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
14
+ if (requireExtension === true && !result.includes(".")) {
15
+ return "";
16
+ }
17
+ if (withExtension === false && result.includes(".")) {
18
+ return result.split(".").slice(-1).join(".") || "";
19
+ }
20
+ return result;
21
+ }
22
+ function findFilePath(filePath) {
23
+ const normalizedPath = normalizeWindowsPath(filePath);
24
+ return normalizedPath.replace(
25
+ findFileName(normalizedPath, { requireExtension: true }),
26
+ ""
27
+ );
28
+ }
7
29
  export {
8
30
  findFileName,
9
31
  findFilePath,
@@ -1,6 +1,23 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _nodefs = require('node:fs');
2
+ var _nodepath = require('node:path');
3
+ const MAX_PATH_SEARCH_DEPTH = 30;
4
+ let depth = 0;
5
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
6
+ const _startPath = _nullishCoalesce(startPath, () => ( process.cwd()));
7
+ if (endDirectoryNames.some(
8
+ (endDirName) => _nodefs.existsSync.call(void 0, _nodepath.join.call(void 0, _startPath, endDirName))
9
+ )) {
10
+ return _startPath;
11
+ }
12
+ if (endFileNames.some((endFileName) => _nodefs.existsSync.call(void 0, _nodepath.join.call(void 0, _startPath, endFileName)))) {
13
+ return _startPath;
14
+ }
15
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
16
+ const parent = _nodepath.join.call(void 0, _startPath, "..");
17
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
18
+ }
19
+ return void 0;
20
+ }
2
21
 
3
- var _chunkNJFLUTGHcjs = require('../chunk-NJFLUTGH.cjs');
4
22
 
5
-
6
- exports.findFolderUp = _chunkNJFLUTGHcjs.findFolderUp;
23
+ exports.findFolderUp = findFolderUp;
@@ -1,6 +1,23 @@
1
- import {
2
- findFolderUp
3
- } from "../chunk-RUKM6FCF.js";
1
+ import { existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ const MAX_PATH_SEARCH_DEPTH = 30;
4
+ let depth = 0;
5
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
6
+ const _startPath = startPath ?? process.cwd();
7
+ if (endDirectoryNames.some(
8
+ (endDirName) => existsSync(join(_startPath, endDirName))
9
+ )) {
10
+ return _startPath;
11
+ }
12
+ if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
13
+ return _startPath;
14
+ }
15
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
16
+ const parent = join(_startPath, "..");
17
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
18
+ }
19
+ return void 0;
20
+ }
4
21
  export {
5
22
  findFolderUp
6
23
  };