@gunshi/combinators 0.37.2 → 0.37.3
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/lib/index.d.ts +2 -15
- package/lib/index.js +22 -3
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.
|
|
1
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.29.0/node_modules/args-tokens/lib/resolver.d.ts
|
|
2
2
|
//#region src/resolver.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* An argument schema definition for command-line argument parsing.
|
|
@@ -451,13 +451,6 @@ interface ArgSchema {
|
|
|
451
451
|
*/
|
|
452
452
|
parse?: (value: string) => any;
|
|
453
453
|
}
|
|
454
|
-
/**
|
|
455
|
-
* Machine-readable error codes for {@link ArgsValidationError}.
|
|
456
|
-
*
|
|
457
|
-
* Each code identifies a validation failure category and is also suitable as an
|
|
458
|
-
* i18n resource key for localized rendering.
|
|
459
|
-
*/
|
|
460
|
-
|
|
461
454
|
/**
|
|
462
455
|
* An object that contains {@link ArgSchema | argument schema}.
|
|
463
456
|
*
|
|
@@ -466,13 +459,8 @@ interface ArgSchema {
|
|
|
466
459
|
interface Args {
|
|
467
460
|
[option: string]: ArgSchema;
|
|
468
461
|
}
|
|
469
|
-
/**
|
|
470
|
-
* An object that contains the values of the arguments.
|
|
471
|
-
*
|
|
472
|
-
* @typeParam T - {@link Args | Arguments} which is an object that defines the command line arguments.
|
|
473
|
-
*/
|
|
474
462
|
//#endregion
|
|
475
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.
|
|
463
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.29.0/node_modules/args-tokens/lib/combinators.d.ts
|
|
476
464
|
//#region src/combinators.d.ts
|
|
477
465
|
/**
|
|
478
466
|
* A combinator produced by combinator factory functions.
|
|
@@ -1142,7 +1130,6 @@ declare function merge<T extends Args[]>(...schemas: T): MergeArgs<T>;
|
|
|
1142
1130
|
*/
|
|
1143
1131
|
declare function extend<T extends Args, U extends Args>(base: T, overrides: U): Omit<T, keyof U> & U;
|
|
1144
1132
|
//#endregion
|
|
1145
|
-
//#endregion
|
|
1146
1133
|
//#region src/index.d.ts
|
|
1147
1134
|
/**
|
|
1148
1135
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.
|
|
1
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.29.0/node_modules/args-tokens/lib/utils.js
|
|
2
2
|
/**
|
|
3
3
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
4
4
|
* @license MIT
|
|
@@ -23,7 +23,7 @@ function formatChoices(choices) {
|
|
|
23
23
|
"-".codePointAt(0);
|
|
24
24
|
"=".codePointAt(0);
|
|
25
25
|
//#endregion
|
|
26
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.
|
|
26
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.29.0/node_modules/args-tokens/lib/resolver.js
|
|
27
27
|
/**
|
|
28
28
|
* Entry point of argument options resolver.
|
|
29
29
|
*
|
|
@@ -48,11 +48,24 @@ const ArgsValidationErrorKeys = {
|
|
|
48
48
|
unknownOption: "err:arg:unknown-option"
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
|
+
* Brand that marks {@link ArgsValidationError} instances.
|
|
52
|
+
*
|
|
53
|
+
* The brand is looked up in the global symbol registry with `Symbol.for`, so it stays
|
|
54
|
+
* identical across bundled copies of this module and across realms. It lets
|
|
55
|
+
* {@link isArgsValidationError} recognize errors created by another copy of `args-tokens`,
|
|
56
|
+
* where `instanceof` cannot match.
|
|
57
|
+
*/
|
|
58
|
+
const ARGS_VALIDATION_ERROR_BRAND = Symbol.for("args-tokens.ArgsValidationError");
|
|
59
|
+
/**
|
|
51
60
|
* An error that contains structured metadata for argument validation failures.
|
|
52
61
|
*
|
|
53
62
|
* The `message` remains the English fallback message. Renderers can use `code`
|
|
54
63
|
* and `values` to localize the error, falling back to `message` when localization
|
|
55
64
|
* is unavailable.
|
|
65
|
+
*
|
|
66
|
+
* Each instance carries a non-enumerable brand keyed by
|
|
67
|
+
* `Symbol.for('args-tokens.ArgsValidationError')`, which {@link isArgsValidationError}
|
|
68
|
+
* uses to recognize instances created by another bundled copy of `args-tokens`.
|
|
56
69
|
*/
|
|
57
70
|
var ArgsValidationError = class extends Error {
|
|
58
71
|
/**
|
|
@@ -76,10 +89,16 @@ var ArgsValidationError = class extends Error {
|
|
|
76
89
|
this.name = "ArgsValidationError";
|
|
77
90
|
this.code = options.code;
|
|
78
91
|
this.values = options.values ?? {};
|
|
92
|
+
Object.defineProperty(this, ARGS_VALIDATION_ERROR_BRAND, {
|
|
93
|
+
value: true,
|
|
94
|
+
enumerable: false,
|
|
95
|
+
writable: false,
|
|
96
|
+
configurable: false
|
|
97
|
+
});
|
|
79
98
|
}
|
|
80
99
|
};
|
|
81
100
|
//#endregion
|
|
82
|
-
//#region ../../node_modules/.pnpm/args-tokens@0.
|
|
101
|
+
//#region ../../node_modules/.pnpm/args-tokens@0.29.0/node_modules/args-tokens/lib/combinators.js
|
|
83
102
|
/**
|
|
84
103
|
* Parser combinator factory functions for composable argument schema construction.
|
|
85
104
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gunshi/combinators",
|
|
3
3
|
"description": "parser combinators for gunshi argument schema",
|
|
4
|
-
"version": "0.37.
|
|
4
|
+
"version": "0.37.3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"jsr-exports-lint": "^0.4.2",
|
|
58
58
|
"publint": "^0.3.20",
|
|
59
59
|
"tsdown": "0.21.0",
|
|
60
|
-
"gunshi": "0.37.
|
|
60
|
+
"gunshi": "0.37.3"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "tsdown",
|