@shell-shock/core 0.13.12 → 0.13.14
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/components/command-validation-logic.d.cts +2 -2
- package/dist/components/command-validation-logic.d.cts.map +1 -1
- package/dist/components/command-validation-logic.d.mts +2 -2
- package/dist/components/command-validation-logic.d.mts.map +1 -1
- package/dist/components/docs.d.cts +5 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +5 -5
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/helpers.d.cts +7 -7
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +7 -7
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/options-parser-logic.d.cts +9 -9
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +9 -9
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/usage.d.cts +2 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +2 -2
- package/dist/components/usage.d.mts.map +1 -1
- package/dist/components/utils-builtin.d.cts +9 -9
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +9 -9
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +3 -3
- package/dist/plugin-utils/description-helpers.cjs.map +1 -1
- package/dist/plugin-utils/description-helpers.d.cts +1 -1
- package/dist/plugin-utils/description-helpers.d.mts +1 -1
- package/dist/plugin-utils/description-helpers.mjs +3 -3
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +7 -6
- package/dist/resolver/deepkit.cjs.map +1 -1
- package/dist/resolver/deepkit.mjs +7 -6
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandTree } from "../types/command.cjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/command-validation-logic.d.ts
|
|
5
5
|
interface CommandValidationLogicProps {
|
|
@@ -8,7 +8,7 @@ interface CommandValidationLogicProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* A component that generates command validation logic for required options and arguments.
|
|
10
10
|
*/
|
|
11
|
-
declare function CommandValidationLogic(props: CommandValidationLogicProps): _alloy_js_core0.Children;
|
|
11
|
+
declare function CommandValidationLogic(props: CommandValidationLogicProps): _$_alloy_js_core0.Children;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { CommandValidationLogic, CommandValidationLogicProps };
|
|
14
14
|
//# sourceMappingURL=command-validation-logic.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-validation-logic.d.cts","names":[],"sources":["../../src/components/command-validation-logic.tsx"],"mappings":";;;;UAkCiB,2BAAA;EACf,OAAA,EAAS,WAAA;AAAA;;AADX;;iBAOgB,sBAAA,CAAuB,KAAA,EAAO,2BAAA,GAA2B,
|
|
1
|
+
{"version":3,"file":"command-validation-logic.d.cts","names":[],"sources":["../../src/components/command-validation-logic.tsx"],"mappings":";;;;UAkCiB,2BAAA;EACf,OAAA,EAAS,WAAA;AAAA;;AADX;;iBAOgB,sBAAA,CAAuB,KAAA,EAAO,2BAAA,GAA2B,iBAAA,CAAA,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandTree } from "../types/command.mjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/command-validation-logic.d.ts
|
|
5
5
|
interface CommandValidationLogicProps {
|
|
@@ -8,7 +8,7 @@ interface CommandValidationLogicProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* A component that generates command validation logic for required options and arguments.
|
|
10
10
|
*/
|
|
11
|
-
declare function CommandValidationLogic(props: CommandValidationLogicProps): _alloy_js_core0.Children;
|
|
11
|
+
declare function CommandValidationLogic(props: CommandValidationLogicProps): _$_alloy_js_core0.Children;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { CommandValidationLogic, CommandValidationLogicProps };
|
|
14
14
|
//# sourceMappingURL=command-validation-logic.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-validation-logic.d.mts","names":[],"sources":["../../src/components/command-validation-logic.tsx"],"mappings":";;;;UAkCiB,2BAAA;EACf,OAAA,EAAS,WAAA;AAAA;;AADX;;iBAOgB,sBAAA,CAAuB,KAAA,EAAO,2BAAA,GAA2B,
|
|
1
|
+
{"version":3,"file":"command-validation-logic.d.mts","names":[],"sources":["../../src/components/command-validation-logic.tsx"],"mappings":";;;;UAkCiB,2BAAA;EACf,OAAA,EAAS,WAAA;AAAA;;AADX;;iBAOgB,sBAAA,CAAuB,KAAA,EAAO,2BAAA,GAA2B,iBAAA,CAAA,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandTree } from "../types/command.cjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
import { MarkdownFileProps } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
|
|
4
4
|
|
|
5
5
|
//#region src/components/docs.d.ts
|
|
@@ -12,7 +12,7 @@ interface CommandOptionsDocsProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* Generates the options markdown documentation for a command.
|
|
14
14
|
*/
|
|
15
|
-
declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _alloy_js_core0.Children;
|
|
15
|
+
declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _$_alloy_js_core0.Children;
|
|
16
16
|
interface CommandDocsUsageExampleProps {
|
|
17
17
|
/**
|
|
18
18
|
* The package manager to generate the usage example for.
|
|
@@ -31,7 +31,7 @@ interface CommandDocsUsageExampleProps {
|
|
|
31
31
|
/**
|
|
32
32
|
* Generates the markdown documentation for a command.
|
|
33
33
|
*/
|
|
34
|
-
declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _alloy_js_core0.Children;
|
|
34
|
+
declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _$_alloy_js_core0.Children;
|
|
35
35
|
interface CommandDocsProps {
|
|
36
36
|
/**
|
|
37
37
|
* The heading level offset to apply to the generated documentation.
|
|
@@ -56,7 +56,7 @@ interface CommandDocsProps {
|
|
|
56
56
|
/**
|
|
57
57
|
* Generates the markdown documentation for a command.
|
|
58
58
|
*/
|
|
59
|
-
declare function CommandDocs(props: CommandDocsProps): _alloy_js_core0.Children;
|
|
59
|
+
declare function CommandDocs(props: CommandDocsProps): _$_alloy_js_core0.Children;
|
|
60
60
|
interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
|
|
61
61
|
/**
|
|
62
62
|
* The heading level offset to apply to the generated documentation.
|
|
@@ -75,7 +75,7 @@ interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
|
|
|
75
75
|
/**
|
|
76
76
|
* Generates the markdown documentation file for a command.
|
|
77
77
|
*/
|
|
78
|
-
declare function CommandDocsFile(props: CommandDocsFileProps): _alloy_js_core0.Children;
|
|
78
|
+
declare function CommandDocsFile(props: CommandDocsFileProps): _$_alloy_js_core0.Children;
|
|
79
79
|
//#endregion
|
|
80
80
|
export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps };
|
|
81
81
|
//# sourceMappingURL=docs.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;;UAkCiB,uBAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;AAAA;;;AAMX;iBAAgB,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,
|
|
1
|
+
{"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;;UAkCiB,uBAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;AAAA;;;AAMX;iBAAgB,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,iBAAA,CAAA,QAAA;AAAA,UAwBhD,4BAAA;EAxBgD;;;;;;AAwBjE;;EASE,cAAA;EAKoB;;;EAApB,OAAA,EAAS,WAAA;AAAA;;AAMX;;iBAAgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,iBAAA,CAAA,QAAA;AAAA,UAsB1D,gBAAA;EAtB8B;;;;;AAsB/C;;;EASE,WAAA;EAYyB;;;EAPzB,OAAA,EAAS,WAAA;EALT;;;;;EAYA,aAAA,GAAgB,QAAA,CAAS,4BAAA;AAAA;;AAM3B;;iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA;AAAA,UAwClC,oBAAA,SAA6B,OAAA,CAAQ,iBAAA;EAxCnB;;;;;AAwCnC;;;EASE,WAAA;EAKS;;;EAAT,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,iBAAA,CAAA,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandTree } from "../types/command.mjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
import { MarkdownFileProps } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
|
|
4
4
|
|
|
5
5
|
//#region src/components/docs.d.ts
|
|
@@ -12,7 +12,7 @@ interface CommandOptionsDocsProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* Generates the options markdown documentation for a command.
|
|
14
14
|
*/
|
|
15
|
-
declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _alloy_js_core0.Children;
|
|
15
|
+
declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _$_alloy_js_core0.Children;
|
|
16
16
|
interface CommandDocsUsageExampleProps {
|
|
17
17
|
/**
|
|
18
18
|
* The package manager to generate the usage example for.
|
|
@@ -31,7 +31,7 @@ interface CommandDocsUsageExampleProps {
|
|
|
31
31
|
/**
|
|
32
32
|
* Generates the markdown documentation for a command.
|
|
33
33
|
*/
|
|
34
|
-
declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _alloy_js_core0.Children;
|
|
34
|
+
declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _$_alloy_js_core0.Children;
|
|
35
35
|
interface CommandDocsProps {
|
|
36
36
|
/**
|
|
37
37
|
* The heading level offset to apply to the generated documentation.
|
|
@@ -56,7 +56,7 @@ interface CommandDocsProps {
|
|
|
56
56
|
/**
|
|
57
57
|
* Generates the markdown documentation for a command.
|
|
58
58
|
*/
|
|
59
|
-
declare function CommandDocs(props: CommandDocsProps): _alloy_js_core0.Children;
|
|
59
|
+
declare function CommandDocs(props: CommandDocsProps): _$_alloy_js_core0.Children;
|
|
60
60
|
interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
|
|
61
61
|
/**
|
|
62
62
|
* The heading level offset to apply to the generated documentation.
|
|
@@ -75,7 +75,7 @@ interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
|
|
|
75
75
|
/**
|
|
76
76
|
* Generates the markdown documentation file for a command.
|
|
77
77
|
*/
|
|
78
|
-
declare function CommandDocsFile(props: CommandDocsFileProps): _alloy_js_core0.Children;
|
|
78
|
+
declare function CommandDocsFile(props: CommandDocsFileProps): _$_alloy_js_core0.Children;
|
|
79
79
|
//#endregion
|
|
80
80
|
export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps };
|
|
81
81
|
//# sourceMappingURL=docs.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;;UAkCiB,uBAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;AAAA;;;AAMX;iBAAgB,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,
|
|
1
|
+
{"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;;UAkCiB,uBAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;AAAA;;;AAMX;iBAAgB,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,iBAAA,CAAA,QAAA;AAAA,UAwBhD,4BAAA;EAxBgD;;;;;;AAwBjE;;EASE,cAAA;EAKoB;;;EAApB,OAAA,EAAS,WAAA;AAAA;;AAMX;;iBAAgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,iBAAA,CAAA,QAAA;AAAA,UAsB1D,gBAAA;EAtB8B;;;;;AAsB/C;;;EASE,WAAA;EAYyB;;;EAPzB,OAAA,EAAS,WAAA;EALT;;;;;EAYA,aAAA,GAAgB,QAAA,CAAS,4BAAA;AAAA;;AAM3B;;iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA;AAAA,UAwClC,oBAAA,SAA6B,OAAA,CAAQ,iBAAA;EAxCnB;;;;;AAwCnC;;;EASE,WAAA;EAKS;;;EAAT,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,iBAAA,CAAA,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandParameter } from "../types/command.cjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/helpers.d.ts
|
|
5
5
|
interface BooleanInputParserLogicProps {
|
|
@@ -8,35 +8,35 @@ interface BooleanInputParserLogicProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
|
|
10
10
|
*/
|
|
11
|
-
declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core0.Children;
|
|
11
|
+
declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _$_alloy_js_core0.Children;
|
|
12
12
|
/**
|
|
13
13
|
* Write the logic to determine if the application is running in debug mode.
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
16
|
* This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.
|
|
17
17
|
*/
|
|
18
|
-
declare function IsDebug(): _alloy_js_core0.Children;
|
|
18
|
+
declare function IsDebug(): _$_alloy_js_core0.Children;
|
|
19
19
|
/**
|
|
20
20
|
* Write the logic to determine if the application is **not** running in debug mode.
|
|
21
21
|
*/
|
|
22
|
-
declare function IsNotDebug(): _alloy_js_core0.Children;
|
|
22
|
+
declare function IsNotDebug(): _$_alloy_js_core0.Children;
|
|
23
23
|
/**
|
|
24
24
|
* Write the logic to determine if the application is running in verbose mode.
|
|
25
25
|
*
|
|
26
26
|
* @remarks
|
|
27
27
|
* This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.
|
|
28
28
|
*/
|
|
29
|
-
declare function IsVerbose(): _alloy_js_core0.Children;
|
|
29
|
+
declare function IsVerbose(): _$_alloy_js_core0.Children;
|
|
30
30
|
/**
|
|
31
31
|
* Write the logic to determine if the application is **not** running in verbose mode.
|
|
32
32
|
*/
|
|
33
|
-
declare function IsNotVerbose(): _alloy_js_core0.Children;
|
|
33
|
+
declare function IsNotVerbose(): _$_alloy_js_core0.Children;
|
|
34
34
|
/**
|
|
35
35
|
* Write the type declaration for a command parameter based on its configuration.
|
|
36
36
|
*/
|
|
37
37
|
declare function CommandParameterType(props: {
|
|
38
38
|
parameter: CommandParameter;
|
|
39
|
-
}): _alloy_js_core0.Children;
|
|
39
|
+
}): _$_alloy_js_core0.Children;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
|
|
42
42
|
//# sourceMappingURL=helpers.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":";;;;UAsBiB,4BAAA;EACf,IAAA;AAAA;;AADF;;iBAOgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,
|
|
1
|
+
{"version":3,"file":"helpers.d.cts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":";;;;UAsBiB,4BAAA;EACf,IAAA;AAAA;;AADF;;iBAOgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,iBAAA,CAAA,QAAA;;;AAA3E;;;;iBA0BgB,OAAA,CAAA,GAAO,iBAAA,CAAA,QAAA;;;;iBAOP,UAAA,CAAA,GAAU,iBAAA,CAAA,QAAA;AAP1B;;;;;AAOA;AAPA,iBAuBgB,SAAA,CAAA,GAAS,iBAAA,CAAA,QAAA;;;;iBAaT,YAAA,CAAA,GAAY,iBAAA,CAAA,QAAA;;;;iBAaZ,oBAAA,CAAqB,KAAA;EAAS,SAAA,EAAW,gBAAA;AAAA,IAAgB,iBAAA,CAAE,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandParameter } from "../types/command.mjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/helpers.d.ts
|
|
5
5
|
interface BooleanInputParserLogicProps {
|
|
@@ -8,35 +8,35 @@ interface BooleanInputParserLogicProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
|
|
10
10
|
*/
|
|
11
|
-
declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core0.Children;
|
|
11
|
+
declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _$_alloy_js_core0.Children;
|
|
12
12
|
/**
|
|
13
13
|
* Write the logic to determine if the application is running in debug mode.
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
16
|
* This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.
|
|
17
17
|
*/
|
|
18
|
-
declare function IsDebug(): _alloy_js_core0.Children;
|
|
18
|
+
declare function IsDebug(): _$_alloy_js_core0.Children;
|
|
19
19
|
/**
|
|
20
20
|
* Write the logic to determine if the application is **not** running in debug mode.
|
|
21
21
|
*/
|
|
22
|
-
declare function IsNotDebug(): _alloy_js_core0.Children;
|
|
22
|
+
declare function IsNotDebug(): _$_alloy_js_core0.Children;
|
|
23
23
|
/**
|
|
24
24
|
* Write the logic to determine if the application is running in verbose mode.
|
|
25
25
|
*
|
|
26
26
|
* @remarks
|
|
27
27
|
* This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.
|
|
28
28
|
*/
|
|
29
|
-
declare function IsVerbose(): _alloy_js_core0.Children;
|
|
29
|
+
declare function IsVerbose(): _$_alloy_js_core0.Children;
|
|
30
30
|
/**
|
|
31
31
|
* Write the logic to determine if the application is **not** running in verbose mode.
|
|
32
32
|
*/
|
|
33
|
-
declare function IsNotVerbose(): _alloy_js_core0.Children;
|
|
33
|
+
declare function IsNotVerbose(): _$_alloy_js_core0.Children;
|
|
34
34
|
/**
|
|
35
35
|
* Write the type declaration for a command parameter based on its configuration.
|
|
36
36
|
*/
|
|
37
37
|
declare function CommandParameterType(props: {
|
|
38
38
|
parameter: CommandParameter;
|
|
39
|
-
}): _alloy_js_core0.Children;
|
|
39
|
+
}): _$_alloy_js_core0.Children;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { BooleanInputParserLogic, BooleanInputParserLogicProps, CommandParameterType, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
|
|
42
42
|
//# sourceMappingURL=helpers.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":";;;;UAsBiB,4BAAA;EACf,IAAA;AAAA;;AADF;;iBAOgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,
|
|
1
|
+
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"mappings":";;;;UAsBiB,4BAAA;EACf,IAAA;AAAA;;AADF;;iBAOgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,iBAAA,CAAA,QAAA;;;AAA3E;;;;iBA0BgB,OAAA,CAAA,GAAO,iBAAA,CAAA,QAAA;;;;iBAOP,UAAA,CAAA,GAAU,iBAAA,CAAA,QAAA;AAP1B;;;;;AAOA;AAPA,iBAuBgB,SAAA,CAAA,GAAS,iBAAA,CAAA,QAAA;;;;iBAaT,YAAA,CAAA,GAAY,iBAAA,CAAA,QAAA;;;;iBAaZ,oBAAA,CAAqB,KAAA;EAAS,SAAA,EAAW,gBAAA;AAAA,IAAgB,iBAAA,CAAE,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandOption, CommandTree } from "../types/command.cjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/options-parser-logic.d.ts
|
|
5
5
|
interface DynamicSegmentsParserLogicProps {
|
|
@@ -12,7 +12,7 @@ interface DynamicSegmentsParserLogicProps {
|
|
|
12
12
|
*/
|
|
13
13
|
isCaseSensitive: boolean;
|
|
14
14
|
}
|
|
15
|
-
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _alloy_js_core0.Children;
|
|
15
|
+
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _$_alloy_js_core0.Children;
|
|
16
16
|
interface ArgumentsParserLogicProps {
|
|
17
17
|
/**
|
|
18
18
|
* The command to generate the positional parameters parser logic for.
|
|
@@ -27,7 +27,7 @@ interface ArgumentsParserLogicProps {
|
|
|
27
27
|
*/
|
|
28
28
|
isCaseSensitive: boolean;
|
|
29
29
|
}
|
|
30
|
-
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _alloy_js_core0.Children;
|
|
30
|
+
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _$_alloy_js_core0.Children;
|
|
31
31
|
/**
|
|
32
32
|
* The command option interface property.
|
|
33
33
|
*/
|
|
@@ -35,7 +35,7 @@ declare function OptionsMember({
|
|
|
35
35
|
option
|
|
36
36
|
}: {
|
|
37
37
|
option: CommandOption;
|
|
38
|
-
}): _alloy_js_core0.Children;
|
|
38
|
+
}): _$_alloy_js_core0.Children;
|
|
39
39
|
interface OptionsMemberParserLogicProps {
|
|
40
40
|
/**
|
|
41
41
|
* The option name to generate the parser logic for.
|
|
@@ -55,7 +55,7 @@ interface OptionsMemberParserLogicProps {
|
|
|
55
55
|
/**
|
|
56
56
|
* The command option property parser logic.
|
|
57
57
|
*/
|
|
58
|
-
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _alloy_js_core0.Children;
|
|
58
|
+
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _$_alloy_js_core0.Children;
|
|
59
59
|
interface OptionsMemberParserConditionProps {
|
|
60
60
|
/**
|
|
61
61
|
* The option name to generate the parser logic for.
|
|
@@ -72,10 +72,10 @@ interface OptionsMemberParserConditionProps {
|
|
|
72
72
|
*/
|
|
73
73
|
isCaseSensitive: boolean;
|
|
74
74
|
}
|
|
75
|
-
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _alloy_js_core0.Children;
|
|
75
|
+
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _$_alloy_js_core0.Children;
|
|
76
76
|
declare function OptionsInterfaceDeclaration(props: {
|
|
77
77
|
command: CommandTree;
|
|
78
|
-
}): _alloy_js_core0.Children;
|
|
78
|
+
}): _$_alloy_js_core0.Children;
|
|
79
79
|
interface OptionsParserLogicProps {
|
|
80
80
|
/**
|
|
81
81
|
* The command to generate the options parser logic for.
|
|
@@ -95,7 +95,7 @@ interface OptionsParserLogicProps {
|
|
|
95
95
|
/**
|
|
96
96
|
* The command options parser logic.
|
|
97
97
|
*/
|
|
98
|
-
declare function OptionsParserLogic(props: OptionsParserLogicProps): _alloy_js_core0.Children;
|
|
98
|
+
declare function OptionsParserLogic(props: OptionsParserLogicProps): _$_alloy_js_core0.Children;
|
|
99
99
|
interface CommandParserLogicProps {
|
|
100
100
|
/**
|
|
101
101
|
* The command to generate the parser logic for.
|
|
@@ -115,7 +115,7 @@ interface CommandParserLogicProps {
|
|
|
115
115
|
/**
|
|
116
116
|
* The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
|
|
117
117
|
*/
|
|
118
|
-
declare function CommandParserLogic(props: CommandParserLogicProps): _alloy_js_core0.Children;
|
|
118
|
+
declare function CommandParserLogic(props: CommandParserLogicProps): _$_alloy_js_core0.Children;
|
|
119
119
|
//#endregion
|
|
120
120
|
export { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps };
|
|
121
121
|
//# sourceMappingURL=options-parser-logic.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-parser-logic.d.cts","names":[],"sources":["../../src/components/options-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A;;;;iBAMc,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,iBAAA,CAAA,QAAA;AAAA,UA0IhD,uBAAA;EA9K0B;;;EAkLzC,OAAA,EAAS,WAAA;EAlLmD;;;EAuL5D,oBAAA;EAvLyE;AAc3E;;;;EAgLE,eAAA;AAAA;;;;iBAMc,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,iBAAA,CAAA,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandOption, CommandTree } from "../types/command.mjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/options-parser-logic.d.ts
|
|
5
5
|
interface DynamicSegmentsParserLogicProps {
|
|
@@ -12,7 +12,7 @@ interface DynamicSegmentsParserLogicProps {
|
|
|
12
12
|
*/
|
|
13
13
|
isCaseSensitive: boolean;
|
|
14
14
|
}
|
|
15
|
-
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _alloy_js_core0.Children;
|
|
15
|
+
declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _$_alloy_js_core0.Children;
|
|
16
16
|
interface ArgumentsParserLogicProps {
|
|
17
17
|
/**
|
|
18
18
|
* The command to generate the positional parameters parser logic for.
|
|
@@ -27,7 +27,7 @@ interface ArgumentsParserLogicProps {
|
|
|
27
27
|
*/
|
|
28
28
|
isCaseSensitive: boolean;
|
|
29
29
|
}
|
|
30
|
-
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _alloy_js_core0.Children;
|
|
30
|
+
declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _$_alloy_js_core0.Children;
|
|
31
31
|
/**
|
|
32
32
|
* The command option interface property.
|
|
33
33
|
*/
|
|
@@ -35,7 +35,7 @@ declare function OptionsMember({
|
|
|
35
35
|
option
|
|
36
36
|
}: {
|
|
37
37
|
option: CommandOption;
|
|
38
|
-
}): _alloy_js_core0.Children;
|
|
38
|
+
}): _$_alloy_js_core0.Children;
|
|
39
39
|
interface OptionsMemberParserLogicProps {
|
|
40
40
|
/**
|
|
41
41
|
* The option name to generate the parser logic for.
|
|
@@ -55,7 +55,7 @@ interface OptionsMemberParserLogicProps {
|
|
|
55
55
|
/**
|
|
56
56
|
* The command option property parser logic.
|
|
57
57
|
*/
|
|
58
|
-
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _alloy_js_core0.Children;
|
|
58
|
+
declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _$_alloy_js_core0.Children;
|
|
59
59
|
interface OptionsMemberParserConditionProps {
|
|
60
60
|
/**
|
|
61
61
|
* The option name to generate the parser logic for.
|
|
@@ -72,10 +72,10 @@ interface OptionsMemberParserConditionProps {
|
|
|
72
72
|
*/
|
|
73
73
|
isCaseSensitive: boolean;
|
|
74
74
|
}
|
|
75
|
-
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _alloy_js_core0.Children;
|
|
75
|
+
declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _$_alloy_js_core0.Children;
|
|
76
76
|
declare function OptionsInterfaceDeclaration(props: {
|
|
77
77
|
command: CommandTree;
|
|
78
|
-
}): _alloy_js_core0.Children;
|
|
78
|
+
}): _$_alloy_js_core0.Children;
|
|
79
79
|
interface OptionsParserLogicProps {
|
|
80
80
|
/**
|
|
81
81
|
* The command to generate the options parser logic for.
|
|
@@ -95,7 +95,7 @@ interface OptionsParserLogicProps {
|
|
|
95
95
|
/**
|
|
96
96
|
* The command options parser logic.
|
|
97
97
|
*/
|
|
98
|
-
declare function OptionsParserLogic(props: OptionsParserLogicProps): _alloy_js_core0.Children;
|
|
98
|
+
declare function OptionsParserLogic(props: OptionsParserLogicProps): _$_alloy_js_core0.Children;
|
|
99
99
|
interface CommandParserLogicProps {
|
|
100
100
|
/**
|
|
101
101
|
* The command to generate the parser logic for.
|
|
@@ -115,7 +115,7 @@ interface CommandParserLogicProps {
|
|
|
115
115
|
/**
|
|
116
116
|
* The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
|
|
117
117
|
*/
|
|
118
|
-
declare function CommandParserLogic(props: CommandParserLogicProps): _alloy_js_core0.Children;
|
|
118
|
+
declare function CommandParserLogic(props: CommandParserLogicProps): _$_alloy_js_core0.Children;
|
|
119
119
|
//#endregion
|
|
120
120
|
export { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps };
|
|
121
121
|
//# sourceMappingURL=options-parser-logic.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options-parser-logic.d.mts","names":[],"sources":["../../src/components/options-parser-logic.tsx"],"mappings":";;;;UA+CiB,+BAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;;;;EAKT,eAAA;AAAA;AAAA,iBAGc,0BAAA,CACd,KAAA,EAAO,+BAAA,GAA+B,
|
|
1
|
+
{"version":3,"file":"options-parser-logic.d.mts","names":[],"sources":["../../src/components/options-parser-logic.tsx"],"mappings":";;;;UA+CiB,+BAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;;;;EAKT,eAAA;AAAA;AAAA,iBAGc,0BAAA,CACd,KAAA,EAAO,+BAAA,GAA+B,iBAAA,CAAA,QAAA;AAAA,UA4BvB,yBAAA;EA7BD;;;EAiCd,OAAA,EAAS,WAAA;EAhCF;;;EAqCP,oBAAA;EArCsC;AA4BxC;;EAcE,eAAA;AAAA;AAAA,iBAGc,oBAAA,CAAqB,KAAA,EAAO,yBAAA,GAAyB,iBAAA,CAAA,QAAA;;;;iBA+KrD,aAAA,CAAA;EAAgB;AAAA;EAAY,MAAA,EAAQ,aAAA;AAAA,IAAa,iBAAA,CAAE,QAAA;AAAA,UAmClD,6BAAA;;;;EAIf,IAAA;EAtNmE;;;EA2NnE,MAAA,EAAQ,aAAA;EA5CmB;;;;;EAmD3B,eAAA;AAAA;;;;iBAMc,wBAAA,CAAyB,KAAA,EAAO,6BAAA,GAA6B,iBAAA,CAAA,QAAA;AAAA,UAsO5D,iCAAA;EA/RgD;;AAmCjE;EAgQE,IAAA;;;;EAKA,KAAA;EA5PQ;;;;AAaV;EAsPE,eAAA;AAAA;AAAA,iBAGc,4BAAA,CACd,KAAA,EAAO,iCAAA,GAAiC,iBAAA,CAAA,QAAA;AAAA,iBAkE1B,2BAAA,CAA4B,KAAA;EAAS,OAAA,EAAS,WAAA;AAAA,IAAW,iBAAA,CAAE,QAAA;AAAA,UAc1D,uBAAA;EA1U4D;AAsO7E;;EAwGE,OAAA,EAAS,WAAA;EAxGuC;;;EA6GhD,oBAAA;EA7Fe;;AAGjB;;;EAiGE,eAAA;AAAA;;;;iBAMc,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,iBAAA,CAAA,QAAA;AAAA,UA0IhD,uBAAA;EA9K0B;;;EAkLzC,OAAA,EAAS,WAAA;EAlLmD;;;EAuL5D,oBAAA;EAvLyE;AAc3E;;;;EAgLE,eAAA;AAAA;;;;iBAMc,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,iBAAA,CAAA,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandTree } from "../types/command.cjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/usage.d.ts
|
|
5
5
|
interface UsageProps {
|
|
@@ -22,7 +22,7 @@ interface UsageProps {
|
|
|
22
22
|
/**
|
|
23
23
|
* A component that generates the usage display for a command.
|
|
24
24
|
*/
|
|
25
|
-
declare function Usage(props: UsageProps): _alloy_js_core0.Children;
|
|
25
|
+
declare function Usage(props: UsageProps): _$_alloy_js_core0.Children;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { Usage, UsageProps };
|
|
28
28
|
//# sourceMappingURL=usage.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.cts","names":[],"sources":["../../src/components/usage.tsx"],"mappings":";;;;UA2BiB,UAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;;;;;;;EAQT,cAAA;EAKG;AAML;;EANE,GAAA;AAAA;;;;iBAMc,KAAA,CAAM,KAAA,EAAO,UAAA,GAAU,
|
|
1
|
+
{"version":3,"file":"usage.d.cts","names":[],"sources":["../../src/components/usage.tsx"],"mappings":";;;;UA2BiB,UAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;;;;;;;EAQT,cAAA;EAKG;AAML;;EANE,GAAA;AAAA;;;;iBAMc,KAAA,CAAM,KAAA,EAAO,UAAA,GAAU,iBAAA,CAAA,QAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommandTree } from "../types/command.mjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/components/usage.d.ts
|
|
5
5
|
interface UsageProps {
|
|
@@ -22,7 +22,7 @@ interface UsageProps {
|
|
|
22
22
|
/**
|
|
23
23
|
* A component that generates the usage display for a command.
|
|
24
24
|
*/
|
|
25
|
-
declare function Usage(props: UsageProps): _alloy_js_core0.Children;
|
|
25
|
+
declare function Usage(props: UsageProps): _$_alloy_js_core0.Children;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { Usage, UsageProps };
|
|
28
28
|
//# sourceMappingURL=usage.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.mts","names":[],"sources":["../../src/components/usage.tsx"],"mappings":";;;;UA2BiB,UAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;;;;;;;EAQT,cAAA;EAKG;AAML;;EANE,GAAA;AAAA;;;;iBAMc,KAAA,CAAM,KAAA,EAAO,UAAA,GAAU,
|
|
1
|
+
{"version":3,"file":"usage.d.mts","names":[],"sources":["../../src/components/usage.tsx"],"mappings":";;;;UA2BiB,UAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;;;;;;;EAQT,cAAA;EAKG;AAML;;EANE,GAAA;AAAA;;;;iBAMc,KAAA,CAAM,KAAA,EAAO,UAAA,GAAU,iBAAA,CAAA,QAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
1
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
3
|
|
|
4
4
|
//#region src/components/utils-builtin.d.ts
|
|
@@ -6,32 +6,32 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.
|
|
8
8
|
*/
|
|
9
|
-
declare function FindSuggestionsDeclaration(): _alloy_js_core0.Children;
|
|
9
|
+
declare function FindSuggestionsDeclaration(): _$_alloy_js_core0.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Generates utilities for detecting terminal color support.
|
|
12
12
|
*/
|
|
13
|
-
declare function EnvSupportUtilities(): _alloy_js_core0.Children;
|
|
13
|
+
declare function EnvSupportUtilities(): _$_alloy_js_core0.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Generates utilities for detecting terminal color support.
|
|
16
16
|
*/
|
|
17
|
-
declare function ColorSupportUtilities(): _alloy_js_core0.Children;
|
|
17
|
+
declare function ColorSupportUtilities(): _$_alloy_js_core0.Children;
|
|
18
18
|
/**
|
|
19
19
|
* Generates utilities for detecting terminal color support.
|
|
20
20
|
*/
|
|
21
|
-
declare function HyperlinkSupportUtilities(): _alloy_js_core0.Children;
|
|
21
|
+
declare function HyperlinkSupportUtilities(): _$_alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* Generates utilities for detecting terminal color support.
|
|
24
24
|
*/
|
|
25
|
-
declare function ArgsUtilities(): _alloy_js_core0.Children;
|
|
25
|
+
declare function ArgsUtilities(): _$_alloy_js_core0.Children;
|
|
26
26
|
/**
|
|
27
27
|
* Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.
|
|
28
28
|
*/
|
|
29
|
-
declare function SpawnFunctionDeclaration(): _alloy_js_core0.Children;
|
|
30
|
-
declare function ContextUtilities(): _alloy_js_core0.Children;
|
|
29
|
+
declare function SpawnFunctionDeclaration(): _$_alloy_js_core0.Children;
|
|
30
|
+
declare function ContextUtilities(): _$_alloy_js_core0.Children;
|
|
31
31
|
/**
|
|
32
32
|
* A built-in utilities module for Shell Shock.
|
|
33
33
|
*/
|
|
34
|
-
declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core0.Children;
|
|
34
|
+
declare function UtilsBuiltin(props: UtilsBuiltinProps): _$_alloy_js_core0.Children;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps };
|
|
37
37
|
//# sourceMappingURL=utils-builtin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"mappings":";;;;UAyCiB,iBAAA,SAA0B,IAAA,CACzC,gBAAA;;AADF;;iBAQgB,0BAAA,CAAA,GAA0B,
|
|
1
|
+
{"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"mappings":";;;;UAyCiB,iBAAA,SAA0B,IAAA,CACzC,gBAAA;;AADF;;iBAQgB,0BAAA,CAAA,GAA0B,iBAAA,CAAA,QAAA;;;AAA1C;iBA0MgB,mBAAA,CAAA,GAAmB,iBAAA,CAAA,QAAA;;;;iBAiCnB,qBAAA,CAAA,GAAqB,iBAAA,CAAA,QAAA;;;;iBAsMrB,yBAAA,CAAA,GAAyB,iBAAA,CAAA,QAAA;AAtMzC;;;AAAA,iBAgTgB,aAAA,CAAA,GAAa,iBAAA,CAAA,QAAA;;AA1G7B;;iBAuLgB,wBAAA,CAAA,GAAwB,iBAAA,CAAA,QAAA;AAAA,iBAkTxB,gBAAA,CAAA,GAAgB,iBAAA,CAAA,QAAA;;AA/XhC;;iBAqdgB,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAiB,iBAAA,CAAA,QAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
1
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
3
|
|
|
4
4
|
//#region src/components/utils-builtin.d.ts
|
|
@@ -6,32 +6,32 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.
|
|
8
8
|
*/
|
|
9
|
-
declare function FindSuggestionsDeclaration(): _alloy_js_core0.Children;
|
|
9
|
+
declare function FindSuggestionsDeclaration(): _$_alloy_js_core0.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Generates utilities for detecting terminal color support.
|
|
12
12
|
*/
|
|
13
|
-
declare function EnvSupportUtilities(): _alloy_js_core0.Children;
|
|
13
|
+
declare function EnvSupportUtilities(): _$_alloy_js_core0.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Generates utilities for detecting terminal color support.
|
|
16
16
|
*/
|
|
17
|
-
declare function ColorSupportUtilities(): _alloy_js_core0.Children;
|
|
17
|
+
declare function ColorSupportUtilities(): _$_alloy_js_core0.Children;
|
|
18
18
|
/**
|
|
19
19
|
* Generates utilities for detecting terminal color support.
|
|
20
20
|
*/
|
|
21
|
-
declare function HyperlinkSupportUtilities(): _alloy_js_core0.Children;
|
|
21
|
+
declare function HyperlinkSupportUtilities(): _$_alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* Generates utilities for detecting terminal color support.
|
|
24
24
|
*/
|
|
25
|
-
declare function ArgsUtilities(): _alloy_js_core0.Children;
|
|
25
|
+
declare function ArgsUtilities(): _$_alloy_js_core0.Children;
|
|
26
26
|
/**
|
|
27
27
|
* Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.
|
|
28
28
|
*/
|
|
29
|
-
declare function SpawnFunctionDeclaration(): _alloy_js_core0.Children;
|
|
30
|
-
declare function ContextUtilities(): _alloy_js_core0.Children;
|
|
29
|
+
declare function SpawnFunctionDeclaration(): _$_alloy_js_core0.Children;
|
|
30
|
+
declare function ContextUtilities(): _$_alloy_js_core0.Children;
|
|
31
31
|
/**
|
|
32
32
|
* A built-in utilities module for Shell Shock.
|
|
33
33
|
*/
|
|
34
|
-
declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core0.Children;
|
|
34
|
+
declare function UtilsBuiltin(props: UtilsBuiltinProps): _$_alloy_js_core0.Children;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps };
|
|
37
37
|
//# sourceMappingURL=utils-builtin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"mappings":";;;;UAyCiB,iBAAA,SAA0B,IAAA,CACzC,gBAAA;;AADF;;iBAQgB,0BAAA,CAAA,GAA0B,
|
|
1
|
+
{"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"mappings":";;;;UAyCiB,iBAAA,SAA0B,IAAA,CACzC,gBAAA;;AADF;;iBAQgB,0BAAA,CAAA,GAA0B,iBAAA,CAAA,QAAA;;;AAA1C;iBA0MgB,mBAAA,CAAA,GAAmB,iBAAA,CAAA,QAAA;;;;iBAiCnB,qBAAA,CAAA,GAAqB,iBAAA,CAAA,QAAA;;;;iBAsMrB,yBAAA,CAAA,GAAyB,iBAAA,CAAA,QAAA;AAtMzC;;;AAAA,iBAgTgB,aAAA,CAAA,GAAa,iBAAA,CAAA,QAAA;;AA1G7B;;iBAuLgB,wBAAA,CAAA,GAAwB,iBAAA,CAAA,QAAA;AAAA,iBAkTxB,gBAAA,CAAA,GAAgB,iBAAA,CAAA,QAAA;;AA/XhC;;iBAqdgB,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAiB,iBAAA,CAAA,QAAA"}
|
|
@@ -70,7 +70,7 @@ formatDescription.__type = [
|
|
|
70
70
|
const __ΩFormatShortDescriptionOptions = [
|
|
71
71
|
() => __ΩFormatDescriptionOptions,
|
|
72
72
|
"length",
|
|
73
|
-
|
|
73
|
+
62,
|
|
74
74
|
"FormatShortDescriptionOptions",
|
|
75
75
|
"Pn!'4\"8>#Mw$y"
|
|
76
76
|
];
|
|
@@ -82,9 +82,9 @@ const __ΩFormatShortDescriptionOptions = [
|
|
|
82
82
|
* @returns The extracted short description.
|
|
83
83
|
*/
|
|
84
84
|
function formatShortDescription(description, options = {}) {
|
|
85
|
-
const length = options.length ??
|
|
85
|
+
const length = options.length ?? 62;
|
|
86
86
|
const formattedDescription = formatDescriptionWhitespace(description, options);
|
|
87
|
-
let result = ((formattedDescription.indexOf("\n") < length
|
|
87
|
+
let result = ((formattedDescription.indexOf("\n") < length - 3 || formattedDescription.search(/[.!?\n]\s*\S/) > length - 3 ? formattedDescription.match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0, -1)?.trim() : void 0) || formattedDescription).trim();
|
|
88
88
|
if (result.trim().length > length) result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;
|
|
89
89
|
return formatDescriptionEscapes(result);
|
|
90
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"description-helpers.cjs","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue
|
|
1
|
+
{"version":3,"file":"description-helpers.cjs","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue 62\n */\n length?: number;\n}\n\n/**\n * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.\n *\n * @param description - The full description string.\n * @param options - Options for formatting the short description, including the maximum length.\n * @returns The extracted short description.\n */\nexport function formatShortDescription(\n description: string,\n options: FormatShortDescriptionOptions = {}\n): string {\n const length = options.length ?? 62;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length - 3 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length - 3\n ? formattedDescription\n .match(/^.*[.!?\\n]\\s?\\S/)?.[0]\n ?.trim()\n ?.slice(0, -1)\n ?.trim()\n : undefined;\n\n let result = (firstSentenceMatch || formattedDescription).trim();\n if (result.trim().length > length) {\n result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;\n }\n\n return formatDescriptionEscapes(result);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAAG,4BAAA,aAAA,UAAA,EAAA,EAAA;CACC,IAAE,uBAAa,YAAA,MAAA;AACf,KAAA,QAAA,gBACF,wBAA4B,qBAAA,QAAA,aAAA,IAAA;gCAG5B,wBAAA,qBAAA,QAAA,WAAA,IAAA;AAED,QAAA,qBAAA,MAAA;;AAED,4BAAsB,SAAc;CAAA;OAAiB;CAAgC;QAAqB,EAAE;CAAC;CAAa;CAAA;;;;;;;;;;AAU1H,SAAM,yBAAyB,aAAA;AAC3B,QAAA,YACF,WAAA,KAAA,MAAA,CACI,WAAQ,MAAA,OAAA,CACV,WAAA,KAAqB,MAAE,CACzB,QAAA,SAAA,OAAA;;AAEF,yBAAS,SAAyB;CAAC;CAAC;CAAA;CAAA;;;;;;;;;;AAUpC,SAAgB,kBAAU,aAAkB,UAAA,EAAA,EAAA;AAC1C,QAAA,yBAAA,4BAAA,aAAA,QAAA,CAAA;;AAEF,kBAAS,SAAA;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA;AACT,MAAK,mCAAqB;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAS1B,SAAI,uBAAA,aAAA,UAAA,EAAA,EAAA;CACD,MAAO,SAAQ,QAAI,UAAc;CACnC,MAAA,uBAAA,4BAAA,aAAA,QAAA;CASG,IAAA,WARwB,qBAAuB,QAAA,KAAA,GAAA,SAAA,KAC/C,qBAAsB,OAAA,eAAkB,GAAA,SAAA,IAC1C,qBACK,MAAS,kBAAiB,GAAA,IACnB,MAAC,EACJ,MAAA,GAAA,GAAA,EACD,MAAA,GACD,WACuB,sBAAoB,MAAA;AACjD,KAAA,OAAA,MAAA,CAAA,SAAA,OACH,UAAA,GAAA,OAAA,UAAA,GAAA,KAAA,IAAA,GAAA,SAAA,EAAA,CAAA,CAAA,MAAA,CAAA;AAEA,QAAO,yBAAU,OAAA;;AAEjB,uBAAuB,SAAQ;CAAA;OAAsB;CAAgC;QAAmB,EAAA;CAAA;CAAS;CAAA"}
|
|
@@ -27,7 +27,7 @@ interface FormatShortDescriptionOptions extends FormatDescriptionOptions {
|
|
|
27
27
|
/**
|
|
28
28
|
* The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.
|
|
29
29
|
*
|
|
30
|
-
* @defaultValue
|
|
30
|
+
* @defaultValue 62
|
|
31
31
|
*/
|
|
32
32
|
length?: number;
|
|
33
33
|
}
|
|
@@ -27,7 +27,7 @@ interface FormatShortDescriptionOptions extends FormatDescriptionOptions {
|
|
|
27
27
|
/**
|
|
28
28
|
* The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.
|
|
29
29
|
*
|
|
30
|
-
* @defaultValue
|
|
30
|
+
* @defaultValue 62
|
|
31
31
|
*/
|
|
32
32
|
length?: number;
|
|
33
33
|
}
|
|
@@ -69,7 +69,7 @@ formatDescription.__type = [
|
|
|
69
69
|
const __ΩFormatShortDescriptionOptions = [
|
|
70
70
|
() => __ΩFormatDescriptionOptions,
|
|
71
71
|
"length",
|
|
72
|
-
|
|
72
|
+
62,
|
|
73
73
|
"FormatShortDescriptionOptions",
|
|
74
74
|
"Pn!'4\"8>#Mw$y"
|
|
75
75
|
];
|
|
@@ -81,9 +81,9 @@ const __ΩFormatShortDescriptionOptions = [
|
|
|
81
81
|
* @returns The extracted short description.
|
|
82
82
|
*/
|
|
83
83
|
function formatShortDescription(description, options = {}) {
|
|
84
|
-
const length = options.length ??
|
|
84
|
+
const length = options.length ?? 62;
|
|
85
85
|
const formattedDescription = formatDescriptionWhitespace(description, options);
|
|
86
|
-
let result = ((formattedDescription.indexOf("\n") < length
|
|
86
|
+
let result = ((formattedDescription.indexOf("\n") < length - 3 || formattedDescription.search(/[.!?\n]\s*\S/) > length - 3 ? formattedDescription.match(/^.*[.!?\n]\s?\S/)?.[0]?.trim()?.slice(0, -1)?.trim() : void 0) || formattedDescription).trim();
|
|
87
87
|
if (result.trim().length > length) result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;
|
|
88
88
|
return formatDescriptionEscapes(result);
|
|
89
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"description-helpers.mjs","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue
|
|
1
|
+
{"version":3,"file":"description-helpers.mjs","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue 62\n */\n length?: number;\n}\n\n/**\n * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.\n *\n * @param description - The full description string.\n * @param options - Options for formatting the short description, including the maximum length.\n * @returns The extracted short description.\n */\nexport function formatShortDescription(\n description: string,\n options: FormatShortDescriptionOptions = {}\n): string {\n const length = options.length ?? 62;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length - 3 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length - 3\n ? formattedDescription\n .match(/^.*[.!?\\n]\\s?\\S/)?.[0]\n ?.trim()\n ?.slice(0, -1)\n ?.trim()\n : undefined;\n\n let result = (firstSentenceMatch || formattedDescription).trim();\n if (result.trim().length > length) {\n result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;\n }\n\n return formatDescriptionEscapes(result);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,SAAG,4BAAA,aAAA,UAAA,EAAA,EAAA;CACC,IAAE,uBAAa,YAAA,MAAA;AACf,KAAA,QAAA,gBACF,wBAA4B,qBAAA,QAAA,aAAA,IAAA;gCAG5B,wBAAA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endor_type.ReflectionKind.literal) argument.choices = [(0, _stryke_type_checks_is_number.isNumber)(type.literal) ? type.literal : (0, _stryke_type_checks_is_bigint.isBigInt)(type.literal) ? Number(type.literal) : (0, _stryke_type_checks_is_regexp.isRegExp)(type.literal) ? type.literal.source : String(type.literal)].filter(Boolean);
|
|
100
|
-
else if (!
|
|
100
|
+
else if (!ctx.output.args?.length && type.kind !== _powerlines_deepkit_vendor_type.ReflectionKind.boolean && type.kind !== _powerlines_deepkit_vendor_type.ReflectionKind.string && type.kind !== _powerlines_deepkit_vendor_type.ReflectionKind.number) throw new Error(`Unsupported type for positional argument "${argument.name}" in command "${ctx.input.command.name}". Only string, number, boolean, string[], number[], or literal[] are supported, received ${(0, _powerlines_deepkit_vendor_type.stringifyType)(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
101
101
|
return require_helpers.mergeCommandParameter(existing, argument, { name: `arg${index}` });
|
|
102
102
|
}
|
|
103
103
|
resolveCommandArgument.__type = [
|
|
@@ -117,12 +117,13 @@ function resolveFromBytecode(ctx) {
|
|
|
117
117
|
const reflection = new _powerlines_deepkit_vendor_type.ReflectionFunction(type);
|
|
118
118
|
ctx.output.description ??= ctx.input.command.description || reflection.getDescription() || type.description;
|
|
119
119
|
const parameters = reflection.getParameters();
|
|
120
|
-
if (parameters.length > 0
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
if (parameters.length > 0) {
|
|
121
|
+
const hasOptions = parameters[0] && (parameters[0].type.kind === _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral || parameters[0].type.kind === _powerlines_deepkit_vendor_type.ReflectionKind.class);
|
|
122
|
+
if (hasOptions) {
|
|
123
|
+
const optionsReflection = _powerlines_deepkit_vendor_type.ReflectionClass.from(parameters[0]?.type);
|
|
123
124
|
for (const propertyReflection of optionsReflection.getProperties()) ctx.output.options[propertyReflection.getNameAsString()] = resolveCommandOption(ctx, propertyReflection);
|
|
124
|
-
}
|
|
125
|
-
ctx.output.args = parameters.slice(1).map(__assignType((arg, index) => resolveCommandArgument(ctx, index, arg), [
|
|
125
|
+
}
|
|
126
|
+
ctx.output.args = (hasOptions ? parameters.slice(1) : parameters).map(__assignType((arg, index) => resolveCommandArgument(ctx, index, arg), [
|
|
126
127
|
"arg",
|
|
127
128
|
"index",
|
|
128
129
|
"",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepkit.cjs","names":[],"sources":["../../src/resolver/deepkit.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ReflectionParameter,\n ReflectionProperty,\n Type,\n TypeArray\n} from \"@powerlines/deepkit/vendor/type\";\nimport {\n reflect,\n ReflectionClass,\n ReflectionFunction,\n ReflectionKind,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isBigInt } from \"@stryke/type-checks/is-bigint\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isRegExp } from \"@stryke/type-checks/is-regexp\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameterKind,\n Context,\n NumberCommandParameter,\n StringCommandParameter\n} from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\nimport { mergeCommandParameter } from \"./helpers\";\nimport type { ResolverContext } from \"./types\";\n\nfunction extractCommandParameterKind(\n type: Type | ReflectionKind\n): CommandParameterKind {\n const isKind = !(isSetObject(type) && \"kind\" in type);\n const kind = !isKind ? type.kind : type;\n if (kind === ReflectionKind.string) {\n return CommandParameterKinds.string;\n } else if (\n kind === ReflectionKind.number ||\n kind === ReflectionKind.bigint ||\n (!isKind &&\n type.kind === ReflectionKind.literal &&\n (isNumber(type.literal) || isBigInt(type.literal)))\n ) {\n return CommandParameterKinds.number;\n } else if (kind === ReflectionKind.boolean) {\n return CommandParameterKinds.boolean;\n } else {\n return CommandParameterKinds.string;\n }\n}\n\nfunction resolveCommandOption(\n ctx: ResolverContext,\n reflection: ReflectionProperty\n): CommandOption {\n const type = reflection.getType();\n const existing = (ctx.output.options[reflection.getNameAsString()] ??\n {}) as Partial<CommandOption>;\n\n const option = {\n name: reflection.getNameAsString(),\n alias: reflection.getTags().alias ?? [],\n title: reflection.getTags().title?.trim(),\n description: reflection.getDescription(),\n kind: extractCommandParameterKind(type),\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue(),\n variadic: reflection.isArray()\n };\n\n if (reflection.isArray()) {\n if (\n (type as TypeArray).type.kind === ReflectionKind.string ||\n (type as TypeArray).type.kind === ReflectionKind.number\n ) {\n (option as StringCommandParameter | NumberCommandParameter).variadic =\n true;\n (option as StringCommandParameter | NumberCommandParameter).kind =\n extractCommandParameterKind((type as TypeArray).type.kind) as\n | \"string\"\n | \"number\";\n } else {\n throw new Error(\n `Unsupported array type for option \"${reflection.getNameAsString()}\" in command \"${\n ctx.input.command.name\n }\". Only string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (type.kind === ReflectionKind.union) {\n option.kind = type.types.every(\n t =>\n t.kind === ReflectionKind.number ||\n (t.kind === ReflectionKind.literal &&\n (isNumber(t.literal) || isBigInt(t.literal)))\n )\n ? CommandParameterKinds.number\n : CommandParameterKinds.string;\n\n (option as StringCommandParameter | NumberCommandParameter).choices =\n type.types\n .map(t =>\n t.kind === ReflectionKind.literal\n ? isNumber(t.literal)\n ? t.literal\n : isBigInt(t.literal)\n ? Number(t.literal)\n : isRegExp(t.literal)\n ? t.literal.source\n : String(t.literal)\n : null\n )\n .filter(Boolean) as string[] | number[];\n } else if (type.kind === ReflectionKind.literal) {\n (option as StringCommandParameter | NumberCommandParameter).choices = [\n isNumber(type.literal)\n ? type.literal\n : isBigInt(type.literal)\n ? Number(type.literal)\n : isRegExp(type.literal)\n ? type.literal.source\n : String(type.literal)\n ].filter(Boolean) as string[] | number[];\n } else if (\n !existing.kind &&\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for option \"${reflection.getNameAsString()}\" in command \"${\n ctx.input.command.name\n }\". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return mergeCommandParameter(existing, option) as CommandOption;\n}\n\nfunction resolveCommandArgument(\n ctx: ResolverContext,\n index: number,\n reflection: ReflectionParameter\n): CommandArgument {\n const type = reflection.getType();\n const existing = (\n ctx.output.args.length > index ? ctx.output.args[index] : {}\n ) as Partial<CommandArgument>;\n\n const argument = {\n name: reflection.getName() || reflection.parameter.name,\n alias: reflection.getAlias(),\n kind: extractCommandParameterKind(type.kind),\n title: reflection.getTitle() || reflection.parameter.tags?.title,\n description: reflection.parameter.description,\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue()\n };\n\n if (type.kind === ReflectionKind.array) {\n if (\n type.type.kind === ReflectionKind.string ||\n type.type.kind === ReflectionKind.number\n ) {\n (argument as StringCommandParameter | NumberCommandParameter).variadic =\n true;\n (argument as StringCommandParameter | NumberCommandParameter).kind =\n extractCommandParameterKind(type.type.kind) as \"string\" | \"number\";\n } else {\n throw new Error(\n `Unsupported array type for positional argument \"${argument.name}\" in command \"${\n ctx.input.command.name\n }\". Only string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (type.kind === ReflectionKind.union) {\n argument.kind = type.types.every(\n t =>\n t.kind === ReflectionKind.number ||\n (t.kind === ReflectionKind.literal &&\n (isNumber(t.literal) || isBigInt(t.literal)))\n )\n ? CommandParameterKinds.number\n : CommandParameterKinds.string;\n\n (argument as StringCommandParameter | NumberCommandParameter).choices =\n type.types\n .map(t =>\n t.kind === ReflectionKind.literal\n ? isNumber(t.literal)\n ? t.literal\n : isBigInt(t.literal)\n ? Number(t.literal)\n : isRegExp(t.literal)\n ? t.literal.source\n : String(t.literal)\n : null\n )\n .filter(Boolean) as string[] | number[];\n } else if (type.kind === ReflectionKind.literal) {\n (argument as StringCommandParameter | NumberCommandParameter).choices = [\n isNumber(type.literal)\n ? type.literal\n : isBigInt(type.literal)\n ? Number(type.literal)\n : isRegExp(type.literal)\n ? type.literal.source\n : String(type.literal)\n ].filter(Boolean) as string[] | number[];\n } else if (\n !existing.kind &&\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for positional argument \"${argument.name}\" in command \"${\n ctx.input.command.name\n }\". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return mergeCommandParameter(existing, argument, {\n name: `arg${index}`\n }) as CommandArgument;\n}\n\nexport function resolveFromBytecode<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n const { input, module } = ctx;\n\n const type = reflect(module);\n if (type.kind !== ReflectionKind.function) {\n throw new Error(\n `The command entry file \"${\n input.command.entry.input?.file || input.command.path\n }\" does not export a valid function.`\n );\n }\n\n const reflection = new ReflectionFunction(type);\n\n ctx.output.description ??= (ctx.input.command.description ||\n reflection.getDescription() ||\n type.description)!;\n\n const parameters = reflection.getParameters();\n if (parameters.length > 0 && parameters[0]) {\n if (\n parameters[0].type.kind === ReflectionKind.objectLiteral ||\n parameters[0].type.kind === ReflectionKind.class\n ) {\n const optionsReflection = ReflectionClass.from(parameters[0].type);\n for (const propertyReflection of optionsReflection.getProperties()) {\n ctx.output.options[propertyReflection.getNameAsString()] =\n resolveCommandOption(ctx, propertyReflection);\n }\n } else if (!ctx.module?.options) {\n throw new Error(\n `The first parameter of the command handler function in \"${\n ctx.input.command.entry.input?.file || ctx.input.command.path\n }\" must be an object literal or class type representing the command options.`\n );\n }\n\n ctx.output.args = parameters\n .slice(1)\n .map((arg, index) => resolveCommandArgument(ctx, index, arg));\n }\n}\n"],"mappings":";;;;;;;;;;AAEA,SAAS,aAAW,IAAM,MAAA;;AAEzB,QAAU;;;CAUV,MAAK,SAAQ,qDAAmB,KAAG,IAAA,UAAA;;AAEhC,KAAI,SAAS,+CAAe;UAG9B,SAAmB,+CAAA,UACnB,SAAA,+CAAkB,UACd,CAAA,UACJ,KAAA,SAAA,+CAAA,wDACkB,KAAO,QAAQ,gDAAK,KAAA,QAAA,EACjC,QAAA,4CAAA;UAEL,SAAe,+CAAA,QACf,QAAA,4CAAkB;KAGZ,QAAC,4CAA0B;;AAGnC,4BAA2B,SAAO;CAAI;OAAW;CAAO;CAAA;CAAA;CAAA;CAAA;AACxD,SAAS,qBAAqB,KAAA,YAAY;CAC1C,MAAO,OAAK,WAAA,SAAA;CACV,MAAA,WAAe,IAAA,OAAA,QAAA,WAAA,iBAAA,KACf,EAAA;CACA,MAAA,SAAA;EACA,MAAO,WAAA,iBAAA;EACP,OAAA,WAAsB,SAAA,CAAA,SAAA,EAAA;EACtB,OAAA,WAAA,SAAA,CAAA,OAAA,MAAA;EACM,aAAS,WAAA,gBAAA;EACT,MAAC,4BAAiC,KAAK;EACvC,UAAC,WAAA,YAAgC;EAClC,SAAO,WAAA,iBAA+B;;EAE7C;AACE,KAAM,WAAO,SAAA,CACZ,KAAA,KAAA,KAAA,SAAqB,+CAAA,UAChB,KAAS,KAAE,SAAY,+CAAe,QAAQ;AAC1C,SAAI,WACD;AACJ,SAAA,OACC,4BAAA,KAAA,KAAA,KAAA;OAGA,OAAE,IAAA,MAAA,sCAAA,WAAA,iBAAA,CAAA,gBA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------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ReflectionParameter,\n ReflectionProperty,\n Type,\n TypeArray\n} from \"@powerlines/deepkit/vendor/type\";\nimport {\n reflect,\n ReflectionClass,\n ReflectionFunction,\n ReflectionKind,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isBigInt } from \"@stryke/type-checks/is-bigint\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isRegExp } from \"@stryke/type-checks/is-regexp\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameterKind,\n Context,\n NumberCommandParameter,\n StringCommandParameter\n} from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\nimport { mergeCommandParameter } from \"./helpers\";\nimport type { ResolverContext } from \"./types\";\n\nfunction extractCommandParameterKind(\n type: Type | ReflectionKind\n): CommandParameterKind {\n const isKind = !(isSetObject(type) && \"kind\" in type);\n const kind = !isKind ? type.kind : type;\n if (kind === ReflectionKind.string) {\n return CommandParameterKinds.string;\n } else if (\n kind === ReflectionKind.number ||\n kind === ReflectionKind.bigint ||\n (!isKind &&\n type.kind === ReflectionKind.literal &&\n (isNumber(type.literal) || isBigInt(type.literal)))\n ) {\n return CommandParameterKinds.number;\n } else if (kind === ReflectionKind.boolean) {\n return CommandParameterKinds.boolean;\n } else {\n return CommandParameterKinds.string;\n }\n}\n\nfunction resolveCommandOption(\n ctx: ResolverContext,\n reflection: ReflectionProperty\n): CommandOption {\n const type = reflection.getType();\n const existing = (ctx.output.options[reflection.getNameAsString()] ??\n {}) as Partial<CommandOption>;\n\n const option = {\n name: reflection.getNameAsString(),\n alias: reflection.getTags().alias ?? [],\n title: reflection.getTags().title?.trim(),\n description: reflection.getDescription(),\n kind: extractCommandParameterKind(type),\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue(),\n variadic: reflection.isArray()\n };\n\n if (reflection.isArray()) {\n if (\n (type as TypeArray).type.kind === ReflectionKind.string ||\n (type as TypeArray).type.kind === ReflectionKind.number\n ) {\n (option as StringCommandParameter | NumberCommandParameter).variadic =\n true;\n (option as StringCommandParameter | NumberCommandParameter).kind =\n extractCommandParameterKind((type as TypeArray).type.kind) as\n | \"string\"\n | \"number\";\n } else {\n throw new Error(\n `Unsupported array type for option \"${reflection.getNameAsString()}\" in command \"${\n ctx.input.command.name\n }\". Only string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (type.kind === ReflectionKind.union) {\n option.kind = type.types.every(\n t =>\n t.kind === ReflectionKind.number ||\n (t.kind === ReflectionKind.literal &&\n (isNumber(t.literal) || isBigInt(t.literal)))\n )\n ? CommandParameterKinds.number\n : CommandParameterKinds.string;\n\n (option as StringCommandParameter | NumberCommandParameter).choices =\n type.types\n .map(t =>\n t.kind === ReflectionKind.literal\n ? isNumber(t.literal)\n ? t.literal\n : isBigInt(t.literal)\n ? Number(t.literal)\n : isRegExp(t.literal)\n ? t.literal.source\n : String(t.literal)\n : null\n )\n .filter(Boolean) as string[] | number[];\n } else if (type.kind === ReflectionKind.literal) {\n (option as StringCommandParameter | NumberCommandParameter).choices = [\n isNumber(type.literal)\n ? type.literal\n : isBigInt(type.literal)\n ? Number(type.literal)\n : isRegExp(type.literal)\n ? type.literal.source\n : String(type.literal)\n ].filter(Boolean) as string[] | number[];\n } else if (\n !existing.kind &&\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for option \"${reflection.getNameAsString()}\" in command \"${\n ctx.input.command.name\n }\". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return mergeCommandParameter(existing, option) as CommandOption;\n}\n\nfunction resolveCommandArgument(\n ctx: ResolverContext,\n index: number,\n reflection: ReflectionParameter\n): CommandArgument {\n const type = reflection.getType();\n const existing = (\n ctx.output.args.length > index ? ctx.output.args[index] : {}\n ) as Partial<CommandArgument>;\n\n const argument = {\n name: reflection.getName() || reflection.parameter.name,\n alias: reflection.getAlias(),\n kind: extractCommandParameterKind(type.kind),\n title: reflection.getTitle() || reflection.parameter.tags?.title,\n description: reflection.parameter.description,\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue()\n };\n\n if (type.kind === ReflectionKind.array) {\n if (\n type.type.kind === ReflectionKind.string ||\n type.type.kind === ReflectionKind.number\n ) {\n (argument as StringCommandParameter | NumberCommandParameter).variadic =\n true;\n (argument as StringCommandParameter | NumberCommandParameter).kind =\n extractCommandParameterKind(type.type.kind) as \"string\" | \"number\";\n } else {\n throw new Error(\n `Unsupported array type for positional argument \"${argument.name}\" in command \"${\n ctx.input.command.name\n }\". Only string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (type.kind === ReflectionKind.union) {\n argument.kind = type.types.every(\n t =>\n t.kind === ReflectionKind.number ||\n (t.kind === ReflectionKind.literal &&\n (isNumber(t.literal) || isBigInt(t.literal)))\n )\n ? CommandParameterKinds.number\n : CommandParameterKinds.string;\n\n (argument as StringCommandParameter | NumberCommandParameter).choices =\n type.types\n .map(t =>\n t.kind === ReflectionKind.literal\n ? isNumber(t.literal)\n ? t.literal\n : isBigInt(t.literal)\n ? Number(t.literal)\n : isRegExp(t.literal)\n ? t.literal.source\n : String(t.literal)\n : null\n )\n .filter(Boolean) as string[] | number[];\n } else if (type.kind === ReflectionKind.literal) {\n (argument as StringCommandParameter | NumberCommandParameter).choices = [\n isNumber(type.literal)\n ? type.literal\n : isBigInt(type.literal)\n ? Number(type.literal)\n : isRegExp(type.literal)\n ? type.literal.source\n : String(type.literal)\n ].filter(Boolean) as string[] | number[];\n } else if (\n !ctx.output.args?.length &&\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for positional argument \"${argument.name}\" in command \"${\n ctx.input.command.name\n }\". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return mergeCommandParameter(existing, argument, {\n name: `arg${index}`\n }) as CommandArgument;\n}\n\nexport function resolveFromBytecode<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n const { input, module } = ctx;\n\n const type = reflect(module);\n if (type.kind !== ReflectionKind.function) {\n throw new Error(\n `The command entry file \"${\n input.command.entry.input?.file || input.command.path\n }\" does not export a valid function.`\n );\n }\n\n const reflection = new ReflectionFunction(type);\n\n ctx.output.description ??= (ctx.input.command.description ||\n reflection.getDescription() ||\n type.description)!;\n\n const parameters = reflection.getParameters();\n if (parameters.length > 0) {\n const hasOptions =\n parameters[0] &&\n (parameters[0].type.kind === ReflectionKind.objectLiteral ||\n parameters[0].type.kind === ReflectionKind.class);\n if (hasOptions) {\n const optionsReflection = ReflectionClass.from(parameters[0]?.type);\n for (const propertyReflection of optionsReflection.getProperties()) {\n ctx.output.options[propertyReflection.getNameAsString()] =\n resolveCommandOption(ctx, propertyReflection);\n }\n }\n\n ctx.output.args = (hasOptions ? parameters.slice(1) : parameters).map(\n (arg, index) => resolveCommandArgument(ctx, index, arg)\n );\n }\n}\n"],"mappings":";;;;;;;;;;AAEA,SAAS,aAAW,IAAM,MAAA;;AAEzB,QAAU;;;CAUV,MAAK,SAAQ,qDAAmB,KAAG,IAAA,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O,IAAA,MAAW,2BAAU,MAAA,QAAA,MAAA,OAAA,QAAA,MAAA,QAAA,KAAA,qCAAA;CAE5B,MAAM,aAAY,IAAA,mDAAwB,KAAC;AAC3C,KAAA,OAAW,gBAAa,IAAA,MAAU,QAAW,eAC7C,WAAU,gBAAqB,IAC/B,KAAS;CACV,MAAA,aAAA,WAAA,eAAA;;EAEG,MAAK,aAAS,WAAe,OAC5B,WAAA,GAAA,KAAA,SAAA,+CAAA,iBACS,WAAS,GAAA,KAAA,SAAe,+CAAQ;AAC1C,MAAK,YAAa;GAClB,MAAA,oBAAA,gDAAA,KAAA,WAAA,IAAA,KAAA;AACC,QAAS,MAAG,sBAAyB,kBAAA,eAAiC,CACjE,KAAA,OAAA,QAAA,mBAAA,iBAAA,IACO,qBAAsB,KAAG,mBAAA;;AAGtC,MAAM,OAAI,QAAK,aAAA,WAAA,MAAA,EAAA,GAAA,YAAA,IAAA,cAAA,KAAA,UAAA,uBAAA,KAAA,OAAA,IAAA,EAAA;GAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;;;AAGrB,oBAAiB,SAAU;CAAA;CAAsB;CAAK;CAAsB;CAAa"}
|
|
@@ -96,7 +96,7 @@ function resolveCommandArgument(ctx, index, reflection) {
|
|
|
96
96
|
"P\"2!\"/\""
|
|
97
97
|
])).filter(Boolean);
|
|
98
98
|
} else if (type.kind === ReflectionKind.literal) argument.choices = [isNumber(type.literal) ? type.literal : isBigInt(type.literal) ? Number(type.literal) : isRegExp(type.literal) ? type.literal.source : String(type.literal)].filter(Boolean);
|
|
99
|
-
else if (!
|
|
99
|
+
else if (!ctx.output.args?.length && type.kind !== ReflectionKind.boolean && type.kind !== ReflectionKind.string && type.kind !== ReflectionKind.number) throw new Error(`Unsupported type for positional argument "${argument.name}" in command "${ctx.input.command.name}". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(type).trim().replaceAll(" | ", ", or ")}.`);
|
|
100
100
|
return mergeCommandParameter(existing, argument, { name: `arg${index}` });
|
|
101
101
|
}
|
|
102
102
|
resolveCommandArgument.__type = [
|
|
@@ -116,12 +116,13 @@ function resolveFromBytecode(ctx) {
|
|
|
116
116
|
const reflection = new ReflectionFunction(type);
|
|
117
117
|
ctx.output.description ??= ctx.input.command.description || reflection.getDescription() || type.description;
|
|
118
118
|
const parameters = reflection.getParameters();
|
|
119
|
-
if (parameters.length > 0
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
if (parameters.length > 0) {
|
|
120
|
+
const hasOptions = parameters[0] && (parameters[0].type.kind === ReflectionKind.objectLiteral || parameters[0].type.kind === ReflectionKind.class);
|
|
121
|
+
if (hasOptions) {
|
|
122
|
+
const optionsReflection = ReflectionClass.from(parameters[0]?.type);
|
|
122
123
|
for (const propertyReflection of optionsReflection.getProperties()) ctx.output.options[propertyReflection.getNameAsString()] = resolveCommandOption(ctx, propertyReflection);
|
|
123
|
-
}
|
|
124
|
-
ctx.output.args = parameters.slice(1).map(__assignType((arg, index) => resolveCommandArgument(ctx, index, arg), [
|
|
124
|
+
}
|
|
125
|
+
ctx.output.args = (hasOptions ? parameters.slice(1) : parameters).map(__assignType((arg, index) => resolveCommandArgument(ctx, index, arg), [
|
|
125
126
|
"arg",
|
|
126
127
|
"index",
|
|
127
128
|
"",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepkit.mjs","names":[],"sources":["../../src/resolver/deepkit.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ReflectionParameter,\n ReflectionProperty,\n Type,\n TypeArray\n} from \"@powerlines/deepkit/vendor/type\";\nimport {\n reflect,\n ReflectionClass,\n ReflectionFunction,\n ReflectionKind,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isBigInt } from \"@stryke/type-checks/is-bigint\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isRegExp } from \"@stryke/type-checks/is-regexp\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameterKind,\n Context,\n NumberCommandParameter,\n StringCommandParameter\n} from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\nimport { mergeCommandParameter } from \"./helpers\";\nimport type { ResolverContext } from \"./types\";\n\nfunction extractCommandParameterKind(\n type: Type | ReflectionKind\n): CommandParameterKind {\n const isKind = !(isSetObject(type) && \"kind\" in type);\n const kind = !isKind ? type.kind : type;\n if (kind === ReflectionKind.string) {\n return CommandParameterKinds.string;\n } else if (\n kind === ReflectionKind.number ||\n kind === ReflectionKind.bigint ||\n (!isKind &&\n type.kind === ReflectionKind.literal &&\n (isNumber(type.literal) || isBigInt(type.literal)))\n ) {\n return CommandParameterKinds.number;\n } else if (kind === ReflectionKind.boolean) {\n return CommandParameterKinds.boolean;\n } else {\n return CommandParameterKinds.string;\n }\n}\n\nfunction resolveCommandOption(\n ctx: ResolverContext,\n reflection: ReflectionProperty\n): CommandOption {\n const type = reflection.getType();\n const existing = (ctx.output.options[reflection.getNameAsString()] ??\n {}) as Partial<CommandOption>;\n\n const option = {\n name: reflection.getNameAsString(),\n alias: reflection.getTags().alias ?? [],\n title: reflection.getTags().title?.trim(),\n description: reflection.getDescription(),\n kind: extractCommandParameterKind(type),\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue(),\n variadic: reflection.isArray()\n };\n\n if (reflection.isArray()) {\n if (\n (type as TypeArray).type.kind === ReflectionKind.string ||\n (type as TypeArray).type.kind === ReflectionKind.number\n ) {\n (option as StringCommandParameter | NumberCommandParameter).variadic =\n true;\n (option as StringCommandParameter | NumberCommandParameter).kind =\n extractCommandParameterKind((type as TypeArray).type.kind) as\n | \"string\"\n | \"number\";\n } else {\n throw new Error(\n `Unsupported array type for option \"${reflection.getNameAsString()}\" in command \"${\n ctx.input.command.name\n }\". Only string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (type.kind === ReflectionKind.union) {\n option.kind = type.types.every(\n t =>\n t.kind === ReflectionKind.number ||\n (t.kind === ReflectionKind.literal &&\n (isNumber(t.literal) || isBigInt(t.literal)))\n )\n ? CommandParameterKinds.number\n : CommandParameterKinds.string;\n\n (option as StringCommandParameter | NumberCommandParameter).choices =\n type.types\n .map(t =>\n t.kind === ReflectionKind.literal\n ? isNumber(t.literal)\n ? t.literal\n : isBigInt(t.literal)\n ? Number(t.literal)\n : isRegExp(t.literal)\n ? t.literal.source\n : String(t.literal)\n : null\n )\n .filter(Boolean) as string[] | number[];\n } else if (type.kind === ReflectionKind.literal) {\n (option as StringCommandParameter | NumberCommandParameter).choices = [\n isNumber(type.literal)\n ? type.literal\n : isBigInt(type.literal)\n ? Number(type.literal)\n : isRegExp(type.literal)\n ? type.literal.source\n : String(type.literal)\n ].filter(Boolean) as string[] | number[];\n } else if (\n !existing.kind &&\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for option \"${reflection.getNameAsString()}\" in command \"${\n ctx.input.command.name\n }\". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return mergeCommandParameter(existing, option) as CommandOption;\n}\n\nfunction resolveCommandArgument(\n ctx: ResolverContext,\n index: number,\n reflection: ReflectionParameter\n): CommandArgument {\n const type = reflection.getType();\n const existing = (\n ctx.output.args.length > index ? ctx.output.args[index] : {}\n ) as Partial<CommandArgument>;\n\n const argument = {\n name: reflection.getName() || reflection.parameter.name,\n alias: reflection.getAlias(),\n kind: extractCommandParameterKind(type.kind),\n title: reflection.getTitle() || reflection.parameter.tags?.title,\n description: reflection.parameter.description,\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue()\n };\n\n if (type.kind === ReflectionKind.array) {\n if (\n type.type.kind === ReflectionKind.string ||\n type.type.kind === ReflectionKind.number\n ) {\n (argument as StringCommandParameter | NumberCommandParameter).variadic =\n true;\n (argument as StringCommandParameter | NumberCommandParameter).kind =\n extractCommandParameterKind(type.type.kind) as \"string\" | \"number\";\n } else {\n throw new Error(\n `Unsupported array type for positional argument \"${argument.name}\" in command \"${\n ctx.input.command.name\n }\". Only string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (type.kind === ReflectionKind.union) {\n argument.kind = type.types.every(\n t =>\n t.kind === ReflectionKind.number ||\n (t.kind === ReflectionKind.literal &&\n (isNumber(t.literal) || isBigInt(t.literal)))\n )\n ? CommandParameterKinds.number\n : CommandParameterKinds.string;\n\n (argument as StringCommandParameter | NumberCommandParameter).choices =\n type.types\n .map(t =>\n t.kind === ReflectionKind.literal\n ? isNumber(t.literal)\n ? t.literal\n : isBigInt(t.literal)\n ? Number(t.literal)\n : isRegExp(t.literal)\n ? t.literal.source\n : String(t.literal)\n : null\n )\n .filter(Boolean) as string[] | number[];\n } else if (type.kind === ReflectionKind.literal) {\n (argument as StringCommandParameter | NumberCommandParameter).choices = [\n isNumber(type.literal)\n ? type.literal\n : isBigInt(type.literal)\n ? Number(type.literal)\n : isRegExp(type.literal)\n ? type.literal.source\n : String(type.literal)\n ].filter(Boolean) as string[] | number[];\n } else if (\n !existing.kind &&\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for positional argument \"${argument.name}\" in command \"${\n ctx.input.command.name\n }\". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return mergeCommandParameter(existing, argument, {\n name: `arg${index}`\n }) as CommandArgument;\n}\n\nexport function resolveFromBytecode<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n const { input, module } = ctx;\n\n const type = reflect(module);\n if (type.kind !== ReflectionKind.function) {\n throw new Error(\n `The command entry file \"${\n input.command.entry.input?.file || input.command.path\n }\" does not export a valid function.`\n );\n }\n\n const reflection = new ReflectionFunction(type);\n\n ctx.output.description ??= (ctx.input.command.description ||\n reflection.getDescription() ||\n type.description)!;\n\n const parameters = reflection.getParameters();\n if (parameters.length > 0 && parameters[0]) {\n if (\n parameters[0].type.kind === ReflectionKind.objectLiteral ||\n parameters[0].type.kind === ReflectionKind.class\n ) {\n const optionsReflection = ReflectionClass.from(parameters[0].type);\n for (const propertyReflection of optionsReflection.getProperties()) {\n ctx.output.options[propertyReflection.getNameAsString()] =\n resolveCommandOption(ctx, propertyReflection);\n }\n } else if (!ctx.module?.options) {\n throw new Error(\n `The first parameter of the command handler function in \"${\n ctx.input.command.entry.input?.file || ctx.input.command.path\n }\" must be an object literal or class type representing the command options.`\n );\n }\n\n ctx.output.args = parameters\n .slice(1)\n .map((arg, index) => resolveCommandArgument(ctx, index, arg));\n }\n}\n"],"mappings":";;;;;;;;;AAEA,SAAS,aAAW,IAAM,MAAA;;AAEzB,QAAU;;;CAUV,MAAK,SAAQ,EAAA,YAAmB,KAAG,IAAA,UAAA;;AAEhC,KAAI,SAAS,eAAe;UAG9B,SAAmB,eAAA,UACnB,SAAA,eAAkB,UACd,CAAA,UACJ,KAAA,SAAA,eAAA,YACO,SAAW,KAAO,QAAQ,IAAI,SAAC,KAAA,QAAA,EACjC,QAAA,sBAAA;UAEL,SAAe,eAAA,QACf,QAAA,sBAAkB;KAGZ,QAAC,sBAA0B;;AAGnC,4BAA2B,SAAO;CAAI;OAA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AA,aAAA,WAAA,eAAA;;AAEG,MAAK,WAAS,GAAA,KAAA,SAAoB,eAAE,iBACnC,WAAA,GAAA,KAAA,SAAA,eAAA,OAAA;GACI,MAAK,oBAAS,gBAAuB,KAAA,WAAA,GAAA,KAAA;AACrC,QAAK,MAAO,sBAAiB,kBAAA,eAAA,CAClC,KAAA,OAAA,QAAA,mBAAA,iBAAA,IACa,qBAAsB,KAAG,mBAAA;aAGpC,CAAA,IAAA,QAAA,QACG,OAAA,IAAA,MAAA,2DAAA,IAAA,MAAA,QAAA,MAAA,OAAA,QAAA,IAAA,MAAA,QAAA,KAAA,6EAAA;AAEH,MAAC,OAAA,OAAiB,WACb,MAAM,EAAC,CACR,IAAK,cAAU,KAAS,UAAI,uBAAyB,KAAS,OAAE,IAAA,EAAA;GAAA;GAAa;GAAA;GAAA;GAAA,CAAA,CAAA;;;AAGzF,oBAAgB,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
1
|
+
{"version":3,"file":"deepkit.mjs","names":[],"sources":["../../src/resolver/deepkit.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ReflectionParameter,\n ReflectionProperty,\n Type,\n TypeArray\n} from \"@powerlines/deepkit/vendor/type\";\nimport {\n reflect,\n ReflectionClass,\n ReflectionFunction,\n ReflectionKind,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isBigInt } from \"@stryke/type-checks/is-bigint\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isRegExp } from \"@stryke/type-checks/is-regexp\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameterKind,\n Context,\n NumberCommandParameter,\n StringCommandParameter\n} from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\nimport { mergeCommandParameter } from \"./helpers\";\nimport type { ResolverContext } from \"./types\";\n\nfunction extractCommandParameterKind(\n type: Type | ReflectionKind\n): CommandParameterKind {\n const isKind = !(isSetObject(type) && \"kind\" in type);\n const kind = !isKind ? type.kind : type;\n if (kind === ReflectionKind.string) {\n return CommandParameterKinds.string;\n } else if (\n kind === ReflectionKind.number ||\n kind === ReflectionKind.bigint ||\n (!isKind &&\n type.kind === ReflectionKind.literal &&\n (isNumber(type.literal) || isBigInt(type.literal)))\n ) {\n return CommandParameterKinds.number;\n } else if (kind === ReflectionKind.boolean) {\n return CommandParameterKinds.boolean;\n } else {\n return CommandParameterKinds.string;\n }\n}\n\nfunction resolveCommandOption(\n ctx: ResolverContext,\n reflection: ReflectionProperty\n): CommandOption {\n const type = reflection.getType();\n const existing = (ctx.output.options[reflection.getNameAsString()] ??\n {}) as Partial<CommandOption>;\n\n const option = {\n name: reflection.getNameAsString(),\n alias: reflection.getTags().alias ?? [],\n title: reflection.getTags().title?.trim(),\n description: reflection.getDescription(),\n kind: extractCommandParameterKind(type),\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue(),\n variadic: reflection.isArray()\n };\n\n if (reflection.isArray()) {\n if (\n (type as TypeArray).type.kind === ReflectionKind.string ||\n (type as TypeArray).type.kind === ReflectionKind.number\n ) {\n (option as StringCommandParameter | NumberCommandParameter).variadic =\n true;\n (option as StringCommandParameter | NumberCommandParameter).kind =\n extractCommandParameterKind((type as TypeArray).type.kind) as\n | \"string\"\n | \"number\";\n } else {\n throw new Error(\n `Unsupported array type for option \"${reflection.getNameAsString()}\" in command \"${\n ctx.input.command.name\n }\". Only string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (type.kind === ReflectionKind.union) {\n option.kind = type.types.every(\n t =>\n t.kind === ReflectionKind.number ||\n (t.kind === ReflectionKind.literal &&\n (isNumber(t.literal) || isBigInt(t.literal)))\n )\n ? CommandParameterKinds.number\n : CommandParameterKinds.string;\n\n (option as StringCommandParameter | NumberCommandParameter).choices =\n type.types\n .map(t =>\n t.kind === ReflectionKind.literal\n ? isNumber(t.literal)\n ? t.literal\n : isBigInt(t.literal)\n ? Number(t.literal)\n : isRegExp(t.literal)\n ? t.literal.source\n : String(t.literal)\n : null\n )\n .filter(Boolean) as string[] | number[];\n } else if (type.kind === ReflectionKind.literal) {\n (option as StringCommandParameter | NumberCommandParameter).choices = [\n isNumber(type.literal)\n ? type.literal\n : isBigInt(type.literal)\n ? Number(type.literal)\n : isRegExp(type.literal)\n ? type.literal.source\n : String(type.literal)\n ].filter(Boolean) as string[] | number[];\n } else if (\n !existing.kind &&\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for option \"${reflection.getNameAsString()}\" in command \"${\n ctx.input.command.name\n }\". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return mergeCommandParameter(existing, option) as CommandOption;\n}\n\nfunction resolveCommandArgument(\n ctx: ResolverContext,\n index: number,\n reflection: ReflectionParameter\n): CommandArgument {\n const type = reflection.getType();\n const existing = (\n ctx.output.args.length > index ? ctx.output.args[index] : {}\n ) as Partial<CommandArgument>;\n\n const argument = {\n name: reflection.getName() || reflection.parameter.name,\n alias: reflection.getAlias(),\n kind: extractCommandParameterKind(type.kind),\n title: reflection.getTitle() || reflection.parameter.tags?.title,\n description: reflection.parameter.description,\n optional: reflection.isOptional(),\n default: reflection.getDefaultValue()\n };\n\n if (type.kind === ReflectionKind.array) {\n if (\n type.type.kind === ReflectionKind.string ||\n type.type.kind === ReflectionKind.number\n ) {\n (argument as StringCommandParameter | NumberCommandParameter).variadic =\n true;\n (argument as StringCommandParameter | NumberCommandParameter).kind =\n extractCommandParameterKind(type.type.kind) as \"string\" | \"number\";\n } else {\n throw new Error(\n `Unsupported array type for positional argument \"${argument.name}\" in command \"${\n ctx.input.command.name\n }\". Only string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n } else if (type.kind === ReflectionKind.union) {\n argument.kind = type.types.every(\n t =>\n t.kind === ReflectionKind.number ||\n (t.kind === ReflectionKind.literal &&\n (isNumber(t.literal) || isBigInt(t.literal)))\n )\n ? CommandParameterKinds.number\n : CommandParameterKinds.string;\n\n (argument as StringCommandParameter | NumberCommandParameter).choices =\n type.types\n .map(t =>\n t.kind === ReflectionKind.literal\n ? isNumber(t.literal)\n ? t.literal\n : isBigInt(t.literal)\n ? Number(t.literal)\n : isRegExp(t.literal)\n ? t.literal.source\n : String(t.literal)\n : null\n )\n .filter(Boolean) as string[] | number[];\n } else if (type.kind === ReflectionKind.literal) {\n (argument as StringCommandParameter | NumberCommandParameter).choices = [\n isNumber(type.literal)\n ? type.literal\n : isBigInt(type.literal)\n ? Number(type.literal)\n : isRegExp(type.literal)\n ? type.literal.source\n : String(type.literal)\n ].filter(Boolean) as string[] | number[];\n } else if (\n !ctx.output.args?.length &&\n type.kind !== ReflectionKind.boolean &&\n type.kind !== ReflectionKind.string &&\n type.kind !== ReflectionKind.number\n ) {\n throw new Error(\n `Unsupported type for positional argument \"${argument.name}\" in command \"${\n ctx.input.command.name\n }\". Only string, number, boolean, string[], number[], or literal[] are supported, received ${stringifyType(\n type\n )\n .trim()\n .replaceAll(\" | \", \", or \")}.`\n );\n }\n\n return mergeCommandParameter(existing, argument, {\n name: `arg${index}`\n }) as CommandArgument;\n}\n\nexport function resolveFromBytecode<TContext extends Context = Context>(\n ctx: ResolverContext<TContext>\n) {\n const { input, module } = ctx;\n\n const type = reflect(module);\n if (type.kind !== ReflectionKind.function) {\n throw new Error(\n `The command entry file \"${\n input.command.entry.input?.file || input.command.path\n }\" does not export a valid function.`\n );\n }\n\n const reflection = new ReflectionFunction(type);\n\n ctx.output.description ??= (ctx.input.command.description ||\n reflection.getDescription() ||\n type.description)!;\n\n const parameters = reflection.getParameters();\n if (parameters.length > 0) {\n const hasOptions =\n parameters[0] &&\n (parameters[0].type.kind === ReflectionKind.objectLiteral ||\n parameters[0].type.kind === ReflectionKind.class);\n if (hasOptions) {\n const optionsReflection = ReflectionClass.from(parameters[0]?.type);\n for (const propertyReflection of optionsReflection.getProperties()) {\n ctx.output.options[propertyReflection.getNameAsString()] =\n resolveCommandOption(ctx, propertyReflection);\n }\n }\n\n ctx.output.args = (hasOptions ? parameters.slice(1) : parameters).map(\n (arg, index) => resolveCommandArgument(ctx, index, arg)\n );\n }\n}\n"],"mappings":";;;;;;;;;AAEA,SAAS,aAAW,IAAM,MAAA;;AAEzB,QAAU;;;CAUV,MAAK,SAAQ,EAAA,YAAmB,KAAG,IAAA,UAAA;;AAEhC,KAAI,SAAS,eAAe;UAG9B,SAAmB,eAAA,UACnB,SAAA,eAAkB,UACd,CAAA,UACJ,KAAA,SAAA,eAAA,YACO,SAAW,KAAO,QAAQ,IAAI,SAAC,KAAA,QAAA,EACjC,QAAA,sBAAA;UAEL,SAAe,eAAA,QACf,QAAA,sBAAkB;KAGZ,QAAC,sBAA0B;;AAGnC,4BAA2B,SAAO;CAAI;OAAW;CAAO;CAAA;CAAA;CAAA;CAAA;AACxD,SAAS,qBAAqB,KAAA,YAAY;CAC1C,MAAO,OAAK,WAAA,SAAA;CACV,MAAA,WAAe,IAAA,OAAA,QAAA,WAAA,iBAAA,KACf,EAAA;CACA,MAAA,SAAA;EACA,MAAO,WAAA,iBAAA;EACP,OAAA,WAAsB,SAAA,CAAA,SAAA,EAAA;EACtB,OAAA,WAAA,SAAA,CAAA,OAAA,MAAA;EACM,aAA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AAsB,KAAG,mBAAA;;AAGtC,MAAM,OAAI,QAAK,aAAA,WAAA,MAAA,EAAA,GAAA,YAAA,IAAA,cAAA,KAAA,UAAA,uBAAA,KAAA,OAAA,IAAA,EAAA;GAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;;;AAGrB,oBAAiB,SAAU;CAAA;CAAsB;CAAK;CAAsB;CAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing the core Shell Shock functionality used to build and manage a command-line application.",
|
|
6
6
|
"keywords": ["shell-shock", "powerlines", "storm-software"],
|
|
@@ -350,12 +350,12 @@
|
|
|
350
350
|
"@alloy-js/core": "0.23.0-dev.8",
|
|
351
351
|
"@alloy-js/markdown": "0.23.0-dev.1",
|
|
352
352
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
353
|
-
"@powerlines/deepkit": "^0.6.
|
|
354
|
-
"@powerlines/plugin-alloy": "^0.25.
|
|
355
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
356
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
357
|
-
"@powerlines/plugin-nodejs": "^0.1.
|
|
358
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
353
|
+
"@powerlines/deepkit": "^0.6.162",
|
|
354
|
+
"@powerlines/plugin-alloy": "^0.25.70",
|
|
355
|
+
"@powerlines/plugin-automd": "^0.1.383",
|
|
356
|
+
"@powerlines/plugin-deepkit": "^0.11.262",
|
|
357
|
+
"@powerlines/plugin-nodejs": "^0.1.306",
|
|
358
|
+
"@powerlines/plugin-tsdown": "^0.1.325",
|
|
359
359
|
"@standard-schema/spec": "^1.1.0",
|
|
360
360
|
"@standard-schema/utils": "^0.3.0",
|
|
361
361
|
"@stryke/cli": "^0.13.36",
|
|
@@ -374,15 +374,15 @@
|
|
|
374
374
|
"tsdown": "^0.21.6"
|
|
375
375
|
},
|
|
376
376
|
"devDependencies": {
|
|
377
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
377
|
+
"@powerlines/plugin-plugin": "^0.12.334",
|
|
378
378
|
"@types/json-schema": "^7.0.15",
|
|
379
379
|
"@types/node": "^25.5.0",
|
|
380
|
-
"powerlines": "^0.42.
|
|
380
|
+
"powerlines": "^0.42.24",
|
|
381
381
|
"typescript": "^5.9.3",
|
|
382
382
|
"zod": "^4.3.6"
|
|
383
383
|
},
|
|
384
384
|
"peerDependencies": { "powerlines": ">=0.42.10", "zod": "^3.25.0 || ^4.0.0" },
|
|
385
385
|
"peerDependenciesMeta": { "zod": { "optional": true } },
|
|
386
386
|
"publishConfig": { "access": "public" },
|
|
387
|
-
"gitHead": "
|
|
387
|
+
"gitHead": "34488ccdcd281f51646307b1818117b84c55a722"
|
|
388
388
|
}
|