@shell-shock/preset-script 0.6.3 → 0.6.4

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 (80) hide show
  1. package/README.md +1 -1
  2. package/dist/components/banner-function-declaration.cjs +13 -7
  3. package/dist/components/banner-function-declaration.cjs.map +1 -1
  4. package/dist/components/banner-function-declaration.d.cts +2 -0
  5. package/dist/components/banner-function-declaration.d.cts.map +1 -1
  6. package/dist/components/banner-function-declaration.d.mts +2 -0
  7. package/dist/components/banner-function-declaration.d.mts.map +1 -1
  8. package/dist/components/banner-function-declaration.mjs +15 -9
  9. package/dist/components/banner-function-declaration.mjs.map +1 -1
  10. package/dist/components/bin-entry.cjs +4 -10
  11. package/dist/components/bin-entry.cjs.map +1 -1
  12. package/dist/components/bin-entry.d.cts.map +1 -1
  13. package/dist/components/bin-entry.d.mts.map +1 -1
  14. package/dist/components/bin-entry.mjs +4 -10
  15. package/dist/components/bin-entry.mjs.map +1 -1
  16. package/dist/components/command-entry.cjs +13 -12
  17. package/dist/components/command-entry.cjs.map +1 -1
  18. package/dist/components/command-entry.d.cts +1 -0
  19. package/dist/components/command-entry.d.cts.map +1 -1
  20. package/dist/components/command-entry.d.mts +1 -0
  21. package/dist/components/command-entry.d.mts.map +1 -1
  22. package/dist/components/command-entry.mjs +13 -12
  23. package/dist/components/command-entry.mjs.map +1 -1
  24. package/dist/components/command-router.cjs +2 -2
  25. package/dist/components/command-router.cjs.map +1 -1
  26. package/dist/components/command-router.d.cts.map +1 -1
  27. package/dist/components/command-router.d.mts.map +1 -1
  28. package/dist/components/command-router.mjs +2 -2
  29. package/dist/components/command-router.mjs.map +1 -1
  30. package/dist/components/console-builtin.cjs +773 -102
  31. package/dist/components/console-builtin.cjs.map +1 -1
  32. package/dist/components/console-builtin.d.cts +2 -2
  33. package/dist/components/console-builtin.d.cts.map +1 -1
  34. package/dist/components/console-builtin.d.mts +2 -2
  35. package/dist/components/console-builtin.d.mts.map +1 -1
  36. package/dist/components/console-builtin.mjs +774 -104
  37. package/dist/components/console-builtin.mjs.map +1 -1
  38. package/dist/components/help.cjs +6 -9
  39. package/dist/components/help.cjs.map +1 -1
  40. package/dist/components/help.d.cts +7 -7
  41. package/dist/components/help.d.cts.map +1 -1
  42. package/dist/components/help.d.mts +7 -7
  43. package/dist/components/help.d.mts.map +1 -1
  44. package/dist/components/help.mjs +6 -9
  45. package/dist/components/help.mjs.map +1 -1
  46. package/dist/components/helpers.d.cts +5 -5
  47. package/dist/components/index.cjs +1 -0
  48. package/dist/components/index.d.cts +2 -2
  49. package/dist/components/index.d.mts +2 -2
  50. package/dist/components/index.mjs +2 -2
  51. package/dist/components/utils-builtin.cjs +19 -36
  52. package/dist/components/utils-builtin.cjs.map +1 -1
  53. package/dist/components/utils-builtin.d.cts +8 -8
  54. package/dist/components/utils-builtin.d.cts.map +1 -1
  55. package/dist/components/utils-builtin.d.mts +8 -8
  56. package/dist/components/utils-builtin.d.mts.map +1 -1
  57. package/dist/components/utils-builtin.mjs +19 -36
  58. package/dist/components/utils-builtin.mjs.map +1 -1
  59. package/dist/components/virtual-command-entry.cjs +8 -3
  60. package/dist/components/virtual-command-entry.cjs.map +1 -1
  61. package/dist/components/virtual-command-entry.d.cts +1 -0
  62. package/dist/components/virtual-command-entry.d.cts.map +1 -1
  63. package/dist/components/virtual-command-entry.d.mts +1 -0
  64. package/dist/components/virtual-command-entry.d.mts.map +1 -1
  65. package/dist/components/virtual-command-entry.mjs +8 -3
  66. package/dist/components/virtual-command-entry.mjs.map +1 -1
  67. package/dist/helpers/ansi-utils.cjs +117 -3
  68. package/dist/helpers/ansi-utils.cjs.map +1 -1
  69. package/dist/helpers/ansi-utils.d.cts.map +1 -1
  70. package/dist/helpers/ansi-utils.d.mts.map +1 -1
  71. package/dist/helpers/ansi-utils.mjs +117 -3
  72. package/dist/helpers/ansi-utils.mjs.map +1 -1
  73. package/dist/index.cjs +1 -2
  74. package/dist/index.cjs.map +1 -1
  75. package/dist/index.d.cts.map +1 -1
  76. package/dist/index.d.mts.map +1 -1
  77. package/dist/index.mjs +1 -2
  78. package/dist/index.mjs.map +1 -1
  79. package/dist/types/plugin.d.cts.map +1 -1
  80. package/package.json +12 -12
@@ -3,6 +3,7 @@ const require_components_helpers = require('./helpers.cjs');
3
3
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
4
  let __alloy_js_core = require("@alloy-js/core");
5
5
  let __alloy_js_typescript = require("@alloy-js/typescript");
6
+ let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
6
7
  let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
7
8
  let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
8
9
  let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
@@ -23,8 +24,7 @@ function EnvSupportUtilities() {
23
24
  doc: "Detect if stdout.TTY is available",
24
25
  initializer: __alloy_js_core.code`Boolean(process.stdout && process.stdout.isTTY);`
25
26
  }),
26
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
27
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
27
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
28
28
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
29
29
  "export": true,
30
30
  "const": true,
@@ -32,8 +32,7 @@ function EnvSupportUtilities() {
32
32
  doc: "Detect if the current environment is minimal (CI, non-TTY, etc.)",
33
33
  initializer: __alloy_js_core.code` env.MINIMAL || isCI || isTest || !isTTY; `
34
34
  }),
35
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
36
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
35
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
37
36
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
38
37
  "export": true,
39
38
  "const": true,
@@ -60,8 +59,7 @@ function ColorSupportUtilities() {
60
59
  });
61
60
  }
62
61
  }),
63
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
64
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
62
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
65
63
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
66
64
  heading: "Checks if a specific flag is present in the command line arguments.",
67
65
  get children() {
@@ -201,8 +199,7 @@ function ColorSupportUtilities() {
201
199
 
202
200
  `
203
201
  }),
204
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
205
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
202
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
206
203
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
207
204
  "export": true,
208
205
  "const": true,
@@ -213,8 +210,7 @@ function ColorSupportUtilities() {
213
210
  stderr: getColorSupportLevel(process.stderr),
214
211
  }; `
215
212
  }),
216
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
217
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
213
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
218
214
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
219
215
  "export": true,
220
216
  "const": true,
@@ -222,8 +218,7 @@ function ColorSupportUtilities() {
222
218
  doc: "Detect if terminal color is supported in the current environment",
223
219
  initializer: __alloy_js_core.code` Boolean(colorSupportLevels.stdout); `
224
220
  }),
225
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
226
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
221
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
227
222
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
228
223
  "export": true,
229
224
  "const": true,
@@ -276,8 +271,7 @@ function HyperlinkSupportUtilities() {
276
271
  patch: versionParts[2]
277
272
  }; `
278
273
  }),
279
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
280
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
274
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
281
275
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
282
276
  heading: "Check if the current environment/terminal supports hyperlinks in the terminal.",
283
277
  get children() {
@@ -378,8 +372,7 @@ function ArgsUtilities() {
378
372
  returnType: "string[]",
379
373
  children: __alloy_js_core.code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`
380
374
  }),
381
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
382
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
375
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
383
376
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
384
377
  heading: "Checks if a specific flag is present in the command line arguments.",
385
378
  get children() {
@@ -424,8 +417,7 @@ function ArgsUtilities() {
424
417
  ];
425
418
  }
426
419
  }),
427
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
428
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
420
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
429
421
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
430
422
  "export": true,
431
423
  name: "isHelp",
@@ -483,8 +475,7 @@ function ExitFunctionDeclaration() {
483
475
  ];
484
476
  }
485
477
  }),
486
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
487
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
478
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
488
479
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
489
480
  "let": true,
490
481
  name: "isExiting",
@@ -503,8 +494,7 @@ function ExitFunctionDeclaration() {
503
494
  type: "Array<(code: number | string) => void>",
504
495
  initializer: __alloy_js_core.code`[];`
505
496
  }),
506
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
507
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
497
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
508
498
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
509
499
  "export": true,
510
500
  async: true,
@@ -700,26 +690,19 @@ function UtilsBuiltin(props) {
700
690
  },
701
691
  get children() {
702
692
  return [
703
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
704
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
693
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
705
694
  (0, __alloy_js_core_jsx_runtime.createComponent)(ContextUtilities, {}),
706
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
707
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
695
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
708
696
  (0, __alloy_js_core_jsx_runtime.createComponent)(ArgsUtilities, {}),
709
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
710
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
697
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
711
698
  (0, __alloy_js_core_jsx_runtime.createComponent)(EnvSupportUtilities, {}),
712
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
713
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
699
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
714
700
  (0, __alloy_js_core_jsx_runtime.createComponent)(HyperlinkSupportUtilities, {}),
715
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
716
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
701
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
717
702
  (0, __alloy_js_core_jsx_runtime.createComponent)(ColorSupportUtilities, {}),
718
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
719
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
703
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
720
704
  (0, __alloy_js_core_jsx_runtime.createComponent)(ExitFunctionDeclaration, {}),
721
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
722
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
705
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
723
706
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
724
707
  get when() {
725
708
  return Boolean(children);
@@ -1 +1 @@
1
- {"version":3,"file":"utils-builtin.cjs","names":["code","Show","splitProps","FunctionDeclaration","IfStatement","InterfaceDeclaration","InterfaceMember","VarDeclaration","usePowerlines","BuiltinFile","TSDoc","TSDocInternal","TSDocLink","TSDocParam","TSDocRemarks","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 TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\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 <TSDocRemarks>\n {\n \"This function is only intended for internal use. Please use `useArgs()` instead.\"\n }\n </TSDocRemarks>\n <hbr />\n <hbr />\n <TSDocInternal />\n <hbr />\n <hbr />\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\" returnType=\"string[]\">\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: \"useArgs()\"\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 <hbr />\n <hbr />\n <VarDeclaration\n export\n name=\"isHelp\"\n type=\"boolean\"\n initializer={code` !isCI && hasFlag([\"help\", \"h\", \"?\"]); `}\n />\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 ? Math.floor((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 global Shell Shock - Application context instance.\n *\n * @internal\n */\n export let internal_appContext = new AsyncLocalStorage<Map<string, any>>();\n\n /**\n * Get the Shell Shock - Application context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Application context for the current application or undefined if the context is not available.\n */\n export function useApp(): Map<string, any> | undefined {\n return internal_appContext.getStore();\n }\n\n /**\n * A utility hook function to get the command line arguments from the application context.\n *\n * @returns An array of command line arguments from the application context.\n * @throws If the application context is not available.\n */\n export function useArgs(): string[] {\n return useApp()?.get(\"args\") ?? getArgs();\n }\n\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n export 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_commandContext = 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_commandContext.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 <ContextUtilities />\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":";;;;;;;;;;;;;;;;AAmDA,SAAgBmB,sBAAsB;AACpC,QAAA;mDAEKZ,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbc,MAAI;GACJC,KAAG;GACHC,aAAavB,oBAAI;GAAkD,CAAA;mDAAA,OAAA,EAAA,CAAA;mDAAA,OAAA,EAAA,CAAA;mDAIpEO,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbc,MAAI;GACJC,KAAG;GACHC,aAAavB,oBAAI;GAA4C,CAAA;mDAAA,OAAA,EAAA,C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EhB,YAAYiB,wCAAmBD,OAAO,CAAC,WAAW,CAAC;AAE5D,yDACGjC,sHAAW;EACVoC,IAAE;EACFC,aAAW;EAAA,EACPH,MAAI;EAAA,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;qDAGDc,kBAAgB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGhBP,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;qDAGrBS,yBAAuB,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGvBjC,sBAAI;KAAA,IAACkD,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","Spacing","usePowerlines","BuiltinFile","TSDoc","TSDocInternal","TSDocLink","TSDocParam","TSDocRemarks","TSDocReturns","getAppTitle","defu","IsVerbose","EnvSupportUtilities","_$createComponent","name","doc","initializer","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","_$createIntrinsic","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 { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\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 TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\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\n extends Omit<BuiltinFileProps, \"id\" | \"description\"> {}\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 <Spacing />\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 <Spacing />\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 <Spacing />\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 <Spacing />\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 <Spacing />\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 <Spacing />\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 <Spacing />\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 <TSDocRemarks>\n {\n \"This function is only intended for internal use. Please use `useArgs()` instead.\"\n }\n </TSDocRemarks>\n <hbr />\n <hbr />\n <TSDocInternal />\n <hbr />\n <hbr />\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\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <Spacing />\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: \"useArgs()\"\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 <Spacing />\n <VarDeclaration\n export\n name=\"isHelp\"\n type=\"boolean\"\n initializer={code` !isCI && hasFlag([\"help\", \"h\", \"?\"]); `}\n />\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 <Spacing />\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 <Spacing />\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 ? Math.floor((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 global Shell Shock - Application context instance.\n *\n * @internal\n */\n export let internal_appContext = new AsyncLocalStorage<Map<string, any>>();\n\n /**\n * Get the Shell Shock - Application context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Application context for the current application or undefined if the context is not available.\n */\n export function useApp(): Map<string, any> | undefined {\n return internal_appContext.getStore();\n }\n\n /**\n * A utility hook function to get the command line arguments from the application context.\n *\n * @returns An array of command line arguments from the application context.\n * @throws If the application context is not available.\n */\n export function useArgs(): string[] {\n return useApp()?.get(\"args\") ?? getArgs();\n }\n\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n export 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_commandContext = 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_commandContext.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 <Spacing />\n <ContextUtilities />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <ExitFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkDA,SAAgBoB,sBAAsB;AACpC,QAAA;mDAEKb,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbe,MAAI;GACJC,KAAG;GACHC,aAAaxB,oBAAI;GAAkD,CAAA;mDAEpEQ,2DAAO,EAAA,CAAA;mDACPD,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbe,MAAI;GACJC,KAAG;GACHC,aAAaxB,oBAAI;GAA4C,CAAA;mDAE9DQ,2DAAO,EAAA,CAAA;mDACPD,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbe,MAAI;GACJC,KAAG;GACHC,aAAaxB,oBAAI;GAAgI,CAAA;EAAA;;;;;AASzJ,SAAgByB,wBAAwB;AACtC,QAAA;mDAEKpB,4CAAoB;GAAA,UAAA;GAEnBiB,MAAI;GACJC,KAAG;GAAA,IAAAG,WAAA;AAAA,4DACFpB,uCAAe;KACdgB,MAAI;KACJK,MAAI;KACJJ,KAAG;KAAA,CAAA;;GAAA,CAAA;mDAGNf,2DAAO,EAAA,CAAA;mDACPG,6DAAK;GAACiB,SAAO;GAAA,IA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qDACPY,qBAAmB,EAAA,CAAA;qDACnBZ,2DAAO,EAAA,CAAA;qDACPuB,2BAAyB,EAAA,CAAA;qDACzBvB,2DAAO,EAAA,CAAA;qDACPiB,uBAAqB,EAAA,CAAA;qDACrBjB,2DAAO,EAAA,CAAA;qDACP2B,yBAAuB,EAAA,CAAA;qDACvB3B,2DAAO,EAAA,CAAA;qDACPP,sBAAI;KAAA,IAACmD,OAAI;AAAA,aAAEC,QAAQ3B,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core9 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
3
 
4
4
  //#region src/components/utils-builtin.d.ts
@@ -6,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(): _alloy_js_core9.Children;
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(): _alloy_js_core9.Children;
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(): _alloy_js_core9.Children;
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(): _alloy_js_core9.Children;
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(): _alloy_js_core9.Children;
26
- declare function ContextUtilities(): _alloy_js_core9.Children;
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): _alloy_js_core9.Children;
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.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA0CiB,iBAAA,SAA0B,KACzC;;AADF;AASA;AAmCgB,iBAnCA,mBAAA,CAAA,CAmCqB,EAnCF,eAAA,CAAA,QAmCE;AA0MrC;AA2GA;AAiFA;AAkJgB,iBAxhBA,qBAAA,CAAA,CAwhBgB,EAxhBK,eAAA,CAAA,QAwhBL;AAsFhC;;;iBApagB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA2GzB,aAAA,CAAA,GAAa,eAAA,CAAA;;;;iBAiFb,uBAAA,CAAA,GAAuB,eAAA,CAAA;iBAkJvB,gBAAA,CAAA,GAAgB,eAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
1
+ {"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA2CiB,iBAAA,SACP,KAAK;;AADf;AAOA;AAiCgB,iBAjCA,mBAAA,CAAA,CAiCqB,EAjCF,eAAA,CAAA,QAiCE;AAsMrC;AA0GA;AA+EA;AAgJgB,iBA/gBA,qBAAA,CAAA,CA+gBgB,EA/gBK,eAAA,CAAA,QA+gBL;AAsFhC;;;iBA/ZgB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA0GzB,aAAA,CAAA,GAAa,eAAA,CAAA;;;;iBA+Eb,uBAAA,CAAA,GAAuB,eAAA,CAAA;iBAgJvB,gBAAA,CAAA,GAAgB,eAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core9 from "@alloy-js/core";
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(): _alloy_js_core9.Children;
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(): _alloy_js_core9.Children;
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(): _alloy_js_core9.Children;
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(): _alloy_js_core9.Children;
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(): _alloy_js_core9.Children;
26
- declare function ContextUtilities(): _alloy_js_core9.Children;
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): _alloy_js_core9.Children;
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.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA0CiB,iBAAA,SAA0B,KACzC;;AADF;AASA;AAmCgB,iBAnCA,mBAAA,CAAA,CAmCqB,EAnCF,eAAA,CAAA,QAmCE;AA0MrC;AA2GA;AAiFA;AAkJgB,iBAxhBA,qBAAA,CAAA,CAwhBgB,EAxhBK,eAAA,CAAA,QAwhBL;AAsFhC;;;iBApagB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA2GzB,aAAA,CAAA,GAAa,eAAA,CAAA;;;;iBAiFb,uBAAA,CAAA,GAAuB,eAAA,CAAA;iBAkJvB,gBAAA,CAAA,GAAgB,eAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
1
+ {"version":3,"file":"utils-builtin.d.mts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UA2CiB,iBAAA,SACP,KAAK;;AADf;AAOA;AAiCgB,iBAjCA,mBAAA,CAAA,CAiCqB,EAjCF,eAAA,CAAA,QAiCE;AAsMrC;AA0GA;AA+EA;AAgJgB,iBA/gBA,qBAAA,CAAA,CA+gBgB,EA/gBK,eAAA,CAAA,QA+gBL;AAsFhC;;;iBA/ZgB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA0GzB,aAAA,CAAA,GAAa,eAAA,CAAA;;;;iBA+Eb,uBAAA,CAAA,GAAuB,eAAA,CAAA;iBAgJvB,gBAAA,CAAA,GAAgB,eAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
@@ -2,6 +2,7 @@ import { IsVerbose } from "./helpers.mjs";
2
2
  import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
3
3
  import { Show, code, splitProps } from "@alloy-js/core";
4
4
  import { FunctionDeclaration, IfStatement, InterfaceDeclaration, InterfaceMember, VarDeclaration } from "@alloy-js/typescript";
5
+ import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
5
6
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
7
  import { getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
7
8
  import { TSDoc, TSDocInternal, TSDocLink, TSDocParam, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
@@ -21,8 +22,7 @@ function EnvSupportUtilities() {
21
22
  doc: "Detect if stdout.TTY is available",
22
23
  initializer: code`Boolean(process.stdout && process.stdout.isTTY);`
23
24
  }),
24
- createIntrinsic("hbr", {}),
25
- createIntrinsic("hbr", {}),
25
+ createComponent(Spacing, {}),
26
26
  createComponent(VarDeclaration, {
27
27
  "export": true,
28
28
  "const": true,
@@ -30,8 +30,7 @@ function EnvSupportUtilities() {
30
30
  doc: "Detect if the current environment is minimal (CI, non-TTY, etc.)",
31
31
  initializer: code` env.MINIMAL || isCI || isTest || !isTTY; `
32
32
  }),
33
- createIntrinsic("hbr", {}),
34
- createIntrinsic("hbr", {}),
33
+ createComponent(Spacing, {}),
35
34
  createComponent(VarDeclaration, {
36
35
  "export": true,
37
36
  "const": true,
@@ -58,8 +57,7 @@ function ColorSupportUtilities() {
58
57
  });
59
58
  }
60
59
  }),
61
- createIntrinsic("hbr", {}),
62
- createIntrinsic("hbr", {}),
60
+ createComponent(Spacing, {}),
63
61
  createComponent(TSDoc, {
64
62
  heading: "Checks if a specific flag is present in the command line arguments.",
65
63
  get children() {
@@ -199,8 +197,7 @@ function ColorSupportUtilities() {
199
197
 
200
198
  `
201
199
  }),
202
- createIntrinsic("hbr", {}),
203
- createIntrinsic("hbr", {}),
200
+ createComponent(Spacing, {}),
204
201
  createComponent(VarDeclaration, {
205
202
  "export": true,
206
203
  "const": true,
@@ -211,8 +208,7 @@ function ColorSupportUtilities() {
211
208
  stderr: getColorSupportLevel(process.stderr),
212
209
  }; `
213
210
  }),
214
- createIntrinsic("hbr", {}),
215
- createIntrinsic("hbr", {}),
211
+ createComponent(Spacing, {}),
216
212
  createComponent(VarDeclaration, {
217
213
  "export": true,
218
214
  "const": true,
@@ -220,8 +216,7 @@ function ColorSupportUtilities() {
220
216
  doc: "Detect if terminal color is supported in the current environment",
221
217
  initializer: code` Boolean(colorSupportLevels.stdout); `
222
218
  }),
223
- createIntrinsic("hbr", {}),
224
- createIntrinsic("hbr", {}),
219
+ createComponent(Spacing, {}),
225
220
  createComponent(VarDeclaration, {
226
221
  "export": true,
227
222
  "const": true,
@@ -274,8 +269,7 @@ function HyperlinkSupportUtilities() {
274
269
  patch: versionParts[2]
275
270
  }; `
276
271
  }),
277
- createIntrinsic("hbr", {}),
278
- createIntrinsic("hbr", {}),
272
+ createComponent(Spacing, {}),
279
273
  createComponent(TSDoc, {
280
274
  heading: "Check if the current environment/terminal supports hyperlinks in the terminal.",
281
275
  get children() {
@@ -376,8 +370,7 @@ function ArgsUtilities() {
376
370
  returnType: "string[]",
377
371
  children: code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`
378
372
  }),
379
- createIntrinsic("hbr", {}),
380
- createIntrinsic("hbr", {}),
373
+ createComponent(Spacing, {}),
381
374
  createComponent(TSDoc, {
382
375
  heading: "Checks if a specific flag is present in the command line arguments.",
383
376
  get children() {
@@ -422,8 +415,7 @@ function ArgsUtilities() {
422
415
  ];
423
416
  }
424
417
  }),
425
- createIntrinsic("hbr", {}),
426
- createIntrinsic("hbr", {}),
418
+ createComponent(Spacing, {}),
427
419
  createComponent(VarDeclaration, {
428
420
  "export": true,
429
421
  name: "isHelp",
@@ -481,8 +473,7 @@ function ExitFunctionDeclaration() {
481
473
  ];
482
474
  }
483
475
  }),
484
- createIntrinsic("hbr", {}),
485
- createIntrinsic("hbr", {}),
476
+ createComponent(Spacing, {}),
486
477
  createComponent(VarDeclaration, {
487
478
  "let": true,
488
479
  name: "isExiting",
@@ -501,8 +492,7 @@ function ExitFunctionDeclaration() {
501
492
  type: "Array<(code: number | string) => void>",
502
493
  initializer: code`[];`
503
494
  }),
504
- createIntrinsic("hbr", {}),
505
- createIntrinsic("hbr", {}),
495
+ createComponent(Spacing, {}),
506
496
  createComponent(FunctionDeclaration, {
507
497
  "export": true,
508
498
  async: true,
@@ -698,26 +688,19 @@ function UtilsBuiltin(props) {
698
688
  },
699
689
  get children() {
700
690
  return [
701
- createIntrinsic("hbr", {}),
702
- createIntrinsic("hbr", {}),
691
+ createComponent(Spacing, {}),
703
692
  createComponent(ContextUtilities, {}),
704
- createIntrinsic("hbr", {}),
705
- createIntrinsic("hbr", {}),
693
+ createComponent(Spacing, {}),
706
694
  createComponent(ArgsUtilities, {}),
707
- createIntrinsic("hbr", {}),
708
- createIntrinsic("hbr", {}),
695
+ createComponent(Spacing, {}),
709
696
  createComponent(EnvSupportUtilities, {}),
710
- createIntrinsic("hbr", {}),
711
- createIntrinsic("hbr", {}),
697
+ createComponent(Spacing, {}),
712
698
  createComponent(HyperlinkSupportUtilities, {}),
713
- createIntrinsic("hbr", {}),
714
- createIntrinsic("hbr", {}),
699
+ createComponent(Spacing, {}),
715
700
  createComponent(ColorSupportUtilities, {}),
716
- createIntrinsic("hbr", {}),
717
- createIntrinsic("hbr", {}),
701
+ createComponent(Spacing, {}),
718
702
  createComponent(ExitFunctionDeclaration, {}),
719
- createIntrinsic("hbr", {}),
720
- createIntrinsic("hbr", {}),
703
+ createComponent(Spacing, {}),
721
704
  createComponent(Show, {
722
705
  get when() {
723
706
  return Boolean(children);