@duplojs/lang 0.0.1-beta.4 → 0.0.1-beta.5

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 (87) hide show
  1. package/dist/array/index.cjs +0 -3
  2. package/dist/array/index.d.ts +0 -1
  3. package/dist/array/index.mjs +1 -3
  4. package/dist/common/constraint/cast/number.d.ts +15 -0
  5. package/dist/common/constraint/cast/string.d.ts +9 -0
  6. package/dist/common/constraint/index.d.ts +1 -0
  7. package/dist/common/constraint/infer/array.d.ts +7 -0
  8. package/dist/{array/infer.cjs → common/constraint/infer/index.cjs} +1 -1
  9. package/dist/common/constraint/infer/index.d.ts +26 -0
  10. package/dist/{string/infer.mjs → common/constraint/infer/index.mjs} +1 -1
  11. package/dist/common/constraint/infer/number.d.ts +11 -0
  12. package/dist/common/constraint/infer/string.d.ts +10 -0
  13. package/dist/common/index.cjs +3 -0
  14. package/dist/common/index.mjs +3 -1
  15. package/dist/dataStructure/constraint/defaults/absolutePath.cjs +13 -0
  16. package/dist/dataStructure/constraint/defaults/absolutePath.d.ts +10 -0
  17. package/dist/dataStructure/constraint/defaults/absolutePath.mjs +12 -0
  18. package/dist/dataStructure/constraint/defaults/index.d.ts +2 -0
  19. package/dist/dataStructure/constraint/defaults/path.cjs +13 -0
  20. package/dist/dataStructure/constraint/defaults/path.d.ts +10 -0
  21. package/dist/dataStructure/constraint/defaults/path.mjs +12 -0
  22. package/dist/dataStructure/constraint/types/constraints.d.ts +2 -0
  23. package/dist/dataStructure/helpers/absolutePath.cjs +7 -0
  24. package/dist/dataStructure/helpers/absolutePath.d.ts +2 -0
  25. package/dist/dataStructure/helpers/absolutePath.mjs +7 -0
  26. package/dist/dataStructure/helpers/index.d.ts +2 -0
  27. package/dist/dataStructure/helpers/path.cjs +7 -0
  28. package/dist/dataStructure/helpers/path.d.ts +2 -0
  29. package/dist/dataStructure/helpers/path.mjs +7 -0
  30. package/dist/dataStructure/index.cjs +16 -0
  31. package/dist/dataStructure/index.mjs +11 -1
  32. package/dist/index.cjs +41 -39
  33. package/dist/index.mjs +3 -2
  34. package/dist/number/index.cjs +0 -3
  35. package/dist/number/index.d.ts +0 -1
  36. package/dist/number/index.mjs +1 -3
  37. package/dist/path/computeRelative.cjs +5 -6
  38. package/dist/path/computeRelative.d.ts +1 -1
  39. package/dist/path/computeRelative.mjs +5 -6
  40. package/dist/path/constraints/absolute.d.ts +1 -1
  41. package/dist/path/getBaseName.cjs +5 -7
  42. package/dist/path/getBaseName.d.ts +2 -2
  43. package/dist/path/getBaseName.mjs +5 -7
  44. package/dist/path/getExtensionName.cjs +7 -4
  45. package/dist/path/getExtensionName.d.ts +2 -2
  46. package/dist/path/getExtensionName.mjs +7 -4
  47. package/dist/path/getParentFolderPath.cjs +5 -4
  48. package/dist/path/getParentFolderPath.d.ts +1 -2
  49. package/dist/path/getParentFolderPath.mjs +5 -4
  50. package/dist/path/index.cjs +3 -3
  51. package/dist/path/index.d.ts +2 -2
  52. package/dist/path/index.mjs +3 -3
  53. package/dist/path/is.cjs +9 -4
  54. package/dist/path/is.d.ts +4 -2
  55. package/dist/path/is.mjs +9 -4
  56. package/dist/path/isAbsolute.cjs +3 -5
  57. package/dist/path/isAbsolute.d.ts +4 -2
  58. package/dist/path/isAbsolute.mjs +3 -5
  59. package/dist/path/normalize.cjs +18 -0
  60. package/dist/path/normalize.d.ts +2 -0
  61. package/dist/path/normalize.mjs +18 -0
  62. package/dist/path/resolveFrom.cjs +4 -5
  63. package/dist/path/resolveFrom.d.ts +9 -1
  64. package/dist/path/resolveFrom.mjs +4 -5
  65. package/dist/path/resolveRelative.cjs +17 -20
  66. package/dist/path/resolveRelative.d.ts +9 -2
  67. package/dist/path/resolveRelative.mjs +17 -20
  68. package/dist/path/types/index.d.ts +4 -0
  69. package/dist/path/types/isLiteralAbsolutePath.d.ts +2 -0
  70. package/dist/path/types/isLiteralPath.d.ts +20 -0
  71. package/dist/path/types/requireLiteralAbsolutePath.d.ts +3 -0
  72. package/dist/path/types/requireLiteralPath.d.ts +3 -0
  73. package/dist/string/index.cjs +0 -3
  74. package/dist/string/index.d.ts +0 -1
  75. package/dist/string/index.mjs +1 -3
  76. package/dist/string/types/split.d.ts +1 -1
  77. package/package.json +1 -1
  78. package/dist/array/infer.d.ts +0 -14
  79. package/dist/array/infer.mjs +0 -6
  80. package/dist/number/infer.cjs +0 -6
  81. package/dist/number/infer.d.ts +0 -12
  82. package/dist/number/infer.mjs +0 -6
  83. package/dist/path/fix.cjs +0 -8
  84. package/dist/path/fix.d.ts +0 -1
  85. package/dist/path/fix.mjs +0 -8
  86. package/dist/string/infer.cjs +0 -6
  87. package/dist/string/infer.d.ts +0 -12
package/dist/index.cjs CHANGED
@@ -15,6 +15,7 @@ const require_callThen = require("./common/callThen.cjs");
15
15
  const require_index$1 = require("./object/index.cjs");
16
16
  const require_clone = require("./common/clone.cjs");
17
17
  const require_index$2 = require("./common/constraint/cast/index.cjs");
18
+ const require_index$3 = require("./common/constraint/infer/index.cjs");
18
19
  const require_remove = require("./common/constraint/remove.cjs");
19
20
  const require_detachObjectMethod = require("./common/detachObjectMethod.cjs");
20
21
  const require_enum = require("./common/enum.cjs");
@@ -22,10 +23,10 @@ const require_equal = require("./common/equal.cjs");
22
23
  const require_escapeRegExp = require("./common/escapeRegExp.cjs");
23
24
  const require_externalPromise = require("./common/externalPromise.cjs");
24
25
  const require_falsy = require("./common/falsy.cjs");
25
- const require_index$3 = require("./array/index.cjs");
26
- const require_index$4 = require("./generator/index.cjs");
27
- const require_index$5 = require("./either/index.cjs");
28
- const require_index$6 = require("./chrono/index.cjs");
26
+ const require_index$4 = require("./array/index.cjs");
27
+ const require_index$5 = require("./generator/index.cjs");
28
+ const require_index$6 = require("./either/index.cjs");
29
+ const require_index$7 = require("./chrono/index.cjs");
29
30
  const require_formData = require("./common/formData.cjs");
30
31
  const require_forward = require("./common/forward.cjs");
31
32
  const require_forwardAsserts = require("./common/forwardAsserts.cjs");
@@ -50,7 +51,7 @@ const require_promiseAll = require("./common/promiseAll.cjs");
50
51
  const require_promiseObject = require("./common/promiseObject.cjs");
51
52
  const require_queue = require("./common/queue.cjs");
52
53
  const require_simpleClone = require("./common/simpleClone.cjs");
53
- const require_index$7 = require("./string/index.cjs");
54
+ const require_index$8 = require("./string/index.cjs");
54
55
  const require_stringToBytes = require("./common/stringToBytes.cjs");
55
56
  const require_stringToMillisecond = require("./common/stringToMillisecond.cjs");
56
57
  const require_toCurriedPredicate = require("./common/toCurriedPredicate.cjs");
@@ -60,68 +61,68 @@ const require_truthy = require("./common/truthy.cjs");
60
61
  const require_when = require("./common/when.cjs");
61
62
  const require_whenElse = require("./common/whenElse.cjs");
62
63
  const require_whenNot = require("./common/whenNot.cjs");
63
- const require_index$8 = require("./common/index.cjs");
64
- const require_index$9 = require("./number/index.cjs");
65
- const require_index$10 = require("./dataStructure/index.cjs");
66
- const require_index$11 = require("./tuple/index.cjs");
67
- const require_index$12 = require("./modeling/index.cjs");
68
- const require_index$13 = require("./pattern/index.cjs");
69
- const require_index$14 = require("./invocation/index.cjs");
70
- const require_index$15 = require("./path/index.cjs");
71
- const require_index$16 = require("./printer/index.cjs");
64
+ const require_index$9 = require("./common/index.cjs");
65
+ const require_index$10 = require("./path/index.cjs");
66
+ const require_index$11 = require("./number/index.cjs");
67
+ const require_index$12 = require("./dataStructure/index.cjs");
68
+ const require_index$13 = require("./tuple/index.cjs");
69
+ const require_index$14 = require("./modeling/index.cjs");
70
+ const require_index$15 = require("./pattern/index.cjs");
71
+ const require_index$16 = require("./invocation/index.cjs");
72
+ const require_index$17 = require("./printer/index.cjs");
72
73
  Object.defineProperty(exports, "A", {
73
74
  enumerable: true,
74
75
  get: function() {
75
- return require_index$3.array_exports;
76
+ return require_index$4.array_exports;
76
77
  }
77
78
  });
78
79
  exports.AssertsError = require_asserts.AssertsError;
79
80
  Object.defineProperty(exports, "C", {
80
81
  enumerable: true,
81
82
  get: function() {
82
- return require_index$6.chrono_exports;
83
+ return require_index$7.chrono_exports;
83
84
  }
84
85
  });
85
86
  Object.defineProperty(exports, "DArray", {
86
87
  enumerable: true,
87
88
  get: function() {
88
- return require_index$3.array_exports;
89
+ return require_index$4.array_exports;
89
90
  }
90
91
  });
91
92
  Object.defineProperty(exports, "DChrono", {
92
93
  enumerable: true,
93
94
  get: function() {
94
- return require_index$6.chrono_exports;
95
+ return require_index$7.chrono_exports;
95
96
  }
96
97
  });
97
98
  Object.defineProperty(exports, "DCommon", {
98
99
  enumerable: true,
99
100
  get: function() {
100
- return require_index$8.common_exports;
101
+ return require_index$9.common_exports;
101
102
  }
102
103
  });
103
104
  Object.defineProperty(exports, "DDataStructure", {
104
105
  enumerable: true,
105
106
  get: function() {
106
- return require_index$10.dataStructure_exports;
107
+ return require_index$12.dataStructure_exports;
107
108
  }
108
109
  });
109
110
  Object.defineProperty(exports, "DEither", {
110
111
  enumerable: true,
111
112
  get: function() {
112
- return require_index$5.either_exports;
113
+ return require_index$6.either_exports;
113
114
  }
114
115
  });
115
116
  Object.defineProperty(exports, "DGenerator", {
116
117
  enumerable: true,
117
118
  get: function() {
118
- return require_index$4.generator_exports;
119
+ return require_index$5.generator_exports;
119
120
  }
120
121
  });
121
122
  Object.defineProperty(exports, "DInvocation", {
122
123
  enumerable: true,
123
124
  get: function() {
124
- return require_index$14.invocation_exports;
125
+ return require_index$16.invocation_exports;
125
126
  }
126
127
  });
127
128
  Object.defineProperty(exports, "DKind", {
@@ -133,13 +134,13 @@ Object.defineProperty(exports, "DKind", {
133
134
  Object.defineProperty(exports, "DModeling", {
134
135
  enumerable: true,
135
136
  get: function() {
136
- return require_index$12.modeling_exports;
137
+ return require_index$14.modeling_exports;
137
138
  }
138
139
  });
139
140
  Object.defineProperty(exports, "DNumber", {
140
141
  enumerable: true,
141
142
  get: function() {
142
- return require_index$9.number_exports;
143
+ return require_index$11.number_exports;
143
144
  }
144
145
  });
145
146
  Object.defineProperty(exports, "DObject", {
@@ -151,55 +152,55 @@ Object.defineProperty(exports, "DObject", {
151
152
  Object.defineProperty(exports, "DPath", {
152
153
  enumerable: true,
153
154
  get: function() {
154
- return require_index$15.path_exports;
155
+ return require_index$10.path_exports;
155
156
  }
156
157
  });
157
158
  Object.defineProperty(exports, "DPattern", {
158
159
  enumerable: true,
159
160
  get: function() {
160
- return require_index$13.pattern_exports;
161
+ return require_index$15.pattern_exports;
161
162
  }
162
163
  });
163
164
  Object.defineProperty(exports, "DPrinter", {
164
165
  enumerable: true,
165
166
  get: function() {
166
- return require_index$16.printer_exports;
167
+ return require_index$17.printer_exports;
167
168
  }
168
169
  });
169
170
  Object.defineProperty(exports, "DS", {
170
171
  enumerable: true,
171
172
  get: function() {
172
- return require_index$10.dataStructure_exports;
173
+ return require_index$12.dataStructure_exports;
173
174
  }
174
175
  });
175
176
  Object.defineProperty(exports, "DString", {
176
177
  enumerable: true,
177
178
  get: function() {
178
- return require_index$7.string_exports;
179
+ return require_index$8.string_exports;
179
180
  }
180
181
  });
181
182
  Object.defineProperty(exports, "DTuple", {
182
183
  enumerable: true,
183
184
  get: function() {
184
- return require_index$11.tuple_exports;
185
+ return require_index$13.tuple_exports;
185
186
  }
186
187
  });
187
188
  Object.defineProperty(exports, "E", {
188
189
  enumerable: true,
189
190
  get: function() {
190
- return require_index$5.either_exports;
191
+ return require_index$6.either_exports;
191
192
  }
192
193
  });
193
194
  Object.defineProperty(exports, "G", {
194
195
  enumerable: true,
195
196
  get: function() {
196
- return require_index$4.generator_exports;
197
+ return require_index$5.generator_exports;
197
198
  }
198
199
  });
199
200
  Object.defineProperty(exports, "I", {
200
201
  enumerable: true,
201
202
  get: function() {
202
- return require_index$14.invocation_exports;
203
+ return require_index$16.invocation_exports;
203
204
  }
204
205
  });
205
206
  exports.InvalidBytesInStringError = require_stringToBytes.InvalidBytesInStringError;
@@ -207,14 +208,14 @@ exports.InvalidMillisecondInStringError = require_stringToMillisecond.InvalidMil
207
208
  Object.defineProperty(exports, "M", {
208
209
  enumerable: true,
209
210
  get: function() {
210
- return require_index$12.modeling_exports;
211
+ return require_index$14.modeling_exports;
211
212
  }
212
213
  });
213
214
  exports.MissingBuilderMethodsError = require_builder.MissingBuilderMethodsError;
214
215
  Object.defineProperty(exports, "N", {
215
216
  enumerable: true,
216
217
  get: function() {
217
- return require_index$9.number_exports;
218
+ return require_index$11.number_exports;
218
219
  }
219
220
  });
220
221
  Object.defineProperty(exports, "O", {
@@ -226,19 +227,19 @@ Object.defineProperty(exports, "O", {
226
227
  Object.defineProperty(exports, "P", {
227
228
  enumerable: true,
228
229
  get: function() {
229
- return require_index$13.pattern_exports;
230
+ return require_index$15.pattern_exports;
230
231
  }
231
232
  });
232
233
  Object.defineProperty(exports, "S", {
233
234
  enumerable: true,
234
235
  get: function() {
235
- return require_index$7.string_exports;
236
+ return require_index$8.string_exports;
236
237
  }
237
238
  });
238
239
  Object.defineProperty(exports, "T", {
239
240
  enumerable: true,
240
241
  get: function() {
241
- return require_index$11.tuple_exports;
242
+ return require_index$13.tuple_exports;
242
243
  }
243
244
  });
244
245
  exports.TheFormData = require_formData.TheFormData;
@@ -269,6 +270,7 @@ exports.falsy = require_falsy.falsy;
269
270
  exports.forward = require_forward.forward;
270
271
  exports.forwardAsserts = require_forwardAsserts.forwardAsserts;
271
272
  exports.forwardLog = require_forwardLog.forwardLog;
273
+ exports.infer = require_index$3.infer;
272
274
  exports.innerPipe = require_innerPipe.innerPipe;
273
275
  exports.instanceOf = require_instanceOf.instanceOf;
274
276
  exports.isType = require_isType.isType;
package/dist/index.mjs CHANGED
@@ -14,6 +14,7 @@ import { callThen } from "./common/callThen.mjs";
14
14
  import { object_exports } from "./object/index.mjs";
15
15
  import { clone } from "./common/clone.mjs";
16
16
  import { cast, shameOnYou } from "./common/constraint/cast/index.mjs";
17
+ import { infer } from "./common/constraint/infer/index.mjs";
17
18
  import { removeConstraint } from "./common/constraint/remove.mjs";
18
19
  import { detachObjectMethod } from "./common/detachObjectMethod.mjs";
19
20
  import { createEnum } from "./common/enum.mjs";
@@ -60,12 +61,12 @@ import { when } from "./common/when.mjs";
60
61
  import { whenElse } from "./common/whenElse.mjs";
61
62
  import { whenNot } from "./common/whenNot.mjs";
62
63
  import { common_exports } from "./common/index.mjs";
64
+ import { path_exports } from "./path/index.mjs";
63
65
  import { number_exports } from "./number/index.mjs";
64
66
  import { dataStructure_exports } from "./dataStructure/index.mjs";
65
67
  import { tuple_exports } from "./tuple/index.mjs";
66
68
  import { modeling_exports } from "./modeling/index.mjs";
67
69
  import { pattern_exports } from "./pattern/index.mjs";
68
70
  import { invocation_exports } from "./invocation/index.mjs";
69
- import { path_exports } from "./path/index.mjs";
70
71
  import { printer_exports } from "./printer/index.mjs";
71
- export { array_exports as A, AssertsError, chrono_exports as C, array_exports as DArray, chrono_exports as DChrono, common_exports as DCommon, dataStructure_exports as DDataStructure, either_exports as DEither, generator_exports as DGenerator, invocation_exports as DInvocation, kind_exports as DKind, modeling_exports as DModeling, number_exports as DNumber, object_exports as DObject, path_exports as DPath, pattern_exports as DPattern, printer_exports as DPrinter, dataStructure_exports as DS, string_exports as DString, tuple_exports as DTuple, either_exports as E, generator_exports as G, invocation_exports as I, InvalidBytesInStringError, InvalidMillisecondInStringError, modeling_exports as M, MissingBuilderMethodsError, number_exports as N, object_exports as O, pattern_exports as P, string_exports as S, tuple_exports as T, TheFormData, and, asserts, asyncInnerPipe, asyncLoop, asyncPipe, bindPrototypeMethods, builderKind, callThen, cast, clone, createAsyncRetry, createBuilder, createEnum, createExternalPromise, createFormData, createGlobalStore, createInterpolation, createKind, createQueue, createTransformer, detachObjectMethod, equal, escapeRegExp, falsy, forward, forwardAsserts, forwardLog, innerPipe, instanceOf, isType, justExec, justReturn, loop, memo, memoObject, memoPromise, mimeType, or, pipe, pipeCall, prepareAsyncPipe, preparePipe, promiseAll, promiseObject, queueKind, removeConstraint, shameOnYou, simpleClone, stringToBytes, stringToMillisecond, timeout, toCurriedPredicate, toJSON, toNative, toRegExp, transformer, truthy, useAsyncRetry, when, whenElse, whenNot };
72
+ export { array_exports as A, AssertsError, chrono_exports as C, array_exports as DArray, chrono_exports as DChrono, common_exports as DCommon, dataStructure_exports as DDataStructure, either_exports as DEither, generator_exports as DGenerator, invocation_exports as DInvocation, kind_exports as DKind, modeling_exports as DModeling, number_exports as DNumber, object_exports as DObject, path_exports as DPath, pattern_exports as DPattern, printer_exports as DPrinter, dataStructure_exports as DS, string_exports as DString, tuple_exports as DTuple, either_exports as E, generator_exports as G, invocation_exports as I, InvalidBytesInStringError, InvalidMillisecondInStringError, modeling_exports as M, MissingBuilderMethodsError, number_exports as N, object_exports as O, pattern_exports as P, string_exports as S, tuple_exports as T, TheFormData, and, asserts, asyncInnerPipe, asyncLoop, asyncPipe, bindPrototypeMethods, builderKind, callThen, cast, clone, createAsyncRetry, createBuilder, createEnum, createExternalPromise, createFormData, createGlobalStore, createInterpolation, createKind, createQueue, createTransformer, detachObjectMethod, equal, escapeRegExp, falsy, forward, forwardAsserts, forwardLog, infer, innerPipe, instanceOf, isType, justExec, justReturn, loop, memo, memoObject, memoPromise, mimeType, or, pipe, pipeCall, prepareAsyncPipe, preparePipe, promiseAll, promiseObject, queueKind, removeConstraint, shameOnYou, simpleClone, stringToBytes, stringToMillisecond, timeout, toCurriedPredicate, toJSON, toNative, toRegExp, transformer, truthy, useAsyncRetry, when, whenElse, whenNot };
@@ -3,7 +3,6 @@ const require_betweenThan = require("./betweenThan.cjs");
3
3
  const require_betweenThanOrEqual = require("./betweenThanOrEqual.cjs");
4
4
  const require_greaterThan = require("./greaterThan.cjs");
5
5
  const require_greaterThanOrEqual = require("./greaterThanOrEqual.cjs");
6
- const require_infer = require("./infer.cjs");
7
6
  const require_isEven = require("./isEven.cjs");
8
7
  const require_isInteger = require("./isInteger.cjs");
9
8
  const require_isMultipleOf = require("./isMultipleOf.cjs");
@@ -28,7 +27,6 @@ var number_exports = /* @__PURE__ */ require_runtime.__exportAll({
28
27
  betweenThanOrEqual: () => require_betweenThanOrEqual.betweenThanOrEqual,
29
28
  greaterThan: () => require_greaterThan.greaterThan,
30
29
  greaterThanOrEqual: () => require_greaterThanOrEqual.greaterThanOrEqual,
31
- infer: () => require_infer.infer,
32
30
  isEven: () => require_isEven.isEven,
33
31
  isInteger: () => require_isInteger.isInteger,
34
32
  isMultipleOf: () => require_isMultipleOf.isMultipleOf,
@@ -53,7 +51,6 @@ exports.betweenThan = require_betweenThan.betweenThan;
53
51
  exports.betweenThanOrEqual = require_betweenThanOrEqual.betweenThanOrEqual;
54
52
  exports.greaterThan = require_greaterThan.greaterThan;
55
53
  exports.greaterThanOrEqual = require_greaterThanOrEqual.greaterThanOrEqual;
56
- exports.infer = require_infer.infer;
57
54
  exports.isEven = require_isEven.isEven;
58
55
  exports.isInteger = require_isInteger.isInteger;
59
56
  exports.isMultipleOf = require_isMultipleOf.isMultipleOf;
@@ -3,7 +3,6 @@ export * from './betweenThanOrEqual';
3
3
  export type * from './constraints';
4
4
  export * from './greaterThan';
5
5
  export * from './greaterThanOrEqual';
6
- export * from './infer';
7
6
  export * from './isEven';
8
7
  export * from './isInteger';
9
8
  export * from './isMultipleOf';
@@ -3,7 +3,6 @@ import { betweenThan } from "./betweenThan.mjs";
3
3
  import { betweenThanOrEqual } from "./betweenThanOrEqual.mjs";
4
4
  import { greaterThan } from "./greaterThan.mjs";
5
5
  import { greaterThanOrEqual } from "./greaterThanOrEqual.mjs";
6
- import { infer } from "./infer.mjs";
7
6
  import { isEven } from "./isEven.mjs";
8
7
  import { isInteger } from "./isInteger.mjs";
9
8
  import { isMultipleOf } from "./isMultipleOf.mjs";
@@ -28,7 +27,6 @@ var number_exports = /* @__PURE__ */ __exportAll({
28
27
  betweenThanOrEqual: () => betweenThanOrEqual,
29
28
  greaterThan: () => greaterThan,
30
29
  greaterThanOrEqual: () => greaterThanOrEqual,
31
- infer: () => infer,
32
30
  isEven: () => isEven,
33
31
  isInteger: () => isInteger,
34
32
  isMultipleOf: () => isMultipleOf,
@@ -49,4 +47,4 @@ var number_exports = /* @__PURE__ */ __exportAll({
49
47
  sum: () => sum
50
48
  });
51
49
  //#endregion
52
- export { betweenThan, betweenThanOrEqual, greaterThan, greaterThanOrEqual, infer, isEven, isInteger, isMultipleOf, isNegative, isNotZero, isOdd, isPositive, isSafe, isStrictNegative, isStrictPositive, lessThan, lessThanOrEqual, max, maxOf, min, minOf, number_exports, sort, sum };
50
+ export { betweenThan, betweenThanOrEqual, greaterThan, greaterThanOrEqual, isEven, isInteger, isMultipleOf, isNegative, isNotZero, isOdd, isPositive, isSafe, isStrictNegative, isStrictPositive, lessThan, lessThanOrEqual, max, maxOf, min, minOf, number_exports, sort, sum };
@@ -1,13 +1,12 @@
1
- const require_fix = require("./fix.cjs");
2
1
  //#region scripts/path/computeRelative.ts
3
2
  function computeRelative(source, destination) {
4
- const sourceSegments = require_fix.fix(source).split("/");
5
- const destinationSegments = require_fix.fix(destination).split("/");
6
- let commonIndex = 1;
3
+ const sourceSegments = source === "/" ? [] : source.slice(1).split("/");
4
+ const destinationSegments = destination === "/" ? [] : destination.slice(1).split("/");
5
+ let commonIndex = 0;
7
6
  while (commonIndex < sourceSegments.length && commonIndex < destinationSegments.length && sourceSegments[commonIndex] === destinationSegments[commonIndex]) commonIndex++;
8
7
  let result = "";
9
- for (let index = commonIndex; index < sourceSegments.length; index++) result += result === "" ? ".." : "/..";
10
- for (let index = commonIndex; index < destinationSegments.length; index++) result += result === "" ? destinationSegments[index] : `/${destinationSegments[index]}`;
8
+ for (let index = commonIndex; index < sourceSegments.length; index++) result += result ? "/.." : "..";
9
+ for (let index = commonIndex; index < destinationSegments.length; index++) result += result ? `/${destinationSegments[index]}` : destinationSegments[index];
11
10
  return result || ".";
12
11
  }
13
12
  //#endregion
@@ -1,2 +1,2 @@
1
1
  import { Absolute, Path } from './constraints';
2
- export declare function computeRelative<GenericSourcePath extends string & Path & Absolute, GenericDestinationPath extends string & Path & Absolute>(source: GenericSourcePath, destination: GenericDestinationPath): string & Path;
2
+ export declare function computeRelative<GenericSourcePath extends string & Absolute, GenericDestinationPath extends string & Absolute>(source: GenericSourcePath, destination: GenericDestinationPath): string & Path;
@@ -1,13 +1,12 @@
1
- import { fix } from "./fix.mjs";
2
1
  //#region scripts/path/computeRelative.ts
3
2
  function computeRelative(source, destination) {
4
- const sourceSegments = fix(source).split("/");
5
- const destinationSegments = fix(destination).split("/");
6
- let commonIndex = 1;
3
+ const sourceSegments = source === "/" ? [] : source.slice(1).split("/");
4
+ const destinationSegments = destination === "/" ? [] : destination.slice(1).split("/");
5
+ let commonIndex = 0;
7
6
  while (commonIndex < sourceSegments.length && commonIndex < destinationSegments.length && sourceSegments[commonIndex] === destinationSegments[commonIndex]) commonIndex++;
8
7
  let result = "";
9
- for (let index = commonIndex; index < sourceSegments.length; index++) result += result === "" ? ".." : "/..";
10
- for (let index = commonIndex; index < destinationSegments.length; index++) result += result === "" ? destinationSegments[index] : `/${destinationSegments[index]}`;
8
+ for (let index = commonIndex; index < sourceSegments.length; index++) result += result ? "/.." : "..";
9
+ for (let index = commonIndex; index < destinationSegments.length; index++) result += result ? `/${destinationSegments[index]}` : destinationSegments[index];
11
10
  return result || ".";
12
11
  }
13
12
  //#endregion
@@ -1,3 +1,3 @@
1
1
  import type * as DCommon from '../../common';
2
- export interface Absolute extends DCommon.Constraint<"path" | "path-absolute"> {
2
+ export interface Absolute extends DCommon.Constraint<"path-absolute"> {
3
3
  }
@@ -1,12 +1,10 @@
1
1
  //#region scripts/path/getBaseName.ts
2
- const baseNameRegex = /\/?([^/]+)$/;
3
- const extensionNameRegex = /\.([^./]+)$/;
4
- const segmentTrailingRegex = /\/+$/;
2
+ const baseNameRegex = /([^/]+)$/;
3
+ const extensionNameRegex = /(?<!^)\.[^./]+$/;
5
4
  function getBaseName(path, params) {
6
- const fixedPath = path.replace(segmentTrailingRegex, "");
7
- const baseName = baseNameRegex.exec(fixedPath)?.[1] ?? "";
8
- if (params?.removeExtension) return baseName.replace(extensionNameRegex, "");
9
- return baseName;
5
+ const baseName = baseNameRegex.exec(path)?.[1];
6
+ if (baseName === void 0) return null;
7
+ return params?.removeExtension ? baseName.replace(extensionNameRegex, "") : baseName;
10
8
  }
11
9
  //#endregion
12
10
  exports.getBaseName = getBaseName;
@@ -1,5 +1,5 @@
1
- import { Path } from './constraints';
1
+ import { Absolute, Path } from './constraints';
2
2
  export interface GetBaseNameParams {
3
3
  removeExtension?: boolean;
4
4
  }
5
- export declare function getBaseName<GenericPath extends string & Path>(path: GenericPath, params?: GetBaseNameParams): string;
5
+ export declare function getBaseName<GenericPath extends string & (Path | Absolute)>(path: GenericPath, params?: GetBaseNameParams): string | null;
@@ -1,12 +1,10 @@
1
1
  //#region scripts/path/getBaseName.ts
2
- const baseNameRegex = /\/?([^/]+)$/;
3
- const extensionNameRegex = /\.([^./]+)$/;
4
- const segmentTrailingRegex = /\/+$/;
2
+ const baseNameRegex = /([^/]+)$/;
3
+ const extensionNameRegex = /(?<!^)\.[^./]+$/;
5
4
  function getBaseName(path, params) {
6
- const fixedPath = path.replace(segmentTrailingRegex, "");
7
- const baseName = baseNameRegex.exec(fixedPath)?.[1] ?? "";
8
- if (params?.removeExtension) return baseName.replace(extensionNameRegex, "");
9
- return baseName;
5
+ const baseName = baseNameRegex.exec(path)?.[1];
6
+ if (baseName === void 0) return null;
7
+ return params?.removeExtension ? baseName.replace(extensionNameRegex, "") : baseName;
10
8
  }
11
9
  //#endregion
12
10
  export { getBaseName };
@@ -1,9 +1,12 @@
1
1
  //#region scripts/path/getExtensionName.ts
2
- const extensionNameRegex = /\.([^./]+)$/;
2
+ const basenameRegex = /([^/]+)$/;
3
3
  function getExtensionName(path, params) {
4
- const match = extensionNameRegex.exec(path);
5
- if (match) return params?.withDot ? `.${match[1]}` : match[1];
6
- return "";
4
+ const baseName = basenameRegex.exec(path)?.[1];
5
+ if (!baseName || baseName === "." || baseName === "..") return null;
6
+ const dotIndex = baseName.lastIndexOf(".");
7
+ if (dotIndex <= 0 || dotIndex === baseName.length - 1) return null;
8
+ const extension = baseName.slice(dotIndex + 1);
9
+ return params?.withDot ? `.${extension}` : extension;
7
10
  }
8
11
  //#endregion
9
12
  exports.getExtensionName = getExtensionName;
@@ -1,5 +1,5 @@
1
- import { Path } from './constraints';
1
+ import { Absolute, Path } from './constraints';
2
2
  export interface GetExtensionNameParams {
3
3
  withDot?: boolean;
4
4
  }
5
- export declare function getExtensionName<GenericPath extends string & Path>(path: GenericPath, params?: GetExtensionNameParams): string;
5
+ export declare function getExtensionName<GenericPath extends string & (Path | Absolute)>(path: GenericPath, params?: GetExtensionNameParams): string | null;
@@ -1,9 +1,12 @@
1
1
  //#region scripts/path/getExtensionName.ts
2
- const extensionNameRegex = /\.([^./]+)$/;
2
+ const basenameRegex = /([^/]+)$/;
3
3
  function getExtensionName(path, params) {
4
- const match = extensionNameRegex.exec(path);
5
- if (match) return params?.withDot ? `.${match[1]}` : match[1];
6
- return "";
4
+ const baseName = basenameRegex.exec(path)?.[1];
5
+ if (!baseName || baseName === "." || baseName === "..") return null;
6
+ const dotIndex = baseName.lastIndexOf(".");
7
+ if (dotIndex <= 0 || dotIndex === baseName.length - 1) return null;
8
+ const extension = baseName.slice(dotIndex + 1);
9
+ return params?.withDot ? `.${extension}` : extension;
7
10
  }
8
11
  //#endregion
9
12
  export { getExtensionName };
@@ -1,9 +1,10 @@
1
1
  //#region scripts/path/getParentFolderPath.ts
2
- const folderNameRegex = /([^]+)\/[^/]+\/?$/;
2
+ const parentFolderPathRegex = /^([^]*)\/[^/]+$/;
3
+ const onlyParentsRegex = /^(?:\.\.)(?:\/\.\.)*$/;
3
4
  function getParentFolderPath(path) {
4
- const match = path.match(folderNameRegex);
5
- if (!match) return "";
6
- return match[1];
5
+ const parent = parentFolderPathRegex.exec(path)?.[1];
6
+ if (parent === void 0 || parent === "" || onlyParentsRegex.test(parent)) return path.startsWith("/") && parent === "" ? "/" : null;
7
+ return parent;
7
8
  }
8
9
  //#endregion
9
10
  exports.getParentFolderPath = getParentFolderPath;
@@ -1,3 +1,2 @@
1
1
  import { Absolute, Path } from './constraints';
2
- export declare function getParentFolderPath<GenericPath extends string & Path & Absolute>(path: GenericPath): string;
3
- export declare function getParentFolderPath<GenericPath extends string & Path>(path: GenericPath): string;
2
+ export declare function getParentFolderPath<GenericPath extends string & (Path | Absolute)>(path: GenericPath): string | null;
@@ -1,9 +1,10 @@
1
1
  //#region scripts/path/getParentFolderPath.ts
2
- const folderNameRegex = /([^]+)\/[^/]+\/?$/;
2
+ const parentFolderPathRegex = /^([^]*)\/[^/]+$/;
3
+ const onlyParentsRegex = /^(?:\.\.)(?:\/\.\.)*$/;
3
4
  function getParentFolderPath(path) {
4
- const match = path.match(folderNameRegex);
5
- if (!match) return "";
6
- return match[1];
5
+ const parent = parentFolderPathRegex.exec(path)?.[1];
6
+ if (parent === void 0 || parent === "" || onlyParentsRegex.test(parent)) return path.startsWith("/") && parent === "" ? "/" : null;
7
+ return parent;
7
8
  }
8
9
  //#endregion
9
10
  export { getParentFolderPath };
@@ -1,33 +1,33 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
- const require_fix = require("./fix.cjs");
3
2
  const require_computeRelative = require("./computeRelative.cjs");
4
3
  const require_getBaseName = require("./getBaseName.cjs");
5
4
  const require_getExtensionName = require("./getExtensionName.cjs");
6
5
  const require_getParentFolderPath = require("./getParentFolderPath.cjs");
7
6
  const require_is = require("./is.cjs");
8
7
  const require_isAbsolute = require("./isAbsolute.cjs");
8
+ const require_normalize = require("./normalize.cjs");
9
9
  const require_resolveRelative = require("./resolveRelative.cjs");
10
10
  const require_resolveFrom = require("./resolveFrom.cjs");
11
11
  //#region scripts/path/index.ts
12
12
  var path_exports = /* @__PURE__ */ require_runtime.__exportAll({
13
13
  computeRelative: () => require_computeRelative.computeRelative,
14
- fix: () => require_fix.fix,
15
14
  getBaseName: () => require_getBaseName.getBaseName,
16
15
  getExtensionName: () => require_getExtensionName.getExtensionName,
17
16
  getParentFolderPath: () => require_getParentFolderPath.getParentFolderPath,
18
17
  is: () => require_is.is,
19
18
  isAbsolute: () => require_isAbsolute.isAbsolute,
19
+ normalize: () => require_normalize.normalize,
20
20
  resolveFrom: () => require_resolveFrom.resolveFrom,
21
21
  resolveRelative: () => require_resolveRelative.resolveRelative
22
22
  });
23
23
  //#endregion
24
24
  exports.computeRelative = require_computeRelative.computeRelative;
25
- exports.fix = require_fix.fix;
26
25
  exports.getBaseName = require_getBaseName.getBaseName;
27
26
  exports.getExtensionName = require_getExtensionName.getExtensionName;
28
27
  exports.getParentFolderPath = require_getParentFolderPath.getParentFolderPath;
29
28
  exports.is = require_is.is;
30
29
  exports.isAbsolute = require_isAbsolute.isAbsolute;
30
+ exports.normalize = require_normalize.normalize;
31
31
  Object.defineProperty(exports, "path_exports", {
32
32
  enumerable: true,
33
33
  get: function() {
@@ -1,11 +1,11 @@
1
- export type * from './constraints';
2
1
  export * from './computeRelative';
3
- export * from './fix';
2
+ export type * from './constraints';
4
3
  export * from './getBaseName';
5
4
  export * from './getExtensionName';
6
5
  export * from './getParentFolderPath';
7
6
  export * from './is';
8
7
  export * from './isAbsolute';
8
+ export * from './normalize';
9
9
  export * from './resolveFrom';
10
10
  export * from './resolveRelative';
11
11
  export type * from './types';
@@ -1,24 +1,24 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
- import { fix } from "./fix.mjs";
3
2
  import { computeRelative } from "./computeRelative.mjs";
4
3
  import { getBaseName } from "./getBaseName.mjs";
5
4
  import { getExtensionName } from "./getExtensionName.mjs";
6
5
  import { getParentFolderPath } from "./getParentFolderPath.mjs";
7
6
  import { is } from "./is.mjs";
8
7
  import { isAbsolute } from "./isAbsolute.mjs";
8
+ import { normalize } from "./normalize.mjs";
9
9
  import { resolveRelative } from "./resolveRelative.mjs";
10
10
  import { resolveFrom } from "./resolveFrom.mjs";
11
11
  //#region scripts/path/index.ts
12
12
  var path_exports = /* @__PURE__ */ __exportAll({
13
13
  computeRelative: () => computeRelative,
14
- fix: () => fix,
15
14
  getBaseName: () => getBaseName,
16
15
  getExtensionName: () => getExtensionName,
17
16
  getParentFolderPath: () => getParentFolderPath,
18
17
  is: () => is,
19
18
  isAbsolute: () => isAbsolute,
19
+ normalize: () => normalize,
20
20
  resolveFrom: () => resolveFrom,
21
21
  resolveRelative: () => resolveRelative
22
22
  });
23
23
  //#endregion
24
- export { computeRelative, fix, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, path_exports, resolveFrom, resolveRelative };
24
+ export { computeRelative, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, normalize, path_exports, resolveFrom, resolveRelative };
package/dist/path/is.cjs CHANGED
@@ -1,8 +1,13 @@
1
1
  //#region scripts/path/is.ts
2
- const nullCharacter = String.fromCharCode(0);
3
- const posixPathRegex = /^(?:\/|\/?[^/]+(?:\/[^/]+)*(?:\/+)?)$/;
4
- function is(path) {
5
- return !path.includes(nullCharacter) && posixPathRegex.test(path);
2
+ const dotSegmentRegExp = /(^|\/)\.(\/|$)/;
3
+ const endsWithSlash = /[^]+\/$/;
4
+ const dotDotRegExp = /(^|\/)\.\.(\/|$)/;
5
+ const invalidDotDotRegExp = /(^|\/)(?!\.\.(?:\/|$))[^/]+\/\.\.(?:\/|$)/;
6
+ function is(value) {
7
+ if (value === ".") return true;
8
+ if (value === "" || value.includes("\0") || value.includes("//") || endsWithSlash.test(value) || dotSegmentRegExp.test(value)) return false;
9
+ if (value.startsWith("/")) return !dotDotRegExp.test(value);
10
+ return !invalidDotDotRegExp.test(value);
6
11
  }
7
12
  //#endregion
8
13
  exports.is = is;
package/dist/path/is.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- import { Path } from './constraints';
2
- export declare function is<GenericPath extends string>(path: GenericPath): path is GenericPath & Path;
1
+ import { Absolute, Path } from './constraints';
2
+ import { IsLiteralPath } from './types';
3
+ import type * as DString from '../string';
4
+ export declare function is<GenericPath extends string>(value: GenericPath): value is (GenericPath extends (Path | Absolute) ? GenericPath : IsLiteralPath<GenericPath> extends true ? GenericPath : DString.IsLiteral<GenericPath> extends true ? never : GenericPath & Path);