@cli-forge/parser 0.10.1 → 0.12.0

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 (134) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +202 -6
  3. package/dist/index.js.map +1 -0
  4. package/dist/lib/config-files/configuration-loader.js.map +1 -0
  5. package/dist/lib/config-files/index.d.ts +3 -0
  6. package/dist/lib/config-files/index.js +7 -0
  7. package/dist/lib/config-files/index.js.map +1 -0
  8. package/{src → dist}/lib/config-files/json-file-loader.d.ts +1 -1
  9. package/{src → dist}/lib/config-files/json-file-loader.js +2 -2
  10. package/dist/lib/config-files/json-file-loader.js.map +1 -0
  11. package/{src → dist}/lib/config-files/package-json-loader.d.ts +1 -1
  12. package/{src → dist}/lib/config-files/package-json-loader.js +2 -2
  13. package/dist/lib/config-files/package-json-loader.js.map +1 -0
  14. package/dist/lib/config-files/utils.js.map +1 -0
  15. package/dist/lib/helpers.js.map +1 -0
  16. package/dist/lib/option-types/array.js.map +1 -0
  17. package/dist/lib/option-types/boolean.js.map +1 -0
  18. package/{src → dist}/lib/option-types/common.d.ts +1 -1
  19. package/dist/lib/option-types/common.js.map +1 -0
  20. package/dist/lib/option-types/index.d.ts +15 -0
  21. package/{src → dist}/lib/option-types/index.js +1 -0
  22. package/dist/lib/option-types/index.js.map +1 -0
  23. package/dist/lib/option-types/number.js.map +1 -0
  24. package/dist/lib/option-types/object.d.ts +75 -0
  25. package/dist/lib/option-types/object.js.map +1 -0
  26. package/dist/lib/option-types/option-config-to-type.d.ts +9 -0
  27. package/dist/lib/option-types/option-config-to-type.js.map +1 -0
  28. package/dist/lib/option-types/option-config.d.ts +24 -0
  29. package/dist/lib/option-types/option-config.js.map +1 -0
  30. package/dist/lib/option-types/string.js.map +1 -0
  31. package/dist/lib/option-types/type-resolution.d.ts +132 -0
  32. package/dist/lib/option-types/type-resolution.js +7 -0
  33. package/dist/lib/option-types/type-resolution.js.map +1 -0
  34. package/dist/lib/parser.d.ts +218 -0
  35. package/{src → dist}/lib/parser.js +84 -13
  36. package/dist/lib/parser.js.map +1 -0
  37. package/dist/lib/parsers/array.js.map +1 -0
  38. package/dist/lib/parsers/boolean.js.map +1 -0
  39. package/dist/lib/parsers/number.js.map +1 -0
  40. package/{src → dist}/lib/parsers/object.d.ts +1 -1
  41. package/{src → dist}/lib/parsers/object.js +22 -1
  42. package/dist/lib/parsers/object.js.map +1 -0
  43. package/dist/lib/parsers/parser-map.js.map +1 -0
  44. package/dist/lib/parsers/string.js.map +1 -0
  45. package/dist/lib/parsers/typings.d.ts +11 -0
  46. package/dist/lib/parsers/typings.js.map +1 -0
  47. package/dist/lib/utils/case-transformations.js.map +1 -0
  48. package/dist/lib/utils/chain.d.ts +331 -0
  49. package/dist/lib/utils/chain.js.map +1 -0
  50. package/dist/lib/utils/flags.js.map +1 -0
  51. package/dist/lib/utils/get-configured-key.d.ts +3 -0
  52. package/dist/lib/utils/get-configured-key.js.map +1 -0
  53. package/dist/lib/utils/read-default-value.d.ts +2 -0
  54. package/{src → dist}/lib/utils/read-default-value.js +2 -0
  55. package/dist/lib/utils/read-default-value.js.map +1 -0
  56. package/package.json +18 -6
  57. package/src/lib/config-files/README.md +10 -0
  58. package/src/index.js.map +0 -1
  59. package/src/lib/config-files/configuration-loader.js.map +0 -1
  60. package/src/lib/config-files/index.d.ts +0 -3
  61. package/src/lib/config-files/index.js +0 -7
  62. package/src/lib/config-files/index.js.map +0 -1
  63. package/src/lib/config-files/json-file-loader.js.map +0 -1
  64. package/src/lib/config-files/package-json-loader.js.map +0 -1
  65. package/src/lib/config-files/utils.js.map +0 -1
  66. package/src/lib/helpers.js.map +0 -1
  67. package/src/lib/option-types/array.js.map +0 -1
  68. package/src/lib/option-types/boolean.js.map +0 -1
  69. package/src/lib/option-types/common.js.map +0 -1
  70. package/src/lib/option-types/index.d.ts +0 -14
  71. package/src/lib/option-types/index.js.map +0 -1
  72. package/src/lib/option-types/number.js.map +0 -1
  73. package/src/lib/option-types/object.d.ts +0 -10
  74. package/src/lib/option-types/object.js.map +0 -1
  75. package/src/lib/option-types/option-config-to-type.d.ts +0 -26
  76. package/src/lib/option-types/option-config-to-type.js.map +0 -1
  77. package/src/lib/option-types/option-config.d.ts +0 -15
  78. package/src/lib/option-types/option-config.js.map +0 -1
  79. package/src/lib/option-types/string.js.map +0 -1
  80. package/src/lib/parser.d.ts +0 -269
  81. package/src/lib/parser.js.map +0 -1
  82. package/src/lib/parsers/array.js.map +0 -1
  83. package/src/lib/parsers/boolean.js.map +0 -1
  84. package/src/lib/parsers/number.js.map +0 -1
  85. package/src/lib/parsers/object.js.map +0 -1
  86. package/src/lib/parsers/parser-map.js.map +0 -1
  87. package/src/lib/parsers/string.js.map +0 -1
  88. package/src/lib/parsers/typings.d.ts +0 -11
  89. package/src/lib/parsers/typings.js.map +0 -1
  90. package/src/lib/utils/case-transformations.js.map +0 -1
  91. package/src/lib/utils/chain.d.ts +0 -397
  92. package/src/lib/utils/chain.js.map +0 -1
  93. package/src/lib/utils/flags.js.map +0 -1
  94. package/src/lib/utils/get-configured-key.d.ts +0 -3
  95. package/src/lib/utils/get-configured-key.js.map +0 -1
  96. package/src/lib/utils/read-default-value.d.ts +0 -2
  97. package/src/lib/utils/read-default-value.js.map +0 -1
  98. /package/{src → dist}/index.d.ts +0 -0
  99. /package/{src → dist}/index.js +0 -0
  100. /package/{src → dist}/lib/config-files/configuration-loader.d.ts +0 -0
  101. /package/{src → dist}/lib/config-files/configuration-loader.js +0 -0
  102. /package/{src → dist}/lib/config-files/utils.d.ts +0 -0
  103. /package/{src → dist}/lib/config-files/utils.js +0 -0
  104. /package/{src → dist}/lib/helpers.d.ts +0 -0
  105. /package/{src → dist}/lib/helpers.js +0 -0
  106. /package/{src → dist}/lib/option-types/array.d.ts +0 -0
  107. /package/{src → dist}/lib/option-types/array.js +0 -0
  108. /package/{src → dist}/lib/option-types/boolean.d.ts +0 -0
  109. /package/{src → dist}/lib/option-types/boolean.js +0 -0
  110. /package/{src → dist}/lib/option-types/common.js +0 -0
  111. /package/{src → dist}/lib/option-types/number.d.ts +0 -0
  112. /package/{src → dist}/lib/option-types/number.js +0 -0
  113. /package/{src → dist}/lib/option-types/object.js +0 -0
  114. /package/{src → dist}/lib/option-types/option-config-to-type.js +0 -0
  115. /package/{src → dist}/lib/option-types/option-config.js +0 -0
  116. /package/{src → dist}/lib/option-types/string.d.ts +0 -0
  117. /package/{src → dist}/lib/option-types/string.js +0 -0
  118. /package/{src → dist}/lib/parsers/array.d.ts +0 -0
  119. /package/{src → dist}/lib/parsers/array.js +0 -0
  120. /package/{src → dist}/lib/parsers/boolean.d.ts +0 -0
  121. /package/{src → dist}/lib/parsers/boolean.js +0 -0
  122. /package/{src → dist}/lib/parsers/number.d.ts +0 -0
  123. /package/{src → dist}/lib/parsers/number.js +0 -0
  124. /package/{src → dist}/lib/parsers/parser-map.d.ts +0 -0
  125. /package/{src → dist}/lib/parsers/parser-map.js +0 -0
  126. /package/{src → dist}/lib/parsers/string.d.ts +0 -0
  127. /package/{src → dist}/lib/parsers/string.js +0 -0
  128. /package/{src → dist}/lib/parsers/typings.js +0 -0
  129. /package/{src → dist}/lib/utils/case-transformations.d.ts +0 -0
  130. /package/{src → dist}/lib/utils/case-transformations.js +0 -0
  131. /package/{src → dist}/lib/utils/chain.js +0 -0
  132. /package/{src → dist}/lib/utils/flags.d.ts +0 -0
  133. /package/{src → dist}/lib/utils/flags.js +0 -0
  134. /package/{src → dist}/lib/utils/get-configured-key.js +0 -0
@@ -0,0 +1,331 @@
1
+ import { UnknownOptionConfig } from '../option-types';
2
+ import { ArgvParser, ParsedArgs } from '../parser';
3
+ type UnaryFunction<T, R> = (arg: T) => R;
4
+ /**
5
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
6
+ *
7
+ * Used to convert code that looks like:
8
+ * ```typescript
9
+ * const a = addB(addC({ a: 'a' }));
10
+ * ```
11
+ * to:
12
+ * ```typescript
13
+ * const a = chain({ a: 'a' }, addB, addC);
14
+ * ```
15
+ *
16
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
17
+ *
18
+ * @param initial Initial value to pass through the chain
19
+ * @param fns Functions to apply to the initial value, and each subsequent value
20
+ * @returns Updated value after all functions have been applied
21
+ * @hidden docs for {@link chain} are found on the main signature.
22
+ */
23
+ export declare function chain<T0, R>(initial: T0, fn0: UnaryFunction<T0, R>): R;
24
+ /**
25
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
26
+ *
27
+ * Used to convert code that looks like:
28
+ * ```typescript
29
+ * const a = addB(addC({ a: 'a' }));
30
+ * ```
31
+ * to:
32
+ * ```typescript
33
+ * const a = chain({ a: 'a' }, addB, addC);
34
+ * ```
35
+ *
36
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
37
+ *
38
+ * @param initial Initial value to pass through the chain
39
+ * @param fns Functions to apply to the initial value, and each subsequent value
40
+ * @returns Updated value after all functions have been applied
41
+ * @hidden docs for {@link chain} are found on the main signature.
42
+ */
43
+ export declare function chain<T0, T1, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, R>): R;
44
+ /**
45
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
46
+ *
47
+ * Used to convert code that looks like:
48
+ * ```typescript
49
+ * const a = addB(addC({ a: 'a' }));
50
+ * ```
51
+ * to:
52
+ * ```typescript
53
+ * const a = chain({ a: 'a' }, addB, addC);
54
+ * ```
55
+ *
56
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
57
+ *
58
+ * @param initial Initial value to pass through the chain
59
+ * @param fns Functions to apply to the initial value, and each subsequent value
60
+ * @returns Updated value after all functions have been applied
61
+ * @hidden docs for {@link chain} are found on the main signature.
62
+ */
63
+ export declare function chain<T0, T1, T2, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, R>): R;
64
+ /**
65
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
66
+ *
67
+ * Used to convert code that looks like:
68
+ * ```typescript
69
+ * const a = addB(addC({ a: 'a' }));
70
+ * ```
71
+ * to:
72
+ * ```typescript
73
+ * const a = chain({ a: 'a' }, addB, addC);
74
+ * ```
75
+ *
76
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
77
+ *
78
+ * @param initial Initial value to pass through the chain
79
+ * @param fns Functions to apply to the initial value, and each subsequent value
80
+ * @returns Updated value after all functions have been applied
81
+ * @hidden docs for {@link chain} are found on the main signature.
82
+ */
83
+ export declare function chain<T0, T1, T2, T3, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, R>): R;
84
+ /**
85
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
86
+ *
87
+ * Used to convert code that looks like:
88
+ * ```typescript
89
+ * const a = addB(addC({ a: 'a' }));
90
+ * ```
91
+ * to:
92
+ * ```typescript
93
+ * const a = chain({ a: 'a' }, addB, addC);
94
+ * ```
95
+ *
96
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
97
+ *
98
+ * @param initial Initial value to pass through the chain
99
+ * @param fns Functions to apply to the initial value, and each subsequent value
100
+ * @returns Updated value after all functions have been applied
101
+ * @hidden docs for {@link chain} are found on the main signature.
102
+ */
103
+ export declare function chain<T0, T1, T2, T3, T4, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, R>): R;
104
+ /**
105
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
106
+ *
107
+ * Used to convert code that looks like:
108
+ * ```typescript
109
+ * const a = addB(addC({ a: 'a' }));
110
+ * ```
111
+ * to:
112
+ * ```typescript
113
+ * const a = chain({ a: 'a' }, addB, addC);
114
+ * ```
115
+ *
116
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
117
+ *
118
+ * @param initial Initial value to pass through the chain
119
+ * @param fns Functions to apply to the initial value, and each subsequent value
120
+ * @returns Updated value after all functions have been applied
121
+ * @hidden docs for {@link chain} are found on the main signature.
122
+ */
123
+ export declare function chain<T0, T1, T2, T3, T4, T5, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, R>): R;
124
+ /**
125
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
126
+ *
127
+ * Used to convert code that looks like:
128
+ * ```typescript
129
+ * const a = addB(addC({ a: 'a' }));
130
+ * ```
131
+ * to:
132
+ * ```typescript
133
+ * const a = chain({ a: 'a' }, addB, addC);
134
+ * ```
135
+ *
136
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
137
+ *
138
+ * @param initial Initial value to pass through the chain
139
+ * @param fns Functions to apply to the initial value, and each subsequent value
140
+ * @returns Updated value after all functions have been applied
141
+ * @hidden docs for {@link chain} are found on the main signature.
142
+ */
143
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, R>): R;
144
+ /**
145
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
146
+ *
147
+ * Used to convert code that looks like:
148
+ * ```typescript
149
+ * const a = addB(addC({ a: 'a' }));
150
+ * ```
151
+ * to:
152
+ * ```typescript
153
+ * const a = chain({ a: 'a' }, addB, addC);
154
+ * ```
155
+ *
156
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
157
+ *
158
+ * @param initial Initial value to pass through the chain
159
+ * @param fns Functions to apply to the initial value, and each subsequent value
160
+ * @returns Updated value after all functions have been applied
161
+ * @hidden docs for {@link chain} are found on the main signature.
162
+ */
163
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, T7, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, T7>, fn7: UnaryFunction<T7, R>): R;
164
+ /**
165
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
166
+ *
167
+ * Used to convert code that looks like:
168
+ * ```typescript
169
+ * const a = addB(addC({ a: 'a' }));
170
+ * ```
171
+ * to:
172
+ * ```typescript
173
+ * const a = chain({ a: 'a' }, addB, addC);
174
+ * ```
175
+ *
176
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
177
+ *
178
+ * @param initial Initial value to pass through the chain
179
+ * @param fns Functions to apply to the initial value, and each subsequent value
180
+ * @returns Updated value after all functions have been applied
181
+ * @hidden docs for {@link chain} are found on the main signature.
182
+ */
183
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, T7, T8, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, T7>, fn7: UnaryFunction<T7, T8>, fn8: UnaryFunction<T8, R>): R;
184
+ /**
185
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
186
+ *
187
+ * Used to convert code that looks like:
188
+ * ```typescript
189
+ * const a = addB(addC({ a: 'a' }));
190
+ * ```
191
+ * to:
192
+ * ```typescript
193
+ * const a = chain({ a: 'a' }, addB, addC);
194
+ * ```
195
+ *
196
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
197
+ *
198
+ * @param initial Initial value to pass through the chain
199
+ * @param fns Functions to apply to the initial value, and each subsequent value
200
+ * @returns Updated value after all functions have been applied
201
+ * @hidden docs for {@link chain} are found on the main signature.
202
+ */
203
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, T7>, fn7: UnaryFunction<T7, T8>, fn8: UnaryFunction<T8, T9>, fn9: UnaryFunction<T9, R>): R;
204
+ /**
205
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
206
+ *
207
+ * Used to convert code that looks like:
208
+ * ```typescript
209
+ * const a = addB(addC({ a: 'a' }));
210
+ * ```
211
+ * to:
212
+ * ```typescript
213
+ * const a = chain({ a: 'a' }, addB, addC);
214
+ * ```
215
+ *
216
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
217
+ *
218
+ * @param initial Initial value to pass through the chain
219
+ * @param fns Functions to apply to the initial value, and each subsequent value
220
+ * @returns Updated value after all functions have been applied
221
+ * @hidden docs for {@link chain} are found on the main signature.
222
+ */
223
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, T7>, fn7: UnaryFunction<T7, T8>, fn8: UnaryFunction<T8, T9>, fn9: UnaryFunction<T9, T10>, fn10: UnaryFunction<T10, R>): R;
224
+ /**
225
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
226
+ *
227
+ * Used to convert code that looks like:
228
+ * ```typescript
229
+ * const a = addB(addC({ a: 'a' }));
230
+ * ```
231
+ * to:
232
+ * ```typescript
233
+ * const a = chain({ a: 'a' }, addB, addC);
234
+ * ```
235
+ *
236
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
237
+ *
238
+ * @param initial Initial value to pass through the chain
239
+ * @param fns Functions to apply to the initial value, and each subsequent value
240
+ * @returns Updated value after all functions have been applied
241
+ * @hidden docs for {@link chain} are found on the main signature.
242
+ */
243
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, T7>, fn7: UnaryFunction<T7, T8>, fn8: UnaryFunction<T8, T9>, fn9: UnaryFunction<T9, T10>, fn10: UnaryFunction<T10, T11>, fn11: UnaryFunction<T11, R>): R;
244
+ /**
245
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
246
+ *
247
+ * Used to convert code that looks like:
248
+ * ```typescript
249
+ * const a = addB(addC({ a: 'a' }));
250
+ * ```
251
+ * to:
252
+ * ```typescript
253
+ * const a = chain({ a: 'a' }, addB, addC);
254
+ * ```
255
+ *
256
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
257
+ *
258
+ * @param initial Initial value to pass through the chain
259
+ * @param fns Functions to apply to the initial value, and each subsequent value
260
+ * @returns Updated value after all functions have been applied
261
+ * @hidden docs for {@link chain} are found on the main signature.
262
+ */
263
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, T7>, fn7: UnaryFunction<T7, T8>, fn8: UnaryFunction<T8, T9>, fn9: UnaryFunction<T9, T10>, fn10: UnaryFunction<T10, T11>, fn11: UnaryFunction<T11, T12>, fn12: UnaryFunction<T12, R>): R;
264
+ /**
265
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
266
+ *
267
+ * Used to convert code that looks like:
268
+ * ```typescript
269
+ * const a = addB(addC({ a: 'a' }));
270
+ * ```
271
+ * to:
272
+ * ```typescript
273
+ * const a = chain({ a: 'a' }, addB, addC);
274
+ * ```
275
+ *
276
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
277
+ *
278
+ * @param initial Initial value to pass through the chain
279
+ * @param fns Functions to apply to the initial value, and each subsequent value
280
+ * @returns Updated value after all functions have been applied
281
+ * @hidden docs for {@link chain} are found on the main signature.
282
+ */
283
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, T7>, fn7: UnaryFunction<T7, T8>, fn8: UnaryFunction<T8, T9>, fn9: UnaryFunction<T9, T10>, fn10: UnaryFunction<T10, T11>, fn11: UnaryFunction<T11, T12>, fn12: UnaryFunction<T12, T13>, fn13: UnaryFunction<T13, R>): R;
284
+ /**
285
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
286
+ *
287
+ * Used to convert code that looks like:
288
+ * ```typescript
289
+ * const a = addB(addC({ a: 'a' }));
290
+ * ```
291
+ * to:
292
+ * ```typescript
293
+ * const a = chain({ a: 'a' }, addB, addC);
294
+ * ```
295
+ *
296
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
297
+ *
298
+ * @param initial Initial value to pass through the chain
299
+ * @param fns Functions to apply to the initial value, and each subsequent value
300
+ * @returns Updated value after all functions have been applied
301
+ * @hidden docs for {@link chain} are found on the main signature.
302
+ */
303
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, T7>, fn7: UnaryFunction<T7, T8>, fn8: UnaryFunction<T8, T9>, fn9: UnaryFunction<T9, T10>, fn10: UnaryFunction<T10, T11>, fn11: UnaryFunction<T11, T12>, fn12: UnaryFunction<T12, T13>, fn13: UnaryFunction<T13, T14>, fn14: UnaryFunction<T14, R>): R;
304
+ /**
305
+ * Applies a series of functions to an initial value, passing the result of each function to the next.
306
+ *
307
+ * Used to convert code that looks like:
308
+ * ```typescript
309
+ * const a = addB(addC({ a: 'a' }));
310
+ * ```
311
+ * to:
312
+ * ```typescript
313
+ * const a = chain({ a: 'a' }, addB, addC);
314
+ * ```
315
+ *
316
+ * See [composable-options](/examples/composable-options) for an example of how this can be used.
317
+ *
318
+ * @param {T0} initial Initial value to pass through the chain
319
+ * @param fns Functions to apply to the initial value, and each subsequent value
320
+ * @returns {R} Updated value after all functions have been applied
321
+ */
322
+ export declare function chain<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R>(initial: T0, fn0: UnaryFunction<T0, T1>, fn1: UnaryFunction<T1, T2>, fn2: UnaryFunction<T2, T3>, fn3: UnaryFunction<T3, T4>, fn4: UnaryFunction<T4, T5>, fn5: UnaryFunction<T5, T6>, fn6: UnaryFunction<T6, T7>, fn7: UnaryFunction<T7, T8>, fn8: UnaryFunction<T8, T9>, fn9: UnaryFunction<T9, T10>, fn10: UnaryFunction<T10, T11>, fn11: UnaryFunction<T11, T12>, fn12: UnaryFunction<T12, T13>, fn13: UnaryFunction<T13, T14>, fn14: UnaryFunction<T14, T15>, fn15: UnaryFunction<T15, R>): R;
323
+ /**
324
+ * A composition helper to be used with {@link chain}.
325
+ *
326
+ * @param name The name of the option to add
327
+ * @param config The configuration for the option
328
+ * @returns A unary function that adds an option to an {@link ArgvParser}.
329
+ */
330
+ export declare function makeComposableOption<const TKey extends string, const TOptionConfig extends UnknownOptionConfig>(name: TKey, config: TOptionConfig): <const T extends ParsedArgs>(argv: ArgvParser<T>) => ArgvParser<T & ({ [key in TKey]: import("../option-types").WithOptional<import("../option-types").ResolveOptionType<TOptionConfig>, TOptionConfig>; } extends infer T_1 ? { [K in keyof T_1 as undefined extends { [key in TKey]: import("../option-types").WithOptional<import("../option-types").ResolveOptionType<TOptionConfig>, TOptionConfig>; }[K] ? K : never]?: T_1[K] | undefined; } : never) & ({ [key in TKey]: import("../option-types").WithOptional<import("../option-types").ResolveOptionType<TOptionConfig>, TOptionConfig>; } extends infer T_2 ? { [K_1 in keyof T_2 as undefined extends { [key in TKey]: import("../option-types").WithOptional<import("../option-types").ResolveOptionType<TOptionConfig>, TOptionConfig>; }[K_1] ? never : K_1]: T_2[K_1]; } : never)>;
331
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../src/lib/utils/chain.ts"],"names":[],"mappings":";AAAA,wFAAwF;AACxF,wFAAwF;AACxF,4FAA4F;AAC5F,0GAA0G;AAC1G,oGAAoG;AACpG,+CAA+C;;AA4kB/C,sBAKC;AASD,oDAMC;AAlDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,KAAK,CACnB,OAAW,EACX,GAAG,GAA8B;IAEjC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAGlC,IAAU,EAAE,MAAqB;IACjC,OAAO,CAA6B,IAAmB,EAAE,EAAE,CACzD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../src/lib/utils/flags.ts"],"names":[],"mappings":";;AAEA,wBAEC;AACD,kCAaC;AACD,gCAEC;AArBD,iEAA+D;AAE/D,SAAgB,MAAM,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AACD,SAAgB,WAAW,CAAC,GAAiB;IAC3C,0BAA0B;IAC1B,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,IAAA,4CAAqB,EAAC,GAAG,CAAC,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACtB,sCAAsC;IACxC,CAAC;SAAM,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;AACzC,CAAC;AACD,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { UnknownOptionConfig } from '../option-types';
2
+ import { ParsedArgs } from '../parser';
3
+ export declare function getConfiguredOptionKey<T extends ParsedArgs>(key: string, configuredOptions: Partial<Record<keyof T, UnknownOptionConfig>>): keyof T | undefined;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-configured-key.js","sourceRoot":"","sources":["../../../src/lib/utils/get-configured-key.ts"],"names":[],"mappings":";;AAGA,wDA+CC;AA/CD,SAAgB,sBAAsB,CACpC,GAAW,EACX,iBAAgE;IAEhE,IAAI,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAC7B,OAAO,GAAc,CAAC;IACxB,CAAC;IAED,SAAS,0BAA0B,CAAC,GAAW;QAC7C,IACE,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;YACpB,GAAG,CAAC,MAAM,GAAG,CAAC;YACd,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAC/B,CAAC;YACD,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9B,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,SAAS,wBAAwB,CAAC,GAAW;QAC3C,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,wCAAwC;IACxC,MAAM,aAAa,GAAG,wBAAwB,CAC5C,0BAA0B,CAAC,GAAG,CAAC,CAChC,CAAC;IAEF,IAAI,aAAa,IAAI,iBAAiB,EAAE,CAAC;QACvC,OAAO,aAAwB,CAAC;IAClC,CAAC;IAED,KAAK,MAAM,aAAa,IAAI,iBAAiB,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;QAChD,IAAI,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,aAAwB,CAAC;QAClC,CAAC;QACD,4CAA4C;QAC5C,IAAI,MAAM,EAAE,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;YACxE,OAAO,aAAwB,CAAC;QAClC,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { UnknownOptionConfig, OptionConfigToType } from '../option-types';
2
+ export declare function readDefaultValue<const T extends UnknownOptionConfig>(option: T): [OptionConfigToType<T> | undefined, string | undefined];
@@ -13,6 +13,8 @@ function readDefaultValue(option) {
13
13
  const factory = declaredDefault.factory;
14
14
  return [factory(), declaredDefault.description];
15
15
  }
16
+ // Plain object default (e.g., for object options with default: { foo: 'bar' })
17
+ return [declaredDefault, undefined];
16
18
  }
17
19
  else {
18
20
  return [declaredDefault, undefined];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-default-value.js","sourceRoot":"","sources":["../../../src/lib/utils/read-default-value.ts"],"names":[],"mappings":";;AAOA,4CAsBC;AAtBD,SAAgB,gBAAgB,CAC9B,MAAS;IAET,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,eAAe,GAAG,MAAM,CAAC,OAA4B,CAAC;QAC5D,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;YACxC,IAAI,OAAO,IAAI,eAAe,EAAE,CAAC;gBAC/B,MAAM,KAAK,GAAG,eAAe,CAAC,KAAqC,CAAC;gBACpE,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;YAC9C,CAAC;YACD,IAAI,SAAS,IAAI,eAAe,EAAE,CAAC;gBACjC,MAAM,OAAO,GACX,eAAe,CAAC,OAA6C,CAAC;gBAChE,OAAO,CAAC,OAAO,EAAE,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;YAClD,CAAC;YACD,+EAA+E;YAC/E,OAAO,CAAC,eAA+C,EAAE,SAAS,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IACD,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAChC,CAAC"}
package/package.json CHANGED
@@ -1,20 +1,32 @@
1
1
  {
2
2
  "name": "@cli-forge/parser",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0"
6
6
  },
7
7
  "type": "commonjs",
8
- "main": "./src/index.js",
9
- "typings": "./src/index.d.ts",
8
+ "main": "./dist/index.js",
9
+ "typings": "./dist/index.d.ts",
10
10
  "license": "ISC",
11
+ "homepage": "https://craigory.dev/cli-forge/",
11
12
  "repository": {
12
13
  "type": "git",
13
14
  "directory": "packages/parser",
14
15
  "url": "https://github.com/AgentEnder/cli-forge"
15
16
  },
17
+ "exports": {
18
+ ".": {
19
+ "require": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "files": [
26
+ "dist/**/*",
27
+ "**/*.md"
28
+ ],
16
29
  "publishConfig": {
17
30
  "access": "public"
18
- },
19
- "types": "./src/index.d.ts"
20
- }
31
+ }
32
+ }
@@ -0,0 +1,10 @@
1
+ Intentions / Goals of configuration loader system:
2
+
3
+ - Easily implement the following configuration consumers:
4
+ - Load configuration from static js / ts / json files
5
+ - Load configuration from package.json
6
+ - Load configuration via a custom function
7
+ - Regardless of how configuration is loaded, our return type should be the same
8
+ - Allow for `extends` functionality, where one configuration file can extend another
9
+
10
+ As much of this as possible should be abstracted away from the configuration loader itself, to make it easier to implement new configuration loaders in the future.
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/parser/src/index.ts"],"names":[],"mappings":";;;;AAAA,uDAA6B;AAC7B,2EAAiD;AACjD,wDAA8B;AAC9B,6DAAmC;AACnC,yEAA+C;AAC/C,4DAAkC;AAElC;;GAEG;AACH,iFAAyD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"configuration-loader.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/config-files/configuration-loader.ts"],"names":[],"mappings":";;AAwBA,oDAgCC;AAxDD,+BAA4B;AAsB5B,iFAAiF;AACjF,yEAAyE;AACzE,SAAgB,oBAAoB,CAClC,iBAAyB,EACzB,OAAmC;IAEnC,SAAS,iBAAiB,CACxB,QAAgB,EAChB,QAAkC;QAElC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,QAAQ,GAAG,oBAAoB,CACnC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;gBAC5B,CAAC,CAAC,IAAA,WAAI,EAAC,iBAAiB,EAAE,MAAM,CAAC,OAAO,CAAC;gBACzC,CAAC,CAAC,MAAM,CAAC,OAAO,EAClB,OAAO,CACR,CAAC;YACF,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,QAAQ,GAAM,EAAO,CAAC;IAC1B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACnD,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,GAAG;gBACT,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC;gBACtC,GAAG,QAAQ;aACZ,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './configuration-loader';
2
- export * from './json-file-loader';
3
- export * from './package-json-loader';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./configuration-loader"), exports);
5
- tslib_1.__exportStar(require("./json-file-loader"), exports);
6
- tslib_1.__exportStar(require("./package-json-loader"), exports);
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/config-files/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,6DAAmC;AACnC,gEAAsC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-file-loader.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/config-files/json-file-loader.ts"],"names":[],"mappings":";;AAYA,0DAuCC;AAnDD,2BAAkC;AAClC,+BAA+B;AAG/B,mCAA0C;AAE1C;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,QAAgB,EAChB,SAA4B;IAE5B,SAAS,YAAY,CAAC,QAAgB;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,oBAAoB;QAChB,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAEjC,OAAO,CAAC,iBAAyB;YAC/B,MAAM,WAAW,GAAG,IAAA,uBAAe,EAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;YACjE,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnD,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CACb,sDAAsD,WAAW,sHAAsH,CACxL,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAC3B,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,IAAI,CAAC,QAAgB;YACnB,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;YACpC,IAAI,SAAS,EAAE,CAAC;gBACd,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,CAAC,cAAO,CAAC,MAAM,CAAC;YACd,OAAO,wBAAwB,GAAG,QAAQ,CAAC;QAC7C,CAAC;KACF;IAED,OAAO,IAAI,oBAAoB,EAAE,CAAC;AACpC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-json-loader.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/config-files/package-json-loader.ts"],"names":[],"mappings":";;AAUA,8EAUC;AApBD,yCAAoC;AAGpC,yDAA6D;AAE7D;;;;GAIG;AACH,SAAgB,iCAAiC,CAC/C,GAAW;IAEX,MAAM,MAAM,GAAG,IAAA,0CAAuB,EACpC,cAAc,EACd,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CACpB,CAAC;IACD,MAAc,CAAC,mBAAO,CAAC,MAAM,CAAC,GAAG,GAAG,EAAE,CACrC,kCAAkC,GAAG,GAAG,CAAC;IAC3C,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/config-files/utils.ts"],"names":[],"mappings":";;AAGA,0CAiBC;AApBD,qCAAqC;AACrC,yCAA0C;AAE1C,SAAgB,eAAe,CAC7B,cAAsB,EACtB,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE;IAEzB,4CAA4C;IAC5C,IAAI,IAAwB,CAAC;IAC7B,IAAI,OAAO,GAAG,SAAS,CAAC;IACxB,OAAO,IAAI,KAAK,OAAO,EAAE,CAAC;QACxB,IAAI,GAAG,OAAO,CAAC;QACf,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC/C,IAAI,IAAA,oBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../packages/parser/src/lib/helpers.ts"],"names":[],"mappings":";AAAA,iFAAiF;;AAwBjF,0BAEC;AAED,wBAEC;AA5BD,SAAS,sBAAsB;IAC7B,0DAA0D;IAC1D,qDAAqD;IACrD,IAAI,oBAAoB,EAAE;QAAE,OAAO,CAAC,CAAC;IACrC,mCAAmC;IACnC,0DAA0D;IAC1D,kEAAkE;IAClE,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,oBAAoB;IAC3B,0FAA0F;IAC1F,oGAAoG;IACpG,OAAO,aAAa,EAAE,IAAI,CAAE,OAA2B,CAAC,UAAU,CAAC;AACrE,CAAC;AAED,SAAS,aAAa;IACpB,oEAAoE;IACpE,0GAA0G;IAC1G,OAAO,CAAC,CAAE,OAA2B,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAC1D,CAAC;AAED,SAAgB,OAAO,CAAC,IAAc;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,SAAgB,MAAM,CAAC,IAAc;IACnC,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;AACxC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/option-types/array.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/option-types/boolean.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/option-types/common.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- import { OptionConfig } from './option-config';
2
- export * from './option-config-to-type';
3
- export * from './common';
4
- export * from './array';
5
- export * from './boolean';
6
- export * from './number';
7
- export * from './object';
8
- export * from './string';
9
- export { OptionConfig };
10
- export type Internal<T extends OptionConfig> = T & InternalOptionConfig;
11
- export type InternalOptionConfig = OptionConfig & {
12
- key: string;
13
- position?: number;
14
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/option-types/index.ts"],"names":[],"mappings":";;;AAEA,kEAAwC;AACxC,mDAAyB;AACzB,kDAAwB;AACxB,oDAA0B;AAC1B,mDAAyB;AACzB,mDAAyB;AACzB,mDAAyB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/option-types/number.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import { CommonOptionConfig } from './common';
2
- import { OptionConfig } from './option-config';
3
- export interface ObjectOptionConfig<TCoerce = Record<string, string>, TProperties extends {
4
- [key: string]: Readonly<OptionConfig>;
5
- } = Record<string, any>> extends Omit<CommonOptionConfig<Record<string, string>, TCoerce>, 'choices'> {
6
- type: 'object';
7
- /** */
8
- properties: TProperties;
9
- additionalProperties?: false | 'string' | 'number' | 'boolean';
10
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/option-types/object.ts"],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- import { OptionConfig } from './option-config';
2
- import { ArrayOptionConfig } from './array';
3
- import { ObjectOptionConfig } from './object';
4
- /**
5
- * Converts an OptionConfig to the TypeScript type for the parsed value.
6
- */
7
- export type OptionConfigToType<TOptionConfig extends OptionConfig> = UndefinedIfRequiredAndNoDefault<TOptionConfig, InferTChoice<TOptionConfig> extends [never] ? TOptionConfig['coerce'] extends (s: any) => any ? ReturnType<TOptionConfig['coerce']> : {
8
- string: string;
9
- number: number;
10
- boolean: boolean;
11
- array: ArrayItems<TOptionConfig>[];
12
- object: TOptionConfig extends ObjectOptionConfig ? ResolveTProperties<TOptionConfig['properties']> & AdditionalProperties<TOptionConfig> : never;
13
- }[TOptionConfig['type']] : InferTChoice<TOptionConfig>>;
14
- export type UndefinedIfRequiredAndNoDefault<TOptionConfig extends OptionConfig, ResolvedValue> = TOptionConfig extends {
15
- required: true;
16
- } ? ResolvedValue : TOptionConfig extends {
17
- default: unknown;
18
- } ? ResolvedValue : // Option is not required and has no default value
19
- ResolvedValue | undefined;
20
- type ArrayItems<TOptionConfig extends OptionConfig> = TOptionConfig extends ArrayOptionConfig<string | number> ? TOptionConfig['items'] extends 'string' ? string : number : never;
21
- type AdditionalProperties<TOptionConfig extends ObjectOptionConfig> = TOptionConfig['additionalProperties'] extends 'string' ? Record<string, string> : TOptionConfig['additionalProperties'] extends 'number' ? Record<string, number> : TOptionConfig['additionalProperties'] extends 'boolean' ? Record<string, boolean> : Record<string, never>;
22
- type ResolveTProperties<TProperties extends Record<string, OptionConfig>> = {
23
- [key in keyof TProperties]: OptionConfigToType<TProperties[key]>;
24
- };
25
- type InferTChoice<TOptionConfig> = 'choices' extends keyof TOptionConfig ? TOptionConfig['choices'] extends Array<infer TChoice> ? TChoice : TOptionConfig['choices'] extends () => Array<infer TChoice> ? TChoice : never : never;
26
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"option-config-to-type.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/option-types/option-config-to-type.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- import { ArrayOptionConfig } from './array';
2
- import { BooleanOptionConfig } from './boolean';
3
- import { NumberOptionConfig } from './number';
4
- import { ObjectOptionConfig } from './object';
5
- import { StringOptionConfig } from './string';
6
- /**
7
- * Configures an option for the parser. See subtypes for more information.
8
- * - {@link StringOptionConfig}
9
- * - {@link NumberOptionConfig}
10
- * - {@link ArrayOptionConfig}
11
- * - {@link BooleanOptionConfig}
12
- *
13
- * @typeParam TCoerce The return type of the `coerce` function if provided.
14
- */
15
- export type OptionConfig<TCoerce = any, TChoices = any[], TObjectProps extends Record<string, OptionConfig> = Record<string, any>> = StringOptionConfig<TCoerce, TChoices> | NumberOptionConfig<TCoerce, TChoices> | ArrayOptionConfig<TCoerce, TChoices> | BooleanOptionConfig<TCoerce, TChoices> | ObjectOptionConfig<TCoerce, TObjectProps>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"option-config.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/option-types/option-config.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../../../../packages/parser/src/lib/option-types/string.ts"],"names":[],"mappings":""}