@shell-shock/preset-script 0.5.0 → 0.6.1
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/README.md +1 -1
- package/dist/components/command-entry.cjs +168 -4
- package/dist/components/command-entry.cjs.map +1 -1
- package/dist/components/command-entry.d.cts +8 -1
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +8 -1
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +169 -6
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/console-builtin.cjs +28 -19
- package/dist/components/console-builtin.cjs.map +1 -1
- package/dist/components/console-builtin.d.cts +4 -2
- package/dist/components/console-builtin.d.cts.map +1 -1
- package/dist/components/console-builtin.d.mts +4 -2
- package/dist/components/console-builtin.d.mts.map +1 -1
- package/dist/components/console-builtin.mjs +28 -19
- package/dist/components/console-builtin.mjs.map +1 -1
- package/dist/components/help.cjs +1 -1
- package/dist/components/help.d.cts +7 -7
- package/dist/components/help.d.cts.map +1 -1
- package/dist/components/help.mjs +1 -1
- package/dist/components/helpers.d.mts +5 -5
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.mjs +2 -2
- package/dist/components/utils-builtin.cjs +10 -87
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts +8 -8
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +8 -8
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +10 -87
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/package.json +8 -8
package/dist/components/help.cjs
CHANGED
|
@@ -5,8 +5,8 @@ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
5
5
|
let __alloy_js_core = require("@alloy-js/core");
|
|
6
6
|
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
7
7
|
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
8
|
-
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
9
8
|
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
9
|
+
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
10
10
|
let __shell_shock_core_plugin_utils_reflect = require("@shell-shock/core/plugin-utils/reflect");
|
|
11
11
|
let __stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core10 from "@alloy-js/core";
|
|
2
2
|
import { CommandOption, CommandTree } from "@shell-shock/core/types/command";
|
|
3
3
|
|
|
4
4
|
//#region src/components/help.d.ts
|
|
@@ -20,7 +20,7 @@ interface HelpUsageProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* A component that generates the usage display for a command.
|
|
22
22
|
*/
|
|
23
|
-
declare function HelpUsage(props: HelpUsageProps):
|
|
23
|
+
declare function HelpUsage(props: HelpUsageProps): _alloy_js_core10.Children;
|
|
24
24
|
interface HelpOptionsProps {
|
|
25
25
|
/**
|
|
26
26
|
* The options to display help for.
|
|
@@ -30,7 +30,7 @@ interface HelpOptionsProps {
|
|
|
30
30
|
/**
|
|
31
31
|
* A component that generates the options table display for a command.
|
|
32
32
|
*/
|
|
33
|
-
declare function HelpOptions(props: HelpOptionsProps):
|
|
33
|
+
declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core10.Children;
|
|
34
34
|
interface HelpCommandsProps {
|
|
35
35
|
/**
|
|
36
36
|
* A mapping of command names to their command definitions.
|
|
@@ -40,7 +40,7 @@ interface HelpCommandsProps {
|
|
|
40
40
|
/**
|
|
41
41
|
* A component that generates the commands table display for a command.
|
|
42
42
|
*/
|
|
43
|
-
declare function HelpCommands(props: HelpCommandsProps):
|
|
43
|
+
declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core10.Children;
|
|
44
44
|
interface BaseHelpProps {
|
|
45
45
|
/**
|
|
46
46
|
* The command to generate help for.
|
|
@@ -68,7 +68,7 @@ interface BaseHelpProps {
|
|
|
68
68
|
/**
|
|
69
69
|
* A component that generates the `help` function declaration for a command.
|
|
70
70
|
*/
|
|
71
|
-
declare function BaseHelp(props: BaseHelpProps):
|
|
71
|
+
declare function BaseHelp(props: BaseHelpProps): _alloy_js_core10.Children;
|
|
72
72
|
interface VirtualHelpProps {
|
|
73
73
|
/**
|
|
74
74
|
* The options to display help for.
|
|
@@ -89,7 +89,7 @@ interface VirtualHelpProps {
|
|
|
89
89
|
/**
|
|
90
90
|
* A component that generates the invocation of the `help` function for a command.
|
|
91
91
|
*/
|
|
92
|
-
declare function VirtualHelp(props: VirtualHelpProps):
|
|
92
|
+
declare function VirtualHelp(props: VirtualHelpProps): _alloy_js_core10.Children;
|
|
93
93
|
interface CommandHelpProps {
|
|
94
94
|
/**
|
|
95
95
|
* A mapping of command names to their command definitions.
|
|
@@ -99,7 +99,7 @@ interface CommandHelpProps {
|
|
|
99
99
|
/**
|
|
100
100
|
* A component that generates the invocation of the `help` function for a command.
|
|
101
101
|
*/
|
|
102
|
-
declare function CommandHelp(props: CommandHelpProps):
|
|
102
|
+
declare function CommandHelp(props: CommandHelpProps): _alloy_js_core10.Children;
|
|
103
103
|
//#endregion
|
|
104
104
|
export { BaseHelp, BaseHelpProps, CommandHelp, CommandHelpProps, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, VirtualHelp, VirtualHelpProps };
|
|
105
105
|
//# sourceMappingURL=help.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.cts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAoCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EA6FR;AAUjB;AA+DA;AAUA;AAuBA;AA8BA;AAsDA;;EAS2B,MAAA,CAAA,EAAA,MAAA;;;AAc3B;AAwDA;AAUgB,iBApXA,SAAA,CAoXmB,KAAA,EApXF,cAoXkB,CAAA,EApXJ,
|
|
1
|
+
{"version":3,"file":"help.d.cts","names":[],"sources":["../../src/components/help.tsx"],"sourcesContent":[],"mappings":";;;;UAoCiB,cAAA;;;AAAjB;EAoBgB,OAAA,EAhBL,WAgBc;EA6FR;AAUjB;AA+DA;AAUA;AAuBA;AA8BA;AAsDA;;EAS2B,MAAA,CAAA,EAAA,MAAA;;;AAc3B;AAwDA;AAUgB,iBApXA,SAAA,CAoXmB,KAAA,EApXF,cAoXkB,CAAA,EApXJ,gBAAA,CAAA,QAoXI;UAvRlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,gBAAA,CAAA;UA+DlC,iBAAA;;;;YAIL,eAAe;;;;;iBAMX,YAAA,QAAoB,oBAAiB,gBAAA,CAAA;UAuBpC,aAAA;;;;WAIN;;;;;;;;;;;;;;;;;;;;;;;iBA0BK,QAAA,QAAgB,gBAAa,gBAAA,CAAA;UAsD5B,gBAAA;;;;WAIN;;;;YAKC,eAAe;;;;;;;;;;;;iBAcX,WAAA,QAAmB,mBAAgB,gBAAA,CAAA;UAwDlC,gBAAA;;;;WAIN;;;;;iBAMK,WAAA,QAAmB,mBAAgB,gBAAA,CAAA"}
|
package/dist/components/help.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runti
|
|
|
4
4
|
import { For, Show, code, computed } from "@alloy-js/core";
|
|
5
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
6
6
|
import { getAppBin, getDynamicPathSegmentName, isDynamicPathSegment } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
7
|
-
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
8
7
|
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
8
|
+
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
9
9
|
import { sortOptions } from "@shell-shock/core/plugin-utils/reflect";
|
|
10
10
|
import { snakeCase } from "@stryke/string-format/snake-case";
|
|
11
11
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core6 from "@alloy-js/core";
|
|
2
2
|
|
|
3
3
|
//#region src/components/helpers.d.ts
|
|
4
4
|
|
|
@@ -8,22 +8,22 @@ import * as _alloy_js_core0 from "@alloy-js/core";
|
|
|
8
8
|
* @remarks
|
|
9
9
|
* 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.
|
|
10
10
|
*/
|
|
11
|
-
declare function IsDebug():
|
|
11
|
+
declare function IsDebug(): _alloy_js_core6.Children;
|
|
12
12
|
/**
|
|
13
13
|
* Write the logic to determine if the application is **not** running in debug mode.
|
|
14
14
|
*/
|
|
15
|
-
declare function IsNotDebug():
|
|
15
|
+
declare function IsNotDebug(): _alloy_js_core6.Children;
|
|
16
16
|
/**
|
|
17
17
|
* Write the logic to determine if the application is running in verbose mode.
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
20
|
* 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.
|
|
21
21
|
*/
|
|
22
|
-
declare function IsVerbose():
|
|
22
|
+
declare function IsVerbose(): _alloy_js_core6.Children;
|
|
23
23
|
/**
|
|
24
24
|
* Write the logic to determine if the application is **not** running in verbose mode.
|
|
25
25
|
*/
|
|
26
|
-
declare function IsNotVerbose():
|
|
26
|
+
declare function IsNotVerbose(): _alloy_js_core6.Children;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
|
|
29
29
|
//# sourceMappingURL=helpers.d.mts.map
|
|
@@ -20,6 +20,7 @@ exports.CommandHelp = require_components_help.CommandHelp;
|
|
|
20
20
|
exports.CommandInvocation = require_components_command_entry.CommandInvocation;
|
|
21
21
|
exports.CommandRouter = require_components_command_router.CommandRouter;
|
|
22
22
|
exports.CommandRouterRoute = require_components_command_router.CommandRouterRoute;
|
|
23
|
+
exports.CommandValidationLogic = require_components_command_entry.CommandValidationLogic;
|
|
23
24
|
exports.ConsoleBuiltin = require_components_console_builtin.ConsoleBuiltin;
|
|
24
25
|
exports.ContextUtilities = require_components_utils_builtin.ContextUtilities;
|
|
25
26
|
exports.DividerFunctionDeclaration = require_components_console_builtin.DividerFunctionDeclaration;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BannerFunctionBodyDeclaration, BannerFunctionBodyDeclarationProps, BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner-function-declaration.cjs";
|
|
2
2
|
import { BinEntry, BinEntryProps, RunApplication } from "./bin-entry.cjs";
|
|
3
|
-
import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandInvocation } from "./command-entry.cjs";
|
|
3
|
+
import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandInvocation, CommandValidationLogic, CommandValidationLogicProps } from "./command-entry.cjs";
|
|
4
4
|
import { CommandRouter, CommandRouterProps, CommandRouterRoute } from "./command-router.cjs";
|
|
5
|
-
import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.cjs";
|
|
5
|
+
import { ColorsDeclaration, ConsoleBuiltin, ConsoleBuiltinProps, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.cjs";
|
|
6
6
|
import { BaseHelp, BaseHelpProps, CommandHelp, CommandHelpProps, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, VirtualHelp, VirtualHelpProps } from "./help.cjs";
|
|
7
7
|
import { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.cjs";
|
|
8
8
|
import { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, VirtualCommandHandlerDeclarationProps } from "./virtual-command-entry.cjs";
|
|
9
|
-
export { ArgsUtilities, BannerFunctionBodyDeclaration, BannerFunctionBodyDeclarationProps, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BaseHelp, BaseHelpProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandHelp, CommandHelpProps, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, ContextUtilities, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, VirtualCommandHandlerDeclarationProps, VirtualHelp, VirtualHelpProps, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
9
|
+
export { ArgsUtilities, BannerFunctionBodyDeclaration, BannerFunctionBodyDeclarationProps, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BaseHelp, BaseHelpProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandHelp, CommandHelpProps, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, CommandValidationLogic, CommandValidationLogicProps, ConsoleBuiltin, ConsoleBuiltinProps, ContextUtilities, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, VirtualCommandHandlerDeclarationProps, VirtualHelp, VirtualHelpProps, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BannerFunctionBodyDeclaration, BannerFunctionBodyDeclarationProps, BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner-function-declaration.mjs";
|
|
2
2
|
import { BinEntry, BinEntryProps, RunApplication } from "./bin-entry.mjs";
|
|
3
|
-
import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandInvocation } from "./command-entry.mjs";
|
|
3
|
+
import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandInvocation, CommandValidationLogic, CommandValidationLogicProps } from "./command-entry.mjs";
|
|
4
4
|
import { CommandRouter, CommandRouterProps, CommandRouterRoute } from "./command-router.mjs";
|
|
5
|
-
import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
|
|
5
|
+
import { ColorsDeclaration, ConsoleBuiltin, ConsoleBuiltinProps, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
|
|
6
6
|
import { BaseHelp, BaseHelpProps, CommandHelp, CommandHelpProps, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, VirtualHelp, VirtualHelpProps } from "./help.mjs";
|
|
7
7
|
import { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.mjs";
|
|
8
8
|
import { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, VirtualCommandHandlerDeclarationProps } from "./virtual-command-entry.mjs";
|
|
9
|
-
export { ArgsUtilities, BannerFunctionBodyDeclaration, BannerFunctionBodyDeclarationProps, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BaseHelp, BaseHelpProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandHelp, CommandHelpProps, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, ContextUtilities, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, VirtualCommandHandlerDeclarationProps, VirtualHelp, VirtualHelpProps, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
9
|
+
export { ArgsUtilities, BannerFunctionBodyDeclaration, BannerFunctionBodyDeclarationProps, BannerFunctionDeclaration, BannerFunctionDeclarationProps, BaseHelp, BaseHelpProps, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandHandlerDeclarationProps, CommandHelp, CommandHelpProps, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, CommandValidationLogic, CommandValidationLogicProps, ConsoleBuiltin, ConsoleBuiltinProps, ContextUtilities, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, VirtualCommandHandlerDeclarationProps, VirtualHelp, VirtualHelpProps, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
@@ -3,8 +3,8 @@ import { BinEntry, RunApplication } from "./bin-entry.mjs";
|
|
|
3
3
|
import { BaseHelp, CommandHelp, HelpCommands, HelpOptions, HelpUsage, VirtualHelp } from "./help.mjs";
|
|
4
4
|
import { CommandRouter, CommandRouterRoute } from "./command-router.mjs";
|
|
5
5
|
import { VirtualCommandEntry, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.mjs";
|
|
6
|
-
import { CommandEntry, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.mjs";
|
|
6
|
+
import { CommandEntry, CommandHandlerDeclaration, CommandInvocation, CommandValidationLogic } from "./command-entry.mjs";
|
|
7
7
|
import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, StripAnsiFunctionDeclaration, TableFunctionDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
|
|
8
8
|
import { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin } from "./utils-builtin.mjs";
|
|
9
9
|
|
|
10
|
-
export { ArgsUtilities, BannerFunctionBodyDeclaration, BannerFunctionDeclaration, BaseHelp, BinEntry, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandHandlerDeclaration, CommandHelp, CommandInvocation, CommandRouter, CommandRouterRoute, ConsoleBuiltin, ContextUtilities, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, HelpCommands, HelpOptions, HelpUsage, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, UtilsBuiltin, VirtualCommandEntry, VirtualCommandHandlerDeclaration, VirtualHelp, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
10
|
+
export { ArgsUtilities, BannerFunctionBodyDeclaration, BannerFunctionDeclaration, BaseHelp, BinEntry, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandHandlerDeclaration, CommandHelp, CommandInvocation, CommandRouter, CommandRouterRoute, CommandValidationLogic, ConsoleBuiltin, ContextUtilities, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, HelpCommands, HelpOptions, HelpUsage, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, UtilsBuiltin, VirtualCommandEntry, VirtualCommandHandlerDeclaration, VirtualHelp, WrapAnsiFunction, WriteLineFunctionDeclaration };
|
|
@@ -39,7 +39,7 @@ function EnvSupportUtilities() {
|
|
|
39
39
|
"const": true,
|
|
40
40
|
name: "isInteractive",
|
|
41
41
|
doc: "Detect if the current environment is interactive",
|
|
42
|
-
initializer: __alloy_js_core.code` !isMinimal && process.stdin?.isTTY && env.TERM !== "dumb"; `
|
|
42
|
+
initializer: __alloy_js_core.code` !isMinimal && process.stdin?.isTTY && env.TERM !== "dumb" && !hasFlag(["no-interactive", "non-interactive", "no-interact"]); `
|
|
43
43
|
})
|
|
44
44
|
];
|
|
45
45
|
}
|
|
@@ -527,7 +527,7 @@ function ExitFunctionDeclaration() {
|
|
|
527
527
|
}),
|
|
528
528
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
529
529
|
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
|
|
530
|
-
verbose(\`The ${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} application exited \${options.exception ? \`early due to an exception\` : "successfully"}\${options.startDate ? \`. Total processing time is \${Date.now() - options.startDate.getTime() >
|
|
530
|
+
verbose(\`The ${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} application exited \${options.exception ? \`early due to an exception\` : "successfully"}\${options.startDate ? \`. Total processing time is \${Date.now() - options.startDate.getTime() > 5000 ? (Date.now() - options.startDate.getTime()) / 1000 : Date.now() - options.startDate.getTime()} \${Date.now() - options.startDate.getTime() > 5000 ? "seconds" : "milliseconds"}\` : ""}...\`);
|
|
531
531
|
if (!options.skipProcessExit) {
|
|
532
532
|
process.exit(exitCode);
|
|
533
533
|
}
|
|
@@ -576,87 +576,12 @@ function ContextUtilities() {
|
|
|
576
576
|
segments: string[];
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
-
interface UseCommandContext {
|
|
580
|
-
/**
|
|
581
|
-
* Get the current context. Throws if no context is set.
|
|
582
|
-
*/
|
|
583
|
-
use: () => CommandContext;
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Call a function with a specific context instance. This is used internally to set the context for command executions, but can also be used by advanced users to manually set the context for specific operations if needed.
|
|
587
|
-
*/
|
|
588
|
-
call: <R>(instance: CommandContext, callback: () => R | Promise<R>) => Promise<R>;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
const _globalThis = (
|
|
592
|
-
typeof globalThis !== "undefined"
|
|
593
|
-
? globalThis
|
|
594
|
-
: typeof self !== "undefined"
|
|
595
|
-
? self
|
|
596
|
-
: typeof global !== "undefined"
|
|
597
|
-
? global
|
|
598
|
-
: typeof window !== "undefined"
|
|
599
|
-
? window
|
|
600
|
-
: {}
|
|
601
|
-
) as typeof globalThis;
|
|
602
|
-
|
|
603
|
-
const asyncHandlers: Set<() => void | (() => void)> =
|
|
604
|
-
(_globalThis as any)["__shell-shock_async_handlers__"] ||
|
|
605
|
-
((_globalThis as any)["__shell-shock_async_handlers__"] = new Set());
|
|
606
|
-
|
|
607
|
-
function createContext(): UseCommandContext {
|
|
608
|
-
let currentInstance: CommandContext | undefined;
|
|
609
|
-
let als = new AsyncLocalStorage<CommandContext>();
|
|
610
|
-
const getCurrentInstance = (): CommandContext | undefined => {
|
|
611
|
-
if (als) {
|
|
612
|
-
const instance = als.getStore();
|
|
613
|
-
if (instance) {
|
|
614
|
-
return instance;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
return currentInstance;
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
const result = {
|
|
621
|
-
use() {
|
|
622
|
-
const instance = getCurrentInstance();
|
|
623
|
-
if (!instance) {
|
|
624
|
-
throw new Error(
|
|
625
|
-
\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\`
|
|
626
|
-
);
|
|
627
|
-
}
|
|
628
|
-
return instance;
|
|
629
|
-
},
|
|
630
|
-
async call(instance: CommandContext, callback: () => Promise<any> | any) {
|
|
631
|
-
currentInstance = instance;
|
|
632
|
-
const onRestore = () => {
|
|
633
|
-
currentInstance = instance;
|
|
634
|
-
};
|
|
635
|
-
const onLeave = () =>
|
|
636
|
-
currentInstance === instance ? onRestore : undefined;
|
|
637
|
-
|
|
638
|
-
asyncHandlers.add(onLeave);
|
|
639
|
-
|
|
640
|
-
try {
|
|
641
|
-
return await (als ? als.run(instance, callback) : callback());
|
|
642
|
-
} finally {
|
|
643
|
-
asyncHandlers.delete(onLeave);
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
((_globalThis as any)["__shell-shock__"]) ??= {};
|
|
649
|
-
((_globalThis as any)["__shell-shock__"]).__command__ = result;
|
|
650
|
-
|
|
651
|
-
return result;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
579
|
/**
|
|
655
580
|
* The global Shell Shock - Command context instance.
|
|
656
581
|
*
|
|
657
582
|
* @internal
|
|
658
583
|
*/
|
|
659
|
-
export let
|
|
584
|
+
export let internal_commandContextStore = new AsyncLocalStorage<CommandContext>();
|
|
660
585
|
|
|
661
586
|
/**
|
|
662
587
|
* Get the Shell Shock - Command context for the current application.
|
|
@@ -665,16 +590,14 @@ function ContextUtilities() {
|
|
|
665
590
|
* @returns The Shell Shock - Command context for the current application.
|
|
666
591
|
* @throws If the Shell Shock - Command context is not available.
|
|
667
592
|
*/
|
|
668
|
-
function useCommand(): CommandContext {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}
|
|
593
|
+
export function useCommand(): CommandContext {
|
|
594
|
+
const result = internal_commandContextStore.getStore();
|
|
595
|
+
if (!result) {
|
|
596
|
+
throw new Error(
|
|
597
|
+
\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\`
|
|
598
|
+
);
|
|
675
599
|
}
|
|
676
|
-
|
|
677
|
-
return internal_commandContext.use();
|
|
600
|
+
return result;
|
|
678
601
|
}
|
|
679
602
|
|
|
680
603
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.cjs","names":["code","Show","splitProps","FunctionDeclaration","IfStatement","InterfaceDeclaration","InterfaceMember","VarDeclaration","usePowerlines","BuiltinFile","TSDoc","TSDocLink","TSDocParam","TSDocReturns","getAppTitle","defu","IsVerbose","EnvSupportUtilities","_$createComponent","name","doc","initializer","_$createIntrinsic","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","ExitFunctionDeclaration","context","optional","async","_$memo","condition","ContextUtilities","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-builtin.tsx"],"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 { code, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocLink,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { IsVerbose } from \"./helpers\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Checks if a specific flag is present in the command line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command line arguments from Deno or Node.js environments.\">\n <TSDocReturns>\n {\n \"An array of command line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Checks if a specific flag is present in the command line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"getArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * The `exit` handler function declaration code for the Shell Shock project.\n */\nexport function ExitFunctionDeclaration() {\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"ExitOptions\"\n doc=\"Options for the exit handler function.\">\n <InterfaceMember\n name=\"exception\"\n optional\n type=\"string | Error\"\n doc=\"An optional exception that caused the exit. This can be a string message or an Error object.\"\n />\n <hbr />\n <InterfaceMember\n name=\"skipProcessExit\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should manually exit the process or not. If set to true, the exit function will not call process.exit() and will allow the application to continue running. If set to false or not specified, the exit function will call process.exit() to terminate the application.\"\n />\n <hbr />\n <InterfaceMember\n name=\"isSynchronous\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should perform synchronous operations only. If set to true, the exit function will avoid any asynchronous operations during exit. If set to false or not specified, the exit function may perform asynchronous operations as needed.\"\n />\n <hbr />\n <InterfaceMember\n name=\"signal\"\n optional\n type=\"number\"\n doc=\"The signal number that triggered the exit. This is typically used when the shutdown is initiated by a system signal (e.g., SIGINT, SIGTERM).\"\n />\n <hbr />\n <InterfaceMember\n name=\"startDate\"\n optional\n type=\"Date\"\n doc=\"A Date object representing the timestamp when the process started. This can be used to measure the duration of the shutdown process.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <hbr />\n <VarDeclaration\n let\n name=\"isExiting\"\n type=\"boolean\"\n initializer={code`false;`}\n />\n <VarDeclaration\n const\n name=\"callbackAsyncQueue\"\n type=\"Array<[(code: number | string) => Promise<void> | void, number]>\"\n initializer={code`[];`}\n />\n <VarDeclaration\n const\n name=\"callbackSyncQueue\"\n type=\"Array<(code: number | string) => void>\"\n initializer={code`[];`}\n />\n <hbr />\n <hbr />\n <FunctionDeclaration\n export\n async\n name=\"exit\"\n parameters={[\n {\n name: \"options\",\n type: \"ExitOptions\",\n default: \"{}\"\n }\n ]}>\n {code`\n try {\n if (isExiting) {\n return;\n }\n\n isExiting = true;\n\n let exitCode: number | string = 0;\n if ((options.signal !== undefined && options.signal > 0) || options.exception) {\n exitCode = 128 + (options.signal ?? 1);\n } else if (typeof process.exitCode === \"number\" || typeof process.exitCode === \"string\") {\n exitCode = process.exitCode;\n }\n\n if (options.exception) {\n error(\\`A fatal error occured while running the application - please contact the ${getAppTitle(\n context\n )} support team: \\\\n\\\\n\\${typeof options.exception === \"string\" ? options.exception : options.exception.message}\\`);\n }\n\n const terminate = (force = false) => { `}\n <IfStatement\n condition={<IsVerbose />}>{code`writeLine(\"\");`}</IfStatement>\n <hbr />\n {code`\n verbose(\\`The ${getAppTitle(\n context\n )} application exited \\${options.exception ? \\`early due to an exception\\` : \"successfully\"}\\${options.startDate ? \\`. Total processing time is \\${Date.now() - options.startDate.getTime() > 100_000 ? (Date.now() - options.startDate.getTime()) / 1000 : Date.now() - options.startDate.getTime()} \\${Date.now() - options.startDate.getTime() > 100_000 ? \"seconds\" : \"milliseconds\"}\\` : \"\"}...\\`);\n if (!options.skipProcessExit) {\n process.exit(exitCode);\n }\n };\n\n for (const callbackSync of callbackSyncQueue) {\n callbackSync(exitCode);\n }\n\n if (!options.isSynchronous) {\n const promises = [];\n let forceAfter = 0;\n for (const [callbackAsync, wait] of callbackAsyncQueue) {\n forceAfter = Math.max(forceAfter, wait);\n promises.push(Promise.resolve(callbackAsync(exitCode)));\n }\n\n const asyncTimer = setTimeout(() => {\n terminate(true);\n }, forceAfter);\n await Promise.all(promises);\n clearTimeout(asyncTimer);\n }\n\n terminate();\n } catch (err) {\n error(\\`The exit process failed to complete\\${(err as Error).message ? \\` - (err as Error).message\\` : \"\"}. Please contact the ${getAppTitle(\n context\n )} support team.\\`);\n\n if (!options.skipProcessExit) {\n process.exit(1);\n }\n }\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n return code`\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n interface CommandContext {\n path: string;\n segments: string[];\n }\n\n interface UseCommandContext {\n /**\n * Get the current context. Throws if no context is set.\n */\n use: () => CommandContext;\n\n /**\n * Call a function with a specific context instance. This is used internally to set the context for command executions, but can also be used by advanced users to manually set the context for specific operations if needed.\n */\n call: <R>(instance: CommandContext, callback: () => R | Promise<R>) => Promise<R>;\n }\n\n const _globalThis = (\n typeof globalThis !== \"undefined\"\n ? globalThis\n : typeof self !== \"undefined\"\n ? self\n : typeof global !== \"undefined\"\n ? global\n : typeof window !== \"undefined\"\n ? window\n : {}\n ) as typeof globalThis;\n\n const asyncHandlers: Set<() => void | (() => void)> =\n (_globalThis as any)[\"__shell-shock_async_handlers__\"] ||\n ((_globalThis as any)[\"__shell-shock_async_handlers__\"] = new Set());\n\n function createContext(): UseCommandContext {\n let currentInstance: CommandContext | undefined;\n let als = new AsyncLocalStorage<CommandContext>();\n const getCurrentInstance = (): CommandContext | undefined => {\n if (als) {\n const instance = als.getStore();\n if (instance) {\n return instance;\n }\n }\n return currentInstance;\n };\n\n const result = {\n use() {\n const instance = getCurrentInstance();\n if (!instance) {\n throw new Error(\n \\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n }\n return instance;\n },\n async call(instance: CommandContext, callback: () => Promise<any> | any) {\n currentInstance = instance;\n const onRestore = () => {\n currentInstance = instance;\n };\n const onLeave = () =>\n currentInstance === instance ? onRestore : undefined;\n\n asyncHandlers.add(onLeave);\n\n try {\n return await (als ? als.run(instance, callback) : callback());\n } finally {\n asyncHandlers.delete(onLeave);\n }\n },\n };\n\n ((_globalThis as any)[\"__shell-shock__\"]) ??= {};\n ((_globalThis as any)[\"__shell-shock__\"]).__command__ = result;\n\n return result;\n }\n\n /**\n * The global Shell Shock - Command context instance.\n *\n * @internal\n */\n export let internal_commandContext = createContext();\n\n /**\n * Get the Shell Shock - Command context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Command context for the current application.\n * @throws If the Shell Shock - Command context is not available.\n */\n function useCommand(): CommandContext {\n if (!internal_commandContext) {\n if ((_globalThis as any)[\"__shell-shock__\"]?.__command__) {\n internal_commandContext = (_globalThis as any)[\"__shell-shock__\"].__command__;\n } else {\n internal_commandContext = createContext();\n }\n }\n\n return internal_commandContext.use();\n }\n\n /**\n * A utility hook function to get the individual segments of the current command path.\n *\n * @returns An array of command path segments.\n * @throws If the command context is not available.\n */\n export function useSegments(): string[] {\n return useCommand().segments;\n }\n\n /**\n * A utility hook function to get the full command path as a string.\n *\n * @returns The full command path as a string.\n * @throws If the command context is not available.\n */\n export function usePath(): string {\n return useCommand().path;\n }\n `;\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\",\n \"node:async_hooks\": [\"AsyncLocalStorage\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\", \"isDevelopment\", \"isDebug\"]\n })}>\n <hbr />\n <hbr />\n <ArgsUtilities />\n <hbr />\n <hbr />\n <EnvSupportUtilities />\n <hbr />\n <hbr />\n <HyperlinkSupportUtilities />\n <hbr />\n <hbr />\n <ColorSupportUtilities />\n <hbr />\n <hbr />\n <ContextUtilities />\n <hbr />\n <hbr />\n <ExitFunctionDeclaration />\n <hbr />\n <hbr />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiDA,SAAgBiB,sBAAsB;AACpC,QAAA;mDAEKV,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GACHC,aAAarB,oBAAI;GAAkD,CAAA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AAA,IACRI,UAAO;AAAA,4BAAOJ,KAAKI,WAAW,EAAE,EAAE;IAChC,WAAW;IACX,gBAAgB;IAChB,oBAAoB,CAAC,oBAAmB;IACzC,CAAC;;EAAA,IACFC,iBAAc;AAAA,4BAAOL,KAAKK,kBAAkB,EAAE,EAAE;IAC9CC,SAAS;KAAC;KAAS;KAAW;KAAY;IAC1CC,KAAK;KAAC;KAAO;KAAQ;KAAU;KAAa;KAAiB;KAAS;IACvE,CAAC;;EAAA,IAAAxB,WAAA;AAAA,UAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGDO,eAAa,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGbd,qBAAmB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGnBY,2BAAyB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGzBN,uBAAqB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGrBe,kBAAgB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGhBN,yBAAuB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGvB/B,sBAAI;KAAA,IAACgD,OAAI;AAAA,aAAEC,QAAQ1B,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"utils-builtin.cjs","names":["code","Show","splitProps","FunctionDeclaration","IfStatement","InterfaceDeclaration","InterfaceMember","VarDeclaration","usePowerlines","BuiltinFile","TSDoc","TSDocLink","TSDocParam","TSDocReturns","getAppTitle","defu","IsVerbose","EnvSupportUtilities","_$createComponent","name","doc","initializer","_$createIntrinsic","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","ExitFunctionDeclaration","context","optional","async","_$memo","condition","ContextUtilities","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-builtin.tsx"],"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 { code, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocLink,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { IsVerbose } from \"./helpers\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\" && !hasFlag([\"no-interactive\", \"non-interactive\", \"no-interact\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Checks if a specific flag is present in the command line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <hbr />\n <hbr />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command line arguments from Deno or Node.js environments.\">\n <TSDocReturns>\n {\n \"An array of command line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <TSDoc heading=\"Checks if a specific flag is present in the command line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"getArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * The `exit` handler function declaration code for the Shell Shock project.\n */\nexport function ExitFunctionDeclaration() {\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"ExitOptions\"\n doc=\"Options for the exit handler function.\">\n <InterfaceMember\n name=\"exception\"\n optional\n type=\"string | Error\"\n doc=\"An optional exception that caused the exit. This can be a string message or an Error object.\"\n />\n <hbr />\n <InterfaceMember\n name=\"skipProcessExit\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should manually exit the process or not. If set to true, the exit function will not call process.exit() and will allow the application to continue running. If set to false or not specified, the exit function will call process.exit() to terminate the application.\"\n />\n <hbr />\n <InterfaceMember\n name=\"isSynchronous\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should perform synchronous operations only. If set to true, the exit function will avoid any asynchronous operations during exit. If set to false or not specified, the exit function may perform asynchronous operations as needed.\"\n />\n <hbr />\n <InterfaceMember\n name=\"signal\"\n optional\n type=\"number\"\n doc=\"The signal number that triggered the exit. This is typically used when the shutdown is initiated by a system signal (e.g., SIGINT, SIGTERM).\"\n />\n <hbr />\n <InterfaceMember\n name=\"startDate\"\n optional\n type=\"Date\"\n doc=\"A Date object representing the timestamp when the process started. This can be used to measure the duration of the shutdown process.\"\n />\n </InterfaceDeclaration>\n <hbr />\n <hbr />\n <VarDeclaration\n let\n name=\"isExiting\"\n type=\"boolean\"\n initializer={code`false;`}\n />\n <VarDeclaration\n const\n name=\"callbackAsyncQueue\"\n type=\"Array<[(code: number | string) => Promise<void> | void, number]>\"\n initializer={code`[];`}\n />\n <VarDeclaration\n const\n name=\"callbackSyncQueue\"\n type=\"Array<(code: number | string) => void>\"\n initializer={code`[];`}\n />\n <hbr />\n <hbr />\n <FunctionDeclaration\n export\n async\n name=\"exit\"\n parameters={[\n {\n name: \"options\",\n type: \"ExitOptions\",\n default: \"{}\"\n }\n ]}>\n {code`\n try {\n if (isExiting) {\n return;\n }\n\n isExiting = true;\n\n let exitCode: number | string = 0;\n if ((options.signal !== undefined && options.signal > 0) || options.exception) {\n exitCode = 128 + (options.signal ?? 1);\n } else if (typeof process.exitCode === \"number\" || typeof process.exitCode === \"string\") {\n exitCode = process.exitCode;\n }\n\n if (options.exception) {\n error(\\`A fatal error occured while running the application - please contact the ${getAppTitle(\n context\n )} support team: \\\\n\\\\n\\${typeof options.exception === \"string\" ? options.exception : options.exception.message}\\`);\n }\n\n const terminate = (force = false) => { `}\n <IfStatement\n condition={<IsVerbose />}>{code`writeLine(\"\");`}</IfStatement>\n <hbr />\n {code`\n verbose(\\`The ${getAppTitle(\n context\n )} application exited \\${options.exception ? \\`early due to an exception\\` : \"successfully\"}\\${options.startDate ? \\`. Total processing time is \\${Date.now() - options.startDate.getTime() > 5000 ? (Date.now() - options.startDate.getTime()) / 1000 : Date.now() - options.startDate.getTime()} \\${Date.now() - options.startDate.getTime() > 5000 ? \"seconds\" : \"milliseconds\"}\\` : \"\"}...\\`);\n if (!options.skipProcessExit) {\n process.exit(exitCode);\n }\n };\n\n for (const callbackSync of callbackSyncQueue) {\n callbackSync(exitCode);\n }\n\n if (!options.isSynchronous) {\n const promises = [];\n let forceAfter = 0;\n for (const [callbackAsync, wait] of callbackAsyncQueue) {\n forceAfter = Math.max(forceAfter, wait);\n promises.push(Promise.resolve(callbackAsync(exitCode)));\n }\n\n const asyncTimer = setTimeout(() => {\n terminate(true);\n }, forceAfter);\n await Promise.all(promises);\n clearTimeout(asyncTimer);\n }\n\n terminate();\n } catch (err) {\n error(\\`The exit process failed to complete\\${(err as Error).message ? \\` - (err as Error).message\\` : \"\"}. Please contact the ${getAppTitle(\n context\n )} support team.\\`);\n\n if (!options.skipProcessExit) {\n process.exit(1);\n }\n }\n `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n return code`\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n interface CommandContext {\n path: string;\n segments: string[];\n }\n\n /**\n * The global Shell Shock - Command context instance.\n *\n * @internal\n */\n export let internal_commandContextStore = new AsyncLocalStorage<CommandContext>();\n\n /**\n * Get the Shell Shock - Command context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Command context for the current application.\n * @throws If the Shell Shock - Command context is not available.\n */\n export function useCommand(): CommandContext {\n const result = internal_commandContextStore.getStore();\n if (!result) {\n throw new Error(\n \\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n }\n return result;\n }\n\n /**\n * A utility hook function to get the individual segments of the current command path.\n *\n * @returns An array of command path segments.\n * @throws If the command context is not available.\n */\n export function useSegments(): string[] {\n return useCommand().segments;\n }\n\n /**\n * A utility hook function to get the full command path as a string.\n *\n * @returns The full command path as a string.\n * @throws If the command context is not available.\n */\n export function usePath(): string {\n return useCommand().path;\n }\n `;\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\",\n \"node:async_hooks\": [\"AsyncLocalStorage\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\", \"isDevelopment\", \"isDebug\"]\n })}>\n <hbr />\n <hbr />\n <ArgsUtilities />\n <hbr />\n <hbr />\n <EnvSupportUtilities />\n <hbr />\n <hbr />\n <HyperlinkSupportUtilities />\n <hbr />\n <hbr />\n <ColorSupportUtilities />\n <hbr />\n <hbr />\n <ContextUtilities />\n <hbr />\n <hbr />\n <ExitFunctionDeclaration />\n <hbr />\n <hbr />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiDA,SAAgBiB,sBAAsB;AACpC,QAAA;mDAEKV,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GAC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C,WAAW;IACX,gBAAgB;IAChB,oBAAoB,CAAC,oBAAmB;IACzC,CAAC;;EAAA,IACFC,iBAAc;AAAA,4BAAOL,KAAKK,kBAAkB,EAAE,EAAE;IAC9CC,SAAS;KAAC;KAAS;KAAW;KAAY;IAC1CC,KAAK;KAAC;KAAO;KAAQ;KAAU;KAAa;KAAiB;KAAS;IACvE,CAAC;;EAAA,IAAAxB,WAAA;AAAA,UAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGDO,eAAa,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGbd,qBAAmB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGnBY,2BAAyB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGzBN,uBAAqB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGrBe,kBAAgB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGhBN,yBAAuB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGvB/B,sBAAI;KAAA,IAACgD,OAAI;AAAA,aAAEC,QAAQ1B,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core3 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,28 +6,28 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates utilities for detecting terminal color support.
|
|
8
8
|
*/
|
|
9
|
-
declare function EnvSupportUtilities():
|
|
9
|
+
declare function EnvSupportUtilities(): _alloy_js_core3.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Generates utilities for detecting terminal color support.
|
|
12
12
|
*/
|
|
13
|
-
declare function ColorSupportUtilities():
|
|
13
|
+
declare function ColorSupportUtilities(): _alloy_js_core3.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Generates utilities for detecting terminal color support.
|
|
16
16
|
*/
|
|
17
|
-
declare function HyperlinkSupportUtilities():
|
|
17
|
+
declare function HyperlinkSupportUtilities(): _alloy_js_core3.Children;
|
|
18
18
|
/**
|
|
19
19
|
* Generates utilities for detecting terminal color support.
|
|
20
20
|
*/
|
|
21
|
-
declare function ArgsUtilities():
|
|
21
|
+
declare function ArgsUtilities(): _alloy_js_core3.Children;
|
|
22
22
|
/**
|
|
23
23
|
* The `exit` handler function declaration code for the Shell Shock project.
|
|
24
24
|
*/
|
|
25
|
-
declare function ExitFunctionDeclaration():
|
|
26
|
-
declare function ContextUtilities():
|
|
25
|
+
declare function ExitFunctionDeclaration(): _alloy_js_core3.Children;
|
|
26
|
+
declare function ContextUtilities(): _alloy_js_core3.Children;
|
|
27
27
|
/**
|
|
28
28
|
* A built-in utilities module for Shell Shock.
|
|
29
29
|
*/
|
|
30
|
-
declare function UtilsBuiltin(props: UtilsBuiltinProps):
|
|
30
|
+
declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core3.Children;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps };
|
|
33
33
|
//# sourceMappingURL=utils-builtin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAwCiB,iBAAA,SAA0B,KACzC;;AADF;AASA;AAmCgB,iBAnCA,mBAAA,CAAA,CAmCqB,EAnCF,eAAA,CAAA,QAmCE;AA0MrC;AA2GA;AA+DA;AAkJgB,iBAtgBA,qBAAA,CAAA,CAsgBgB,EAtgBK,eAAA,CAAA,QAsgBL;
|
|
1
|
+
{"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAwCiB,iBAAA,SAA0B,KACzC;;AADF;AASA;AAmCgB,iBAnCA,mBAAA,CAAA,CAmCqB,EAnCF,eAAA,CAAA,QAmCE;AA0MrC;AA2GA;AA+DA;AAkJgB,iBAtgBA,qBAAA,CAAA,CAsgBgB,EAtgBK,eAAA,CAAA,QAsgBL;AA2DhC;;;iBAvXgB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA2GzB,aAAA,CAAA,GAAa,eAAA,CAAA;;;;iBA+Db,uBAAA,CAAA,GAAuB,eAAA,CAAA;iBAkJvB,gBAAA,CAAA,GAAgB,eAAA,CAAA;;;;iBA2DhB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
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,28 +6,28 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates utilities for detecting terminal color support.
|
|
8
8
|
*/
|
|
9
|
-
declare function EnvSupportUtilities():
|
|
9
|
+
declare function EnvSupportUtilities(): _alloy_js_core0.Children;
|
|
10
10
|
/**
|
|
11
11
|
* Generates utilities for detecting terminal color support.
|
|
12
12
|
*/
|
|
13
|
-
declare function ColorSupportUtilities():
|
|
13
|
+
declare function ColorSupportUtilities(): _alloy_js_core0.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Generates utilities for detecting terminal color support.
|
|
16
16
|
*/
|
|
17
|
-
declare function HyperlinkSupportUtilities():
|
|
17
|
+
declare function HyperlinkSupportUtilities(): _alloy_js_core0.Children;
|
|
18
18
|
/**
|
|
19
19
|
* Generates utilities for detecting terminal color support.
|
|
20
20
|
*/
|
|
21
|
-
declare function ArgsUtilities():
|
|
21
|
+
declare function ArgsUtilities(): _alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* The `exit` handler function declaration code for the Shell Shock project.
|
|
24
24
|
*/
|
|
25
|
-
declare function ExitFunctionDeclaration():
|
|
26
|
-
declare function ContextUtilities():
|
|
25
|
+
declare function ExitFunctionDeclaration(): _alloy_js_core0.Children;
|
|
26
|
+
declare function ContextUtilities(): _alloy_js_core0.Children;
|
|
27
27
|
/**
|
|
28
28
|
* A built-in utilities module for Shell Shock.
|
|
29
29
|
*/
|
|
30
|
-
declare function UtilsBuiltin(props: UtilsBuiltinProps):
|
|
30
|
+
declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core0.Children;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps };
|
|
33
33
|
//# sourceMappingURL=utils-builtin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAwCiB,iBAAA,SAA0B,KACzC;;AADF;AASA;AAmCgB,iBAnCA,mBAAA,CAAA,CAmCqB,EAnCF,eAAA,CAAA,QAmCE;AA0MrC;AA2GA;AA+DA;AAkJgB,iBAtgBA,qBAAA,CAAA,CAsgBgB,EAtgBK,eAAA,CAAA,QAsgBL;
|
|
1
|
+
{"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAwCiB,iBAAA,SAA0B,KACzC;;AADF;AASA;AAmCgB,iBAnCA,mBAAA,CAAA,CAmCqB,EAnCF,eAAA,CAAA,QAmCE;AA0MrC;AA2GA;AA+DA;AAkJgB,iBAtgBA,qBAAA,CAAA,CAsgBgB,EAtgBK,eAAA,CAAA,QAsgBL;AA2DhC;;;iBAvXgB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA2GzB,aAAA,CAAA,GAAa,eAAA,CAAA;;;;iBA+Db,uBAAA,CAAA,GAAuB,eAAA,CAAA;iBAkJvB,gBAAA,CAAA,GAAgB,eAAA,CAAA;;;;iBA2DhB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
|