@shell-shock/preset-script 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +1 -1
  2. package/dist/components/args-parser-logic.cjs +678 -0
  3. package/dist/components/args-parser-logic.cjs.map +1 -0
  4. package/dist/components/args-parser-logic.d.cts +45 -0
  5. package/dist/components/args-parser-logic.d.cts.map +1 -0
  6. package/dist/components/args-parser-logic.d.mts +45 -0
  7. package/dist/components/args-parser-logic.d.mts.map +1 -0
  8. package/dist/components/args-parser-logic.mjs +672 -0
  9. package/dist/components/args-parser-logic.mjs.map +1 -0
  10. package/dist/components/bin-entry.cjs +188 -0
  11. package/dist/components/bin-entry.cjs.map +1 -0
  12. package/dist/components/{entry/bin.d.cts → bin-entry.d.cts} +9 -3
  13. package/dist/components/bin-entry.d.cts.map +1 -0
  14. package/dist/components/{entry/bin.d.mts → bin-entry.d.mts} +9 -3
  15. package/dist/components/bin-entry.d.mts.map +1 -0
  16. package/dist/components/bin-entry.mjs +185 -0
  17. package/dist/components/bin-entry.mjs.map +1 -0
  18. package/dist/components/command-entry.cjs +162 -0
  19. package/dist/components/command-entry.cjs.map +1 -0
  20. package/dist/components/command-entry.d.cts +24 -0
  21. package/dist/components/command-entry.d.cts.map +1 -0
  22. package/dist/components/command-entry.d.mts +24 -0
  23. package/dist/components/command-entry.d.mts.map +1 -0
  24. package/dist/components/command-entry.mjs +158 -0
  25. package/dist/components/command-entry.mjs.map +1 -0
  26. package/dist/components/command-router.cjs +129 -74
  27. package/dist/components/command-router.cjs.map +1 -1
  28. package/dist/components/command-router.d.cts +13 -4
  29. package/dist/components/command-router.d.cts.map +1 -0
  30. package/dist/components/command-router.d.mts +13 -4
  31. package/dist/components/command-router.d.mts.map +1 -0
  32. package/dist/components/command-router.mjs +128 -73
  33. package/dist/components/command-router.mjs.map +1 -1
  34. package/dist/components/console-builtin.cjs +2086 -0
  35. package/dist/components/console-builtin.cjs.map +1 -0
  36. package/dist/components/console-builtin.d.cts +56 -0
  37. package/dist/components/console-builtin.d.cts.map +1 -0
  38. package/dist/components/console-builtin.d.mts +56 -0
  39. package/dist/components/console-builtin.d.mts.map +1 -0
  40. package/dist/components/console-builtin.mjs +2077 -0
  41. package/dist/components/console-builtin.mjs.map +1 -0
  42. package/dist/components/help.cjs +130 -0
  43. package/dist/components/help.cjs.map +1 -0
  44. package/dist/components/help.d.cts +57 -0
  45. package/dist/components/help.d.cts.map +1 -0
  46. package/dist/components/help.d.mts +57 -0
  47. package/dist/components/help.d.mts.map +1 -0
  48. package/dist/components/help.mjs +126 -0
  49. package/dist/components/help.mjs.map +1 -0
  50. package/dist/components/index.cjs +39 -15
  51. package/dist/components/index.d.cts +9 -7
  52. package/dist/components/index.d.mts +9 -7
  53. package/dist/components/index.mjs +8 -6
  54. package/dist/components/utils-builtin.cjs +612 -0
  55. package/dist/components/utils-builtin.cjs.map +1 -0
  56. package/dist/components/utils-builtin.d.cts +32 -0
  57. package/dist/components/utils-builtin.d.cts.map +1 -0
  58. package/dist/components/utils-builtin.d.mts +32 -0
  59. package/dist/components/utils-builtin.d.mts.map +1 -0
  60. package/dist/components/utils-builtin.mjs +605 -0
  61. package/dist/components/utils-builtin.mjs.map +1 -0
  62. package/dist/components/virtual-command-entry.cjs +140 -0
  63. package/dist/components/virtual-command-entry.cjs.map +1 -0
  64. package/dist/components/virtual-command-entry.d.cts +21 -0
  65. package/dist/components/virtual-command-entry.d.cts.map +1 -0
  66. package/dist/components/virtual-command-entry.d.mts +21 -0
  67. package/dist/components/virtual-command-entry.d.mts.map +1 -0
  68. package/dist/components/virtual-command-entry.mjs +137 -0
  69. package/dist/components/virtual-command-entry.mjs.map +1 -0
  70. package/dist/contexts/index.cjs +4 -0
  71. package/dist/contexts/index.d.cts +2 -0
  72. package/dist/contexts/index.d.mts +2 -0
  73. package/dist/contexts/index.mjs +3 -0
  74. package/dist/contexts/theme.d.cts +20 -0
  75. package/dist/contexts/theme.d.cts.map +1 -0
  76. package/dist/contexts/theme.d.mts +20 -0
  77. package/dist/contexts/theme.d.mts.map +1 -0
  78. package/dist/helpers/ansi-utils.cjs +28 -4
  79. package/dist/helpers/ansi-utils.cjs.map +1 -1
  80. package/dist/helpers/ansi-utils.d.cts +68 -0
  81. package/dist/helpers/ansi-utils.d.cts.map +1 -0
  82. package/dist/helpers/ansi-utils.d.mts +68 -0
  83. package/dist/helpers/ansi-utils.d.mts.map +1 -0
  84. package/dist/helpers/ansi-utils.mjs +28 -4
  85. package/dist/helpers/ansi-utils.mjs.map +1 -1
  86. package/dist/helpers/get-default-options.cjs +6 -13
  87. package/dist/helpers/get-default-options.cjs.map +1 -1
  88. package/dist/helpers/get-default-options.mjs +6 -13
  89. package/dist/helpers/get-default-options.mjs.map +1 -1
  90. package/dist/index.cjs +117 -29
  91. package/dist/index.cjs.map +1 -1
  92. package/dist/index.d.cts.map +1 -0
  93. package/dist/index.d.mts.map +1 -0
  94. package/dist/index.mjs +118 -28
  95. package/dist/index.mjs.map +1 -1
  96. package/dist/types/plugin.d.cts +1 -6
  97. package/dist/types/plugin.d.cts.map +1 -0
  98. package/dist/types/plugin.d.mts +1 -6
  99. package/dist/types/plugin.d.mts.map +1 -0
  100. package/package.json +163 -71
  101. package/dist/components/builtin/console.cjs +0 -1232
  102. package/dist/components/builtin/console.cjs.map +0 -1
  103. package/dist/components/builtin/console.d.cts +0 -37
  104. package/dist/components/builtin/console.d.mts +0 -37
  105. package/dist/components/builtin/console.mjs +0 -1225
  106. package/dist/components/builtin/console.mjs.map +0 -1
  107. package/dist/components/builtin/index.cjs +0 -9
  108. package/dist/components/builtin/index.d.cts +0 -2
  109. package/dist/components/builtin/index.d.mts +0 -2
  110. package/dist/components/builtin/index.mjs +0 -3
  111. package/dist/components/entry/bin.cjs +0 -92
  112. package/dist/components/entry/bin.cjs.map +0 -1
  113. package/dist/components/entry/bin.mjs +0 -91
  114. package/dist/components/entry/bin.mjs.map +0 -1
  115. package/dist/components/entry/command.cjs +0 -54
  116. package/dist/components/entry/command.cjs.map +0 -1
  117. package/dist/components/entry/command.d.cts +0 -15
  118. package/dist/components/entry/command.d.mts +0 -15
  119. package/dist/components/entry/command.mjs +0 -53
  120. package/dist/components/entry/command.mjs.map +0 -1
  121. package/dist/components/entry/index.cjs +0 -3
  122. package/dist/components/entry/index.d.cts +0 -2
  123. package/dist/components/entry/index.d.mts +0 -2
  124. package/dist/components/entry/index.mjs +0 -3
  125. package/dist/components/shutdown.cjs +0 -93
  126. package/dist/components/shutdown.cjs.map +0 -1
  127. package/dist/components/shutdown.d.cts +0 -14
  128. package/dist/components/shutdown.d.mts +0 -14
  129. package/dist/components/shutdown.mjs +0 -91
  130. package/dist/components/shutdown.mjs.map +0 -1
  131. package/dist/contexts/command.cjs +0 -21
  132. package/dist/contexts/command.cjs.map +0 -1
  133. package/dist/contexts/command.mjs +0 -19
  134. package/dist/contexts/command.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-builtin.mjs","names":["code","Show","splitProps","FunctionDeclaration","InterfaceDeclaration","InterfaceMember","VarDeclaration","usePowerlines","BuiltinFile","TSDoc","TSDocLink","TSDocParam","TSDocReturns","getAppTitle","defu","EnvSupportUtilities","_$createComponent","name","doc","initializer","_$createIntrinsic","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","ExitFunctionDeclaration","context","optional","async","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 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\";\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 forceColor = hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ? 0\n : hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ? 1\n : 0;\n }\n\n if (forceColor === 0) {\n return 0;\n }\n\n if (ignoreFlags !== true) {\n if (hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\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 </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\\${typeof options.exception === \"string\" ? options.exception : options.exception.message}\\`);\n }\n\n const terminate = (force = false) => {\n verbose(\\`The ${getAppTitle(\n context\n )} application exited \\${options.exception ? \\`early due to an exception\\` : \"successfully\"}...\\`);\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\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 })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\"]\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 <ExitFunctionDeclaration />\n <hbr />\n <hbr />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA+CA,SAAgBe,sBAAsB;AACpC,QAAA;EAAAC,gBAEKV,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbW,MAAI;GACJC,KAAG;GACHC,aAAanB,IAAI;GAAkD,CAAA;EAAAoB,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,OAAA,EAAA,CAAA;EAAAJ,gBAIpEV,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbW,MAAI;GACJC,KAAG;GACHC,aAAanB,IAAI;GAA4C,CAAA;EAAAoB,gBAAA,OAAA,EAAA,CAAA;EAAAA,gBAAA,OAAA,EAAA,CAAA;EAAAJ,gBAI9DV,gBAAc;GAAA,UAAA;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;IAAAF,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGDa,eAAa,EAAA,CAAA;IAAAT,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGbD,qBAAmB,EAAA,CAAA;IAAAK,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGnBW,2BAAyB,EAAA,CAAA;IAAAP,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGzBK,uBAAqB,EAAA,CAAA;IAAAD,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGrBc,yBAAuB,EAAA,CAAA;IAAAV,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAJ,gBAGvBf,MAAI;KAAA,IAAC2C,OAAI;AAAA,aAAEC,QAAQvB,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
@@ -0,0 +1,140 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_components_help = require('./help.cjs');
3
+ const require_components_command_router = require('./command-router.cjs');
4
+ const require_components_command_entry = require('./command-entry.cjs');
5
+ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let __alloy_js_core = require("@alloy-js/core");
7
+ let __alloy_js_typescript = require("@alloy-js/typescript");
8
+ let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
9
+ let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
10
+ let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
11
+ let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
12
+ let defu = require("defu");
13
+ defu = require_rolldown_runtime.__toESM(defu);
14
+ let __stryke_path_join = require("@stryke/path/join");
15
+ let __stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
16
+ let __powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
17
+
18
+ //#region src/components/virtual-command-entry.tsx
19
+ /**
20
+ * A component that generates the `handler` function declaration for a command.
21
+ */
22
+ function VirtualCommandHandlerDeclaration(props) {
23
+ const { command } = props;
24
+ const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
25
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
26
+ get heading() {
27
+ return `The ${command.title} (${(0, __shell_shock_core_plugin_utils_context_helpers.getAppBin)(context)} ${command.path.segments.map((segment) => (0, __shell_shock_core_plugin_utils_context_helpers.isVariableCommandPath)(segment) ? `[${(0, __stryke_string_format_constant_case.constantCase)((0, __shell_shock_core_plugin_utils_context_helpers.getVariableCommandPathName)(segment))}]` : segment).join(" ")}) virtual command.`;
28
+ },
29
+ get children() {
30
+ return [
31
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { get children() {
32
+ return `${command.description.replace(/\.+$/, "")}.`;
33
+ } }),
34
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
35
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocTitle, { get children() {
36
+ return command.title;
37
+ } }),
38
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
39
+ name: "args",
40
+ children: `The command-line arguments passed to the command.`
41
+ })
42
+ ];
43
+ }
44
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
45
+ "export": true,
46
+ async: true,
47
+ name: "handler",
48
+ parameters: [{
49
+ name: "args",
50
+ type: "string[]",
51
+ default: "getArgs()"
52
+ }],
53
+ get children() {
54
+ return [
55
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
56
+ get path() {
57
+ return command.path.segments;
58
+ },
59
+ get commands() {
60
+ return command.children;
61
+ }
62
+ }),
63
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
64
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
65
+ (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
66
+ writeLine("");
67
+ writeLine(colors.text.heading.primary("${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} - ${command.title}"));
68
+ writeLine("");
69
+ writeLine(colors.text.body.primary("${command.description.replace(/\.+$/, "")}."));
70
+ writeLine("");`),
71
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
72
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.Help, { command })
73
+ ];
74
+ }
75
+ })];
76
+ }
77
+ /**
78
+ * The virtual command entry point for the Shell Shock project.
79
+ */
80
+ function VirtualCommandEntry(props) {
81
+ const { command, imports, builtinImports, ...rest } = props;
82
+ const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
83
+ const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(context.entryPath, command.path.segments.filter((segment) => !(0, __shell_shock_core_plugin_utils_context_helpers.isVariableCommandPath)(segment)).join("/"), "index.ts"));
84
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
85
+ get path() {
86
+ return filePath.value;
87
+ },
88
+ get imports() {
89
+ return (0, defu.default)({ didyoumean2: [
90
+ {
91
+ name: "didYouMean",
92
+ default: true
93
+ },
94
+ { name: "ReturnTypeEnums" },
95
+ { name: "ThresholdTypeEnums" }
96
+ ] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
97
+ ret[`./${child.name}`] = [{
98
+ name: "handler",
99
+ alias: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(name)}`
100
+ }];
101
+ return ret;
102
+ }, {}));
103
+ },
104
+ get builtinImports() {
105
+ return (0, defu.default)(builtinImports ?? {}, {
106
+ console: [
107
+ "warn",
108
+ "error",
109
+ "table",
110
+ "colors",
111
+ "writeLine"
112
+ ],
113
+ utils: ["getArgs"]
114
+ });
115
+ },
116
+ get children() {
117
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(VirtualCommandHandlerDeclaration, { command });
118
+ }
119
+ })), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
120
+ get each() {
121
+ return Object.values(command.children);
122
+ },
123
+ children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
124
+ get when() {
125
+ return child.isVirtual;
126
+ },
127
+ get fallback() {
128
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
129
+ },
130
+ get children() {
131
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(VirtualCommandEntry, { command: child });
132
+ }
133
+ })
134
+ })];
135
+ }
136
+
137
+ //#endregion
138
+ exports.VirtualCommandEntry = VirtualCommandEntry;
139
+ exports.VirtualCommandHandlerDeclaration = VirtualCommandHandlerDeclaration;
140
+ //# sourceMappingURL=virtual-command-entry.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-command-entry.cjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getAppTitle","getVariableCommandPathName","isVariableCommandPath","joinPaths","constantCase","pascalCase","defu","CommandEntry","CommandRouter","Help","VirtualCommandHandlerDeclaration","props","command","context","_$createComponent","heading","title","path","segments","map","segment","join","children","description","replace","_$createIntrinsic","name","async","parameters","type","default","commands","_$memo","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","value","didyoumean2","Object","entries","child","isVirtual","reduce","ret","alias","console","utils","each","values","when","fallback"],"sources":["../../src/components/virtual-command-entry.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, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getAppTitle,\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { Help } from \"./help\";\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function VirtualCommandHandlerDeclaration(props: {\n command: CommandTree;\n}) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `[${constantCase(getVariableCommandPathName(segment))}]`\n : segment\n )\n .join(\" \")}) virtual command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandRouter\n path={command.path.segments}\n commands={command.children}\n />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${getAppTitle(context)} - ${\n command.title\n }\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${command.description.replace(/\\.+$/, \"\")}.\"));\n writeLine(\"\");`}\n <hbr />\n <Help command={command} />\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.path.segments\n .filter(segment => !isVariableCommandPath(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"warn\", \"error\", \"table\", \"colors\", \"writeLine\"],\n utils: [\"getArgs\"]\n })}>\n <VirtualCommandHandlerDeclaration command={command} />\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiDA,SAAgBsB,iCAAiCC,OAE9C;CACD,MAAM,EAAEC,YAAYD;CAEpB,MAAME,8EAA8C;AAEpD,QAAA,kDAEKnB,6DAAK;EAAA,IACJqB,UAAO;AAAA,UAAE,OAAOH,QAAQI,MAAK,mEAAeH,QAAQ,CAAA,GAAID,QAAQK,KAAKC,SAClEC,KAAIC,uFACmBA,QAAQ,GAC1B,2IAA4CA,QAAQ,CAAC,CAAA,KACrDA,QACL,CACAC,KAAK,IAAI,CAAA;;EAAoB,IAAAC,WAAA;AAAA,UAAA;qDAC/B1B,oEAAY,EAAA,IAAA0B,WAAA;AAAA,YAAE,GAAGV,QAAQW,YAAYC,QAAQ,QAAQ,GAAG,CAAA;OAAG,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAE3D3B,kEAAU,EAAA,IAAAyB,WAAA;AAAA,YAAEV,QAAQI;OAAK,CAAA;qDACzBrB,kEAAU;KAAC+B,MAAI;KAAAJ,UAAS;KAAmD,CAAA;IAAA;;EAAA,CAAA,mDAE7E9B,2CAAmB;EAAA,UAAA;EAElBmC,OAAK;EACLD,MAAI;EACJE,YAAY,CAAC;GAAEF,MAAM;GAAQG,MAAM;GAAYC,SAAS;GAAa,CAAC;EAAA,IAAAR,WAAA;AAAA,UA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KAAS;KAAS;KAAU;KAAY;IAC1DC,OAAO,CAAC,UAAS;IAClB,CAAC;;EAAA,IAAA7B,WAAA;AAAA,2DACDZ,kCAAgC,EAAUE,SAAO,CAAA;;EAAA,CAAA,CAAA,mDAEnDtB,qBAAG;EAAA,IAAC8D,OAAI;AAAA,UAAET,OAAOU,OAAOzC,QAAQU,SAAS;;EAAAA,WACvCuB,2DACEtD,sBAAI;GAAA,IACH+D,OAAI;AAAA,WAAET,MAAMC;;GAAS,IACrBS,WAAQ;AAAA,4DAAGhD,+CAAY,EAACK,SAASiC,OAAK,CAAA;;GAAA,IAAAvB,WAAA;AAAA,4DACrCW,qBAAmB,EAACrB,SAASiC,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
@@ -0,0 +1,21 @@
1
+ import * as _alloy_js_core18 from "@alloy-js/core";
2
+ import { CommandTree } from "@shell-shock/core/types/command";
3
+ import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
4
+
5
+ //#region src/components/virtual-command-entry.d.ts
6
+ /**
7
+ * A component that generates the `handler` function declaration for a command.
8
+ */
9
+ declare function VirtualCommandHandlerDeclaration(props: {
10
+ command: CommandTree;
11
+ }): _alloy_js_core18.Children;
12
+ interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
13
+ command: CommandTree;
14
+ }
15
+ /**
16
+ * The virtual command entry point for the Shell Shock project.
17
+ */
18
+ declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core18.Children;
19
+ //#endregion
20
+ export { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration };
21
+ //# sourceMappingURL=virtual-command-entry.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAiDgB,iBAAA,gCAAA,CACL,KAAA,EAAW;EA+CL,OAAA,EA/CN,WA+CM;CACf,CAAA,EAhDoB,gBAAA,CACrB,QA+CC;AAGS,UAJM,wBAAA,SAAiC,IAIvC,CAHT,cAGS,EAAA,MAAA,GAAA,gBAAA,CAAA,CAAA;EAJuC,OAAA,EAIvC,WAJuC;;AAUlD;;;iBAAgB,mBAAA,QAA2B,2BAAwB,gBAAA,CAAA"}
@@ -0,0 +1,21 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
+ import { CommandTree } from "@shell-shock/core/types/command";
4
+
5
+ //#region src/components/virtual-command-entry.d.ts
6
+ /**
7
+ * A component that generates the `handler` function declaration for a command.
8
+ */
9
+ declare function VirtualCommandHandlerDeclaration(props: {
10
+ command: CommandTree;
11
+ }): _alloy_js_core0.Children;
12
+ interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
13
+ command: CommandTree;
14
+ }
15
+ /**
16
+ * The virtual command entry point for the Shell Shock project.
17
+ */
18
+ declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
19
+ //#endregion
20
+ export { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration };
21
+ //# sourceMappingURL=virtual-command-entry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAiDgB,iBAAA,gCAAA,CACL,KAAA,EAAW;EA+CL,OAAA,EA/CN,WA+CM;CACf,CAAA,EAhDoB,eAAA,CACrB,QA+CC;AAGS,UAJM,wBAAA,SAAiC,IAIvC,CAHT,cAGS,EAAA,MAAA,GAAA,gBAAA,CAAA,CAAA;EAJuC,OAAA,EAIvC,WAJuC;;AAUlD;;;iBAAgB,mBAAA,QAA2B,2BAAwB,eAAA,CAAA"}
@@ -0,0 +1,137 @@
1
+ import { Help } from "./help.mjs";
2
+ import { CommandRouter } from "./command-router.mjs";
3
+ import { CommandEntry } from "./command-entry.mjs";
4
+ import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
5
+ import { For, Show, code, computed } from "@alloy-js/core";
6
+ import { FunctionDeclaration } from "@alloy-js/typescript";
7
+ import { getAppBin, getAppTitle, getVariableCommandPathName, isVariableCommandPath } from "@shell-shock/core/plugin-utils/context-helpers";
8
+ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
9
+ import { TSDoc, TSDocParam, TSDocRemarks, TSDocTitle } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
10
+ import { pascalCase } from "@stryke/string-format/pascal-case";
11
+ import defu from "defu";
12
+ import { joinPaths } from "@stryke/path/join";
13
+ import { constantCase } from "@stryke/string-format/constant-case";
14
+ import { TypescriptFile } from "@powerlines/plugin-alloy/typescript/components/typescript-file";
15
+
16
+ //#region src/components/virtual-command-entry.tsx
17
+ /**
18
+ * A component that generates the `handler` function declaration for a command.
19
+ */
20
+ function VirtualCommandHandlerDeclaration(props) {
21
+ const { command } = props;
22
+ const context = usePowerlines();
23
+ return [createComponent(TSDoc, {
24
+ get heading() {
25
+ return `The ${command.title} (${getAppBin(context)} ${command.path.segments.map((segment) => isVariableCommandPath(segment) ? `[${constantCase(getVariableCommandPathName(segment))}]` : segment).join(" ")}) virtual command.`;
26
+ },
27
+ get children() {
28
+ return [
29
+ createComponent(TSDocRemarks, { get children() {
30
+ return `${command.description.replace(/\.+$/, "")}.`;
31
+ } }),
32
+ createIntrinsic("hbr", {}),
33
+ createComponent(TSDocTitle, { get children() {
34
+ return command.title;
35
+ } }),
36
+ createComponent(TSDocParam, {
37
+ name: "args",
38
+ children: `The command-line arguments passed to the command.`
39
+ })
40
+ ];
41
+ }
42
+ }), createComponent(FunctionDeclaration, {
43
+ "export": true,
44
+ async: true,
45
+ name: "handler",
46
+ parameters: [{
47
+ name: "args",
48
+ type: "string[]",
49
+ default: "getArgs()"
50
+ }],
51
+ get children() {
52
+ return [
53
+ createComponent(CommandRouter, {
54
+ get path() {
55
+ return command.path.segments;
56
+ },
57
+ get commands() {
58
+ return command.children;
59
+ }
60
+ }),
61
+ createIntrinsic("hbr", {}),
62
+ createIntrinsic("hbr", {}),
63
+ memo(() => code`
64
+ writeLine("");
65
+ writeLine(colors.text.heading.primary("${getAppTitle(context)} - ${command.title}"));
66
+ writeLine("");
67
+ writeLine(colors.text.body.primary("${command.description.replace(/\.+$/, "")}."));
68
+ writeLine("");`),
69
+ createIntrinsic("hbr", {}),
70
+ createComponent(Help, { command })
71
+ ];
72
+ }
73
+ })];
74
+ }
75
+ /**
76
+ * The virtual command entry point for the Shell Shock project.
77
+ */
78
+ function VirtualCommandEntry(props) {
79
+ const { command, imports, builtinImports, ...rest } = props;
80
+ const context = usePowerlines();
81
+ const filePath = computed(() => joinPaths(context.entryPath, command.path.segments.filter((segment) => !isVariableCommandPath(segment)).join("/"), "index.ts"));
82
+ return [createComponent(TypescriptFile, mergeProps(rest, {
83
+ get path() {
84
+ return filePath.value;
85
+ },
86
+ get imports() {
87
+ return defu({ didyoumean2: [
88
+ {
89
+ name: "didYouMean",
90
+ default: true
91
+ },
92
+ { name: "ReturnTypeEnums" },
93
+ { name: "ThresholdTypeEnums" }
94
+ ] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
95
+ ret[`./${child.name}`] = [{
96
+ name: "handler",
97
+ alias: `handle${pascalCase(name)}`
98
+ }];
99
+ return ret;
100
+ }, {}));
101
+ },
102
+ get builtinImports() {
103
+ return defu(builtinImports ?? {}, {
104
+ console: [
105
+ "warn",
106
+ "error",
107
+ "table",
108
+ "colors",
109
+ "writeLine"
110
+ ],
111
+ utils: ["getArgs"]
112
+ });
113
+ },
114
+ get children() {
115
+ return createComponent(VirtualCommandHandlerDeclaration, { command });
116
+ }
117
+ })), createComponent(For, {
118
+ get each() {
119
+ return Object.values(command.children);
120
+ },
121
+ children: (child) => createComponent(Show, {
122
+ get when() {
123
+ return child.isVirtual;
124
+ },
125
+ get fallback() {
126
+ return createComponent(CommandEntry, { command: child });
127
+ },
128
+ get children() {
129
+ return createComponent(VirtualCommandEntry, { command: child });
130
+ }
131
+ })
132
+ })];
133
+ }
134
+
135
+ //#endregion
136
+ export { VirtualCommandEntry, VirtualCommandHandlerDeclaration };
137
+ //# sourceMappingURL=virtual-command-entry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-command-entry.mjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getAppTitle","getVariableCommandPathName","isVariableCommandPath","joinPaths","constantCase","pascalCase","defu","CommandEntry","CommandRouter","Help","VirtualCommandHandlerDeclaration","props","command","context","_$createComponent","heading","title","path","segments","map","segment","join","children","description","replace","_$createIntrinsic","name","async","parameters","type","default","commands","_$memo","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","value","didyoumean2","Object","entries","child","isVirtual","reduce","ret","alias","console","utils","each","values","when","fallback"],"sources":["../../src/components/virtual-command-entry.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, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getAppTitle,\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { Help } from \"./help\";\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function VirtualCommandHandlerDeclaration(props: {\n command: CommandTree;\n}) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `[${constantCase(getVariableCommandPathName(segment))}]`\n : segment\n )\n .join(\" \")}) virtual command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandRouter\n path={command.path.segments}\n commands={command.children}\n />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${getAppTitle(context)} - ${\n command.title\n }\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${command.description.replace(/\\.+$/, \"\")}.\"));\n writeLine(\"\");`}\n <hbr />\n <Help command={command} />\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.path.segments\n .filter(segment => !isVariableCommandPath(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"warn\", \"error\", \"table\", \"colors\", \"writeLine\"],\n utils: [\"getArgs\"]\n })}>\n <VirtualCommandHandlerDeclaration command={command} />\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiDA,SAAgBsB,iCAAiCC,OAE9C;CACD,MAAM,EAAEC,YAAYD;CAEpB,MAAME,UAAUpB,eAAoC;AAEpD,QAAA,CAAAqB,gBAEKpB,OAAK;EAAA,IACJqB,UAAO;AAAA,UAAE,OAAOH,QAAQI,MAAK,IAAKjB,UAAUc,QAAQ,CAAA,GAAID,QAAQK,KAAKC,SAClEC,KAAIC,YACHlB,sBAA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 +1,4 @@
1
+ const require_contexts_theme = require('./theme.cjs');
2
+
3
+ exports.useColors = require_contexts_theme.useColors;
4
+ exports.useTheme = require_contexts_theme.useTheme;
@@ -0,0 +1,2 @@
1
+ import { useColors, useTheme } from "./theme.cjs";
2
+ export { useColors, useTheme };
@@ -0,0 +1,2 @@
1
+ import { useColors, useTheme } from "./theme.mjs";
2
+ export { useColors, useTheme };
@@ -0,0 +1,3 @@
1
+ import { useColors, useTheme } from "./theme.mjs";
2
+
3
+ export { useColors, useTheme };
@@ -0,0 +1,20 @@
1
+ import { AnsiStyles } from "../helpers/ansi-utils.cjs";
2
+ import { ThemeResolvedConfig } from "@shell-shock/plugin-theme/types/theme";
3
+
4
+ //#region src/contexts/theme.d.ts
5
+
6
+ /**
7
+ * Hook to access the current application's theme configuration.
8
+ *
9
+ * @returns The resolved theme configuration.
10
+ */
11
+ declare function useTheme(): ThemeResolvedConfig;
12
+ /**
13
+ * Hook to access the current application's ANSI colors/styles.
14
+ *
15
+ * @returns The ANSI colors/styles.
16
+ */
17
+ declare function useColors(): AnsiStyles;
18
+ //#endregion
19
+ export { useColors, useTheme };
20
+ //# sourceMappingURL=theme.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.cts","names":[],"sources":["../../src/contexts/theme.ts"],"sourcesContent":[],"mappings":";;;;;;;AA8BA;AAYA;;iBAZgB,QAAA,CAAA,GAAY;;;;;;iBAYZ,SAAA,CAAA,GAAa"}
@@ -0,0 +1,20 @@
1
+ import { AnsiStyles } from "../helpers/ansi-utils.mjs";
2
+ import { ThemeResolvedConfig } from "@shell-shock/plugin-theme/types/theme";
3
+
4
+ //#region src/contexts/theme.d.ts
5
+
6
+ /**
7
+ * Hook to access the current application's theme configuration.
8
+ *
9
+ * @returns The resolved theme configuration.
10
+ */
11
+ declare function useTheme(): ThemeResolvedConfig;
12
+ /**
13
+ * Hook to access the current application's ANSI colors/styles.
14
+ *
15
+ * @returns The ANSI colors/styles.
16
+ */
17
+ declare function useColors(): AnsiStyles;
18
+ //#endregion
19
+ export { useColors, useTheme };
20
+ //# sourceMappingURL=theme.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.mts","names":[],"sources":["../../src/contexts/theme.ts"],"sourcesContent":[],"mappings":";;;;;;;AA8BA;AAYA;;iBAZgB,QAAA,CAAA,GAAY;;;;;;iBAYZ,SAAA,CAAA,GAAa"}
@@ -182,6 +182,10 @@ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
182
182
  open: wrapFn()(convertFn(theme.text.message.description.info)),
183
183
  close: wrapAnsi16()(39)
184
184
  },
185
+ debug: {
186
+ open: wrapFn()(convertFn(theme.text.message.description.debug)),
187
+ close: wrapAnsi16()(39)
188
+ },
185
189
  warning: {
186
190
  open: wrapFn()(convertFn(theme.text.message.description.warning)),
187
191
  close: wrapAnsi16()(39)
@@ -208,6 +212,10 @@ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
208
212
  open: wrapFn()(convertFn(theme.text.message.link.info)),
209
213
  close: wrapAnsi16()(39)
210
214
  },
215
+ debug: {
216
+ open: wrapFn()(convertFn(theme.text.message.link.debug)),
217
+ close: wrapAnsi16()(39)
218
+ },
211
219
  warning: {
212
220
  open: wrapFn()(convertFn(theme.text.message.link.warning)),
213
221
  close: wrapAnsi16()(39)
@@ -234,6 +242,10 @@ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
234
242
  open: wrapFn()(convertFn(theme.text.message.header.info)),
235
243
  close: wrapAnsi16()(39)
236
244
  },
245
+ debug: {
246
+ open: wrapFn()(convertFn(theme.text.message.header.debug)),
247
+ close: wrapAnsi16()(39)
248
+ },
237
249
  warning: {
238
250
  open: wrapFn()(convertFn(theme.text.message.header.warning)),
239
251
  close: wrapAnsi16()(39)
@@ -260,6 +272,10 @@ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
260
272
  open: wrapFn()(convertFn(theme.text.message.footer.info)),
261
273
  close: wrapAnsi16()(39)
262
274
  },
275
+ debug: {
276
+ open: wrapFn()(convertFn(theme.text.message.footer.debug)),
277
+ close: wrapAnsi16()(39)
278
+ },
263
279
  warning: {
264
280
  open: wrapFn()(convertFn(theme.text.message.footer.warning)),
265
281
  close: wrapAnsi16()(39)
@@ -347,17 +363,17 @@ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
347
363
  close: wrapAnsi16()(39)
348
364
  }
349
365
  },
350
- outline: {
366
+ table: {
351
367
  primary: {
352
- open: wrapFn()(convertFn(theme.border.app.outline.primary)),
368
+ open: wrapFn()(convertFn(theme.border.app.table.primary)),
353
369
  close: wrapAnsi16()(39)
354
370
  },
355
371
  secondary: {
356
- open: wrapFn()(convertFn(theme.border.app.outline.secondary)),
372
+ open: wrapFn()(convertFn(theme.border.app.table.secondary)),
357
373
  close: wrapAnsi16()(39)
358
374
  },
359
375
  tertiary: {
360
- open: wrapFn()(convertFn(theme.border.app.outline.tertiary)),
376
+ open: wrapFn()(convertFn(theme.border.app.table.tertiary)),
361
377
  close: wrapAnsi16()(39)
362
378
  }
363
379
  }
@@ -376,6 +392,10 @@ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
376
392
  open: wrapFn()(convertFn(theme.border.message.divider.info)),
377
393
  close: wrapAnsi16()(39)
378
394
  },
395
+ debug: {
396
+ open: wrapFn()(convertFn(theme.border.message.divider.debug)),
397
+ close: wrapAnsi16()(39)
398
+ },
379
399
  warning: {
380
400
  open: wrapFn()(convertFn(theme.border.message.divider.warning)),
381
401
  close: wrapAnsi16()(39)
@@ -402,6 +422,10 @@ function buildThemeAnsiStyles(theme, wrapFn, convertFn) {
402
422
  open: wrapFn()(convertFn(theme.border.message.outline.info)),
403
423
  close: wrapAnsi16()(39)
404
424
  },
425
+ debug: {
426
+ open: wrapFn()(convertFn(theme.border.message.outline.debug)),
427
+ close: wrapAnsi16()(39)
428
+ },
405
429
  warning: {
406
430
  open: wrapFn()(convertFn(theme.border.message.outline.warning)),
407
431
  close: wrapAnsi16()(39)