@optique/git 1.0.0-dev.1136 → 1.0.0-dev.1163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +7 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -215,6 +215,8 @@ function gitBranch(options) {
|
|
|
215
215
|
* @param remote The remote name to validate against.
|
|
216
216
|
* @param options Configuration options for the parser.
|
|
217
217
|
* @returns A value parser that accepts existing remote branch names.
|
|
218
|
+
* @throws {TypeError} If `remote` is not a valid non-empty string without
|
|
219
|
+
* whitespace or control characters.
|
|
218
220
|
* @throws {RangeError} If `suggestionDepth` is not a positive integer.
|
|
219
221
|
* @since 0.9.0
|
|
220
222
|
*
|
|
@@ -227,6 +229,9 @@ function gitBranch(options) {
|
|
|
227
229
|
* ~~~~
|
|
228
230
|
*/
|
|
229
231
|
function gitRemoteBranch(remote, options) {
|
|
232
|
+
const expectedMessage = "Expected remote to be a non-empty string without whitespace or control characters";
|
|
233
|
+
if (typeof remote !== "string") throw new TypeError(`${expectedMessage}, but got: ${remote === null ? "null" : Array.isArray(remote) ? "array" : typeof remote}.`);
|
|
234
|
+
if (remote === "" || /[\s\x00-\x1f]/.test(remote)) throw new TypeError(`${expectedMessage}, but got: ${JSON.stringify(remote)}.`);
|
|
230
235
|
const metavar = options?.metavar ?? METAVAR_BRANCH;
|
|
231
236
|
return createAsyncValueParser(options, metavar, async (dir, input, errors) => {
|
|
232
237
|
try {
|
|
@@ -592,7 +597,8 @@ function gitRef(options) {
|
|
|
592
597
|
* @param options Shared configuration for the parsers.
|
|
593
598
|
* @returns An object containing git parsers. Each returned method may throw
|
|
594
599
|
* a {@link RangeError} if the merged `suggestionDepth` is not a positive
|
|
595
|
-
* integer.
|
|
600
|
+
* integer. `remoteBranch()` may also throw a {@link TypeError} if `remote`
|
|
601
|
+
* is not a valid non-empty string without whitespace or control characters.
|
|
596
602
|
* @since 0.9.0
|
|
597
603
|
*/
|
|
598
604
|
function createGitParsers(options) {
|
package/dist/index.d.cts
CHANGED
|
@@ -97,6 +97,8 @@ interface GitParsers {
|
|
|
97
97
|
* @param remote The remote name to validate against.
|
|
98
98
|
* @param options Configuration options for the parser.
|
|
99
99
|
* @returns A value parser that accepts existing remote branch names.
|
|
100
|
+
* @throws {TypeError} If `remote` is not a valid non-empty string without
|
|
101
|
+
* whitespace or control characters.
|
|
100
102
|
* @throws {RangeError} If `suggestionDepth` is not a positive integer.
|
|
101
103
|
*/
|
|
102
104
|
remoteBranch(remote: string, options?: GitParserOptions): ValueParser<"async", string>;
|
|
@@ -159,6 +161,8 @@ declare function gitBranch(options?: GitParserOptions): ValueParser<"async", str
|
|
|
159
161
|
* @param remote The remote name to validate against.
|
|
160
162
|
* @param options Configuration options for the parser.
|
|
161
163
|
* @returns A value parser that accepts existing remote branch names.
|
|
164
|
+
* @throws {TypeError} If `remote` is not a valid non-empty string without
|
|
165
|
+
* whitespace or control characters.
|
|
162
166
|
* @throws {RangeError} If `suggestionDepth` is not a positive integer.
|
|
163
167
|
* @since 0.9.0
|
|
164
168
|
*
|
|
@@ -219,7 +223,8 @@ declare function gitRef(options?: GitParserOptions): ValueParser<"async", string
|
|
|
219
223
|
* @param options Shared configuration for the parsers.
|
|
220
224
|
* @returns An object containing git parsers. Each returned method may throw
|
|
221
225
|
* a {@link RangeError} if the merged `suggestionDepth` is not a positive
|
|
222
|
-
* integer.
|
|
226
|
+
* integer. `remoteBranch()` may also throw a {@link TypeError} if `remote`
|
|
227
|
+
* is not a valid non-empty string without whitespace or control characters.
|
|
223
228
|
* @since 0.9.0
|
|
224
229
|
*/
|
|
225
230
|
declare function createGitParsers(options?: GitParserOptions): GitParsers;
|
package/dist/index.d.ts
CHANGED
|
@@ -97,6 +97,8 @@ interface GitParsers {
|
|
|
97
97
|
* @param remote The remote name to validate against.
|
|
98
98
|
* @param options Configuration options for the parser.
|
|
99
99
|
* @returns A value parser that accepts existing remote branch names.
|
|
100
|
+
* @throws {TypeError} If `remote` is not a valid non-empty string without
|
|
101
|
+
* whitespace or control characters.
|
|
100
102
|
* @throws {RangeError} If `suggestionDepth` is not a positive integer.
|
|
101
103
|
*/
|
|
102
104
|
remoteBranch(remote: string, options?: GitParserOptions): ValueParser<"async", string>;
|
|
@@ -159,6 +161,8 @@ declare function gitBranch(options?: GitParserOptions): ValueParser<"async", str
|
|
|
159
161
|
* @param remote The remote name to validate against.
|
|
160
162
|
* @param options Configuration options for the parser.
|
|
161
163
|
* @returns A value parser that accepts existing remote branch names.
|
|
164
|
+
* @throws {TypeError} If `remote` is not a valid non-empty string without
|
|
165
|
+
* whitespace or control characters.
|
|
162
166
|
* @throws {RangeError} If `suggestionDepth` is not a positive integer.
|
|
163
167
|
* @since 0.9.0
|
|
164
168
|
*
|
|
@@ -219,7 +223,8 @@ declare function gitRef(options?: GitParserOptions): ValueParser<"async", string
|
|
|
219
223
|
* @param options Shared configuration for the parsers.
|
|
220
224
|
* @returns An object containing git parsers. Each returned method may throw
|
|
221
225
|
* a {@link RangeError} if the merged `suggestionDepth` is not a positive
|
|
222
|
-
* integer.
|
|
226
|
+
* integer. `remoteBranch()` may also throw a {@link TypeError} if `remote`
|
|
227
|
+
* is not a valid non-empty string without whitespace or control characters.
|
|
223
228
|
* @since 0.9.0
|
|
224
229
|
*/
|
|
225
230
|
declare function createGitParsers(options?: GitParserOptions): GitParsers;
|
package/dist/index.js
CHANGED
|
@@ -193,6 +193,8 @@ function gitBranch(options) {
|
|
|
193
193
|
* @param remote The remote name to validate against.
|
|
194
194
|
* @param options Configuration options for the parser.
|
|
195
195
|
* @returns A value parser that accepts existing remote branch names.
|
|
196
|
+
* @throws {TypeError} If `remote` is not a valid non-empty string without
|
|
197
|
+
* whitespace or control characters.
|
|
196
198
|
* @throws {RangeError} If `suggestionDepth` is not a positive integer.
|
|
197
199
|
* @since 0.9.0
|
|
198
200
|
*
|
|
@@ -205,6 +207,9 @@ function gitBranch(options) {
|
|
|
205
207
|
* ~~~~
|
|
206
208
|
*/
|
|
207
209
|
function gitRemoteBranch(remote, options) {
|
|
210
|
+
const expectedMessage = "Expected remote to be a non-empty string without whitespace or control characters";
|
|
211
|
+
if (typeof remote !== "string") throw new TypeError(`${expectedMessage}, but got: ${remote === null ? "null" : Array.isArray(remote) ? "array" : typeof remote}.`);
|
|
212
|
+
if (remote === "" || /[\s\x00-\x1f]/.test(remote)) throw new TypeError(`${expectedMessage}, but got: ${JSON.stringify(remote)}.`);
|
|
208
213
|
const metavar = options?.metavar ?? METAVAR_BRANCH;
|
|
209
214
|
return createAsyncValueParser(options, metavar, async (dir, input, errors) => {
|
|
210
215
|
try {
|
|
@@ -570,7 +575,8 @@ function gitRef(options) {
|
|
|
570
575
|
* @param options Shared configuration for the parsers.
|
|
571
576
|
* @returns An object containing git parsers. Each returned method may throw
|
|
572
577
|
* a {@link RangeError} if the merged `suggestionDepth` is not a positive
|
|
573
|
-
* integer.
|
|
578
|
+
* integer. `remoteBranch()` may also throw a {@link TypeError} if `remote`
|
|
579
|
+
* is not a valid non-empty string without whitespace or control characters.
|
|
574
580
|
* @since 0.9.0
|
|
575
581
|
*/
|
|
576
582
|
function createGitParsers(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/git",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.1163+65b042cd",
|
|
4
4
|
"description": "Git value parsers for Optique",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@logtape/logtape": "^1.2.2",
|
|
61
61
|
"isomorphic-git": "^1.36.1",
|
|
62
|
-
"@optique/core": "1.0.0-dev.
|
|
62
|
+
"@optique/core": "1.0.0-dev.1163+65b042cd"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/node": "^20.19.9",
|