@shell-shock/core 0.17.6 → 0.17.8

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 (146) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -29
  3. package/dist/api.cjs +1 -95
  4. package/dist/api.d.cts +52 -4
  5. package/dist/api.d.cts.map +1 -1
  6. package/dist/api.d.mts +52 -4
  7. package/dist/api.d.mts.map +1 -1
  8. package/dist/api.mjs +1 -92
  9. package/dist/api.mjs.map +1 -1
  10. package/dist/components/command-validation-logic.cjs +1 -292
  11. package/dist/components/command-validation-logic.mjs +1 -289
  12. package/dist/components/command-validation-logic.mjs.map +1 -1
  13. package/dist/components/docs.cjs +1 -265
  14. package/dist/components/docs.d.cts.map +1 -1
  15. package/dist/components/docs.d.mts.map +1 -1
  16. package/dist/components/docs.mjs +1 -256
  17. package/dist/components/docs.mjs.map +1 -1
  18. package/dist/components/exec-builtin.cjs +13 -429
  19. package/dist/components/exec-builtin.mjs +13 -425
  20. package/dist/components/exec-builtin.mjs.map +1 -1
  21. package/dist/components/helpers.cjs +1 -120
  22. package/dist/components/helpers.mjs +1 -112
  23. package/dist/components/helpers.mjs.map +1 -1
  24. package/dist/components/index.cjs +1 -58
  25. package/dist/components/index.mjs +1 -10
  26. package/dist/components/options-parser-logic.cjs +5 -960
  27. package/dist/components/options-parser-logic.d.cts +1 -1
  28. package/dist/components/options-parser-logic.mjs +5 -945
  29. package/dist/components/options-parser-logic.mjs.map +1 -1
  30. package/dist/components/state-builtin.cjs +8 -629
  31. package/dist/components/state-builtin.d.cts.map +1 -1
  32. package/dist/components/state-builtin.d.mts.map +1 -1
  33. package/dist/components/state-builtin.mjs +8 -622
  34. package/dist/components/state-builtin.mjs.map +1 -1
  35. package/dist/components/usage.cjs +1 -117
  36. package/dist/components/usage.mjs +1 -114
  37. package/dist/components/usage.mjs.map +1 -1
  38. package/dist/components/utils-builtin.cjs +33 -838
  39. package/dist/components/utils-builtin.d.cts.map +1 -1
  40. package/dist/components/utils-builtin.d.mts.map +1 -1
  41. package/dist/components/utils-builtin.mjs +33 -828
  42. package/dist/components/utils-builtin.mjs.map +1 -1
  43. package/dist/config.cjs +1 -31
  44. package/dist/config.mjs +1 -29
  45. package/dist/config.mjs.map +1 -1
  46. package/dist/contexts/command.cjs +1 -26
  47. package/dist/contexts/command.mjs +1 -23
  48. package/dist/contexts/command.mjs.map +1 -1
  49. package/dist/contexts/index.cjs +1 -9
  50. package/dist/contexts/index.mjs +1 -4
  51. package/dist/contexts/options.cjs +1 -63
  52. package/dist/contexts/options.mjs +1 -58
  53. package/dist/contexts/options.mjs.map +1 -1
  54. package/dist/helpers/automd.cjs +1 -71
  55. package/dist/helpers/automd.mjs +1 -70
  56. package/dist/helpers/automd.mjs.map +1 -1
  57. package/dist/helpers/docs-helpers.cjs +1 -23
  58. package/dist/helpers/docs-helpers.mjs +1 -22
  59. package/dist/helpers/docs-helpers.mjs.map +1 -1
  60. package/dist/helpers/paths.cjs +1 -137
  61. package/dist/helpers/paths.mjs +1 -133
  62. package/dist/helpers/paths.mjs.map +1 -1
  63. package/dist/helpers/persistence.cjs +1 -113
  64. package/dist/helpers/persistence.mjs +1 -110
  65. package/dist/helpers/persistence.mjs.map +1 -1
  66. package/dist/helpers/update-package-json.cjs +1 -59
  67. package/dist/helpers/update-package-json.mjs +1 -57
  68. package/dist/helpers/update-package-json.mjs.map +1 -1
  69. package/dist/helpers/utilities.cjs +1 -95
  70. package/dist/helpers/utilities.mjs +1 -93
  71. package/dist/helpers/utilities.mjs.map +1 -1
  72. package/dist/helpers/validations.cjs +1 -71
  73. package/dist/helpers/validations.mjs +1 -71
  74. package/dist/helpers/validations.mjs.map +1 -1
  75. package/dist/index.cjs +1 -52
  76. package/dist/index.d.cts +1 -1
  77. package/dist/index.d.mts +1 -1
  78. package/dist/index.mjs +1 -7
  79. package/dist/plugin-utils/compute-bin.cjs +1 -50
  80. package/dist/plugin-utils/compute-bin.mjs +1 -49
  81. package/dist/plugin-utils/compute-bin.mjs.map +1 -1
  82. package/dist/plugin-utils/context-helpers.cjs +1 -231
  83. package/dist/plugin-utils/context-helpers.mjs +1 -221
  84. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  85. package/dist/plugin-utils/deepkit.cjs +1 -71
  86. package/dist/plugin-utils/deepkit.mjs +1 -69
  87. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  88. package/dist/plugin-utils/description-helpers.cjs +2 -111
  89. package/dist/plugin-utils/description-helpers.mjs +2 -107
  90. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  91. package/dist/plugin-utils/get-command-tree.cjs +1 -117
  92. package/dist/plugin-utils/get-command-tree.mjs +1 -114
  93. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  94. package/dist/plugin-utils/index.cjs +1 -39
  95. package/dist/plugin-utils/index.mjs +1 -10
  96. package/dist/plugin-utils/reflect.cjs +1 -52
  97. package/dist/plugin-utils/reflect.mjs +1 -52
  98. package/dist/plugin-utils/reflect.mjs.map +1 -1
  99. package/dist/plugin-utils/traverse-command-tree.cjs +1 -64
  100. package/dist/plugin-utils/traverse-command-tree.mjs +1 -62
  101. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  102. package/dist/plugin-utils/type-checks.cjs +1 -93
  103. package/dist/plugin-utils/type-checks.mjs +1 -88
  104. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  105. package/dist/plugin.cjs +4 -429
  106. package/dist/plugin.d.cts.map +1 -1
  107. package/dist/plugin.d.mts.map +1 -1
  108. package/dist/plugin.mjs +4 -423
  109. package/dist/plugin.mjs.map +1 -1
  110. package/dist/resolver/deepkit.cjs +1 -135
  111. package/dist/resolver/deepkit.mjs +1 -134
  112. package/dist/resolver/deepkit.mjs.map +1 -1
  113. package/dist/resolver/helpers.cjs +1 -173
  114. package/dist/resolver/helpers.mjs +1 -168
  115. package/dist/resolver/helpers.mjs.map +1 -1
  116. package/dist/resolver/module.cjs +1 -145
  117. package/dist/resolver/module.mjs +1 -144
  118. package/dist/resolver/module.mjs.map +1 -1
  119. package/dist/resolver/resolve.cjs +1 -222
  120. package/dist/resolver/resolve.mjs +1 -221
  121. package/dist/resolver/resolve.mjs.map +1 -1
  122. package/dist/types/command.cjs +1 -441
  123. package/dist/types/command.mjs +1 -405
  124. package/dist/types/command.mjs.map +1 -1
  125. package/dist/types/config.cjs +1 -144
  126. package/dist/types/config.d.cts +3 -2
  127. package/dist/types/config.d.cts.map +1 -1
  128. package/dist/types/config.d.mts +3 -2
  129. package/dist/types/config.d.mts.map +1 -1
  130. package/dist/types/config.mjs +1 -138
  131. package/dist/types/config.mjs.map +1 -1
  132. package/dist/types/context.cjs +1 -37
  133. package/dist/types/context.d.cts +3 -2
  134. package/dist/types/context.d.cts.map +1 -1
  135. package/dist/types/context.d.mts +3 -2
  136. package/dist/types/context.d.mts.map +1 -1
  137. package/dist/types/context.mjs +1 -34
  138. package/dist/types/context.mjs.map +1 -1
  139. package/dist/types/env.cjs +1 -52
  140. package/dist/types/env.mjs +1 -50
  141. package/dist/types/env.mjs.map +1 -1
  142. package/dist/types/index.cjs +1 -49
  143. package/dist/types/index.mjs +1 -6
  144. package/dist/types/options.cjs +1 -12
  145. package/dist/types/options.mjs +1 -10
  146. package/package.json +23 -23
@@ -1 +1 @@
1
- {"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.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, For, memo, Show } from \"@alloy-js/core\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { MarkdownFileProps } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownFile } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { defu } from \"defu\";\nimport { CommandContext } from \"../contexts/command\";\nimport { getDocsOutputPath } from \"../helpers/docs-helpers\";\nimport { getAppBin } from \"../plugin-utils/context-helpers\";\nimport { sortOptions } from \"../plugin-utils/reflect\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { Usage } from \"./usage\";\n\nexport interface CommandOptionsDocsProps {\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the options markdown documentation for a command.\n */\nexport function CommandOptionsDocs(props: CommandOptionsDocsProps) {\n const { command } = props;\n if (Object.keys(command.options).length === 0) {\n return code`This command does not have any options.`;\n }\n\n return (\n <MarkdownTable\n data={sortOptions(Object.values(command.options)).map(option => {\n return {\n name: option.name.trim(),\n description: option.description.trim(),\n defaultValue: option.default\n ? String(option.default)?.includes('\"')\n ? option.default\n : `\\`${option.default}\\``\n : \"\",\n required: option.optional || option.default ? \"\" : \"✔\"\n };\n })}\n />\n );\n}\n\nexport interface CommandDocsUsageExampleProps {\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n *\n * @defaultValue \"npm\"\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The command to generate the usage example for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocsUsageExample(props: CommandDocsUsageExampleProps) {\n const { packageManager = \"npm\", command } = props;\n\n const context = usePowerlines<Context>();\n\n return (\n <>\n <hbr />\n {code`\\`\\`\\`bash `}\n <hbr />\n <Usage\n command={command}\n bin={getAppBin(context)}\n packageManager={packageManager}\n />\n <hbr />\n {code`\\`\\`\\``}\n <hbr />\n </>\n );\n}\n\nexport interface CommandDocsProps {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n\n /**\n * Optional usage examples to include in the documentation.\n *\n * @defaultValue `[\"npm\"]`\n */\n usageExamples?: Required<CommandDocsUsageExampleProps>[\"packageManager\"][];\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocs(props: CommandDocsProps) {\n const { levelOffset = 0, command, usageExamples } = props;\n\n return (\n <>\n <Heading level={1 + levelOffset}>{command.title}</Heading>\n <Spacing />\n {code`${command.description}`}\n <Spacing />\n <Heading level={2 + levelOffset}>Usage</Heading>\n <Spacing />\n {code`The ${command.name} command can be executed using the following syntax: `}\n <Spacing />\n <Show\n when={usageExamples && usageExamples.length > 0}\n fallback={\n <CommandDocsUsageExample packageManager=\"npm\" command={command} />\n }>\n <For each={usageExamples!} hardline>\n {packageManager => (\n <CommandDocsUsageExample\n packageManager={packageManager}\n command={command}\n />\n )}\n </For>\n </Show>\n <Spacing />\n <Heading level={2 + levelOffset}>Options</Heading>\n <Spacing />\n {code`The following options are available for the ${\n command.name\n } command:`}\n <Spacing />\n <CommandOptionsDocs command={command} />\n <Spacing />\n </>\n );\n}\n\nexport interface CommandDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation file for a command.\n */\nexport function CommandDocsFile(props: CommandDocsFileProps) {\n const { levelOffset = 0, command, frontMatter, ...rest } = props;\n\n const context = usePowerlines<Context>();\n const usageExamples = memo(\n () => [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as CommandDocsProps[\"usageExamples\"]\n );\n\n return (\n <CommandContext.Provider value={command}>\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), `${command.path}.md`)}\n {...rest}\n frontMatter={defu(frontMatter ?? {}, {\n id: command.id,\n name: command.name,\n path: command.path,\n reference: command.reference,\n isVirtual: command.isVirtual,\n title: command.title,\n description: command.description,\n tags: command.tags\n })}>\n <CommandDocs\n levelOffset={levelOffset}\n command={command}\n usageExamples={usageExamples()}\n />\n </MarkdownFile>\n </CommandContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,aAAa;CAAC;CAAK;CAAW;CAAO;;AAE1C,IAAI,SAAS;AACb,QAAG;;AAgCJ,MAAK,6BAAwB;CAAO;CAAe;CAAG;CAAA;CAAA;CAAA;;;;AAKtD,SAAE,mBAAA,OAAA;CACA,MAAC,EACD,YACI;AACJ,KAAA,OAAQ,KAAQ,QAAI,QAAK,CAAA,WAAA,EACvB,QAAE,IAAO;AAEX,QAAA,gBAAA,eAAA;AAEA,SAAO,YAAA,OAAA,OAAA,QAAA,QAAA,CAAA,CAAA,IAAA,cAAA,WAAA;AACJ,UAAA;IACK,MAAE,OAAW,KAAC,MAAO;IACvB,aAAO,OAAA,YAAA,MAAA;IACL,cAAa,OAAK,UAAM,OAAA,OAAA,QAAA,EAAA,SAAA,KAAA,GAAA,OAAA,UAAA,KAAA,OAAA,QAAA,MAAA;IACxB,UAAA,OAAa,YAAO,OAAgB,UAAE,KAAA;IACvC;KACA;GAAC;GAAU;GAAC;GAAO,CAAO,CAAC;IAEjC,CAAC;;AAEJ,mBAAmB,SAAQ;OAAQ;CAA4B;CAAA;CAAA;CAAA;CAAA;AAC/D,MAAM,kCAAG;CAAA;CAAA;CAAA;CAAA;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I,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.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, For, memo, Show } from \"@alloy-js/core\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { MarkdownFileProps } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownFile } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { defu } from \"defu\";\nimport { CommandContext } from \"../contexts/command\";\nimport { getDocsOutputPath } from \"../helpers/docs-helpers\";\nimport { getAppBin } from \"../plugin-utils/context-helpers\";\nimport { sortOptions } from \"../plugin-utils/reflect\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { Usage } from \"./usage\";\n\nexport interface CommandOptionsDocsProps {\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the options markdown documentation for a command.\n */\nexport function CommandOptionsDocs(props: CommandOptionsDocsProps) {\n const { command } = props;\n if (Object.keys(command.options).length === 0) {\n return code`This command does not have any options.`;\n }\n\n return (\n <MarkdownTable\n data={sortOptions(Object.values(command.options)).map(option => {\n return {\n name: option.name.trim(),\n description: option.description.trim(),\n defaultValue: option.default\n ? String(option.default)?.includes('\"')\n ? option.default\n : `\\`${\n Array.isArray(option.default)\n ? option.default.join(\", \")\n : option.default\n }\\``\n : \"\",\n required: option.optional || option.default ? \"\" : \"✔\"\n };\n })}\n />\n );\n}\n\nexport interface CommandDocsUsageExampleProps {\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n *\n * @defaultValue \"npm\"\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The command to generate the usage example for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocsUsageExample(props: CommandDocsUsageExampleProps) {\n const { packageManager = \"npm\", command } = props;\n\n const context = usePowerlines<Context>();\n\n return (\n <>\n <hbr />\n {code`\\`\\`\\`bash `}\n <hbr />\n <Usage\n command={command}\n bin={getAppBin(context)}\n packageManager={packageManager}\n />\n <hbr />\n {code`\\`\\`\\``}\n <hbr />\n </>\n );\n}\n\nexport interface CommandDocsProps {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n\n /**\n * Optional usage examples to include in the documentation.\n *\n * @defaultValue `[\"npm\"]`\n */\n usageExamples?: Required<CommandDocsUsageExampleProps>[\"packageManager\"][];\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocs(props: CommandDocsProps) {\n const { levelOffset = 0, command, usageExamples } = props;\n\n return (\n <>\n <Heading level={1 + levelOffset}>{command.title}</Heading>\n <Spacing />\n {code`${command.description}`}\n <Spacing />\n <Heading level={2 + levelOffset}>Usage</Heading>\n <Spacing />\n {code`The ${command.name} command can be executed using the following syntax: `}\n <Spacing />\n <Show\n when={usageExamples && usageExamples.length > 0}\n fallback={\n <CommandDocsUsageExample packageManager=\"npm\" command={command} />\n }>\n <For each={usageExamples!} hardline>\n {packageManager => (\n <CommandDocsUsageExample\n packageManager={packageManager}\n command={command}\n />\n )}\n </For>\n </Show>\n <Spacing />\n <Heading level={2 + levelOffset}>Options</Heading>\n <Spacing />\n {code`The following options are available for the ${\n command.name\n } command:`}\n <Spacing />\n <CommandOptionsDocs command={command} />\n <Spacing />\n </>\n );\n}\n\nexport interface CommandDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation file for a command.\n */\nexport function CommandDocsFile(props: CommandDocsFileProps) {\n const { levelOffset = 0, command, frontMatter, ...rest } = props;\n\n const context = usePowerlines<Context>();\n const usageExamples = memo(\n () => [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as CommandDocsProps[\"usageExamples\"]\n );\n\n return (\n <CommandContext.Provider value={command}>\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), `${command.path}.md`)}\n {...rest}\n frontMatter={defu(frontMatter ?? {}, {\n id: command.id,\n name: command.name,\n path: command.path,\n reference: command.reference,\n isVirtual: command.isVirtual,\n title: command.title,\n description: command.description,\n tags: command.tags\n })}>\n <CommandDocs\n levelOffset={levelOffset}\n command={command}\n usageExamples={usageExamples()}\n />\n </MarkdownFile>\n </CommandContext.Provider>\n );\n}\n"],"mappings":"i8BAEM,EAAa,CAAC,IAAK,UAAW,2BAAO,iBAG1C,MADA,GAAI,OAAS,EACV,EAgCJ,MAAK,EAAwB,CAAO,cAAe,UAAG,qDAAA,0BAAA,eAAA,CAKtD,SAAE,EAAA,EAAA,CACA,GAAC,CACD,WACI,EAIJ,OAHA,OAAQ,KAAQ,EAAI,QAAK,CAAA,SAAA,EACrB,CAAO,0CAEX,EAAA,EAAA,CAAA,IAAA,MA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GACN,KAAS,EAAA,KACN,KAAA,EAAA,KACF,UAAA,EAAA,UACG,UAAO,EAAA,UACR,MAAA,EAAgB,MACf,YAAC,EAAA,YACD,KAAE,EAAA,KACH,CAAC,EAEJ,IAAG,UAAA,CACD,OAAG,EAAA,EAAA,CACD,cACI,UACT,IAAQ,eAAW,CACZ,OAAE,GAAA,EAER,CAAA,EAED,CAAA,CAAA,EAEJ,CAAC,CAEJ,EAAG,OAAA,KAAA,EAAA,QAAA,kBAAA,2DAAA,aAAA"}
@@ -1,85 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
- let defu = require("defu");
5
- defu = require_runtime.__toESM(defu);
6
- let _alloy_js_core = require("@alloy-js/core");
7
- let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
8
- let _alloy_js_typescript = require("@alloy-js/typescript");
9
- let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
10
- let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
11
- let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
12
-
13
- //#region src/components/exec-builtin.tsx
14
- const __ΩOmit = [
15
- "T",
16
- "K",
17
- () => __ΩPick,
18
- () => __ΩExclude,
19
- "Omit",
20
- "b!b\"e!!e!!ge!\"o$#o##w%y"
21
- ];
22
- const __ΩPick = [
23
- "T",
24
- "K",
25
- "Pick",
26
- "l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
27
- ];
28
- const __ΩExclude = [
29
- "T",
30
- "U",
31
- "Exclude",
32
- "l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
33
- ];
34
- const __ΩExecBuiltinProps = [
35
- () => __ΩOmit,
36
- "id",
37
- "description",
38
- "ExecBuiltinProps",
39
- "P!P.\".#Jo!#Mw$y"
40
- ];
41
- /**
42
- * A built-in module for handling command execution in Shell Shock.
43
- */
44
- function ExecBuiltin(props) {
45
- const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
46
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
47
- id: "exec",
48
- description: "A module to handle command execution in a Shell Shock application."
49
- }, rest, {
50
- get imports() {
51
- return (0, defu.default)(rest.imports ?? {}, {
52
- "node:path": [
53
- "basename",
54
- "extname",
55
- "dirname",
56
- "join"
57
- ],
58
- "node:fs": ["existsSync"],
59
- "node:child_process": [{
60
- name: "spawn",
61
- alias: "_spawn"
62
- }, "execFileSync"],
63
- "node:stream": [{
64
- name: "Stream",
65
- default: true,
66
- type: true
67
- }]
68
- });
69
- },
70
- get builtinImports() {
71
- return (0, defu.default)(rest.builtinImports ?? {}, { env: ["isWindows", "env"] });
72
- },
73
- get children() {
74
- return [
75
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
76
- name: "resolveCommandEnv",
77
- parameters: [{
78
- name: "params",
79
- type: "{ argv: string[]; env?: NodeJS.ProcessEnv; }"
80
- }],
81
- returnType: "NodeJS.ProcessEnv",
82
- children: _alloy_js_core.code`const argv = params.argv;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@alloy-js/core/jsx-runtime`),n=require(`@powerlines/deepkit/vendor/type`),r=require(`defu`);r=e.__toESM(r);let i=require(`@alloy-js/core`),a=require(`@powerlines/plugin-alloy/core/components/spacing`),o=require(`@alloy-js/typescript`),s=require(`@powerlines/plugin-alloy/typescript/components/builtin-file`),c=require(`@powerlines/plugin-alloy/typescript/components/tsdoc`);const l=[`T`,`K`,()=>u,()=>d,`Omit`,`b!b"e!!e!!ge!"o$#o##w%y`],u=[`T`,`K`,`Pick`,`l+e#!e"!fRb!b"Pde""N#!w#y`],d=[`T`,`U`,`Exclude`,`l6!Re$!RPe#!e$"qk#%QRb!b"Pde"!p)w#y`],f=[()=>l,`id`,`description`,`ExecBuiltinProps`,`P!P.".#Jo!#Mw$y`];function p(e){let[{children:l},u]=(0,i.splitProps)(e,[`children`]);return(0,t.createComponent)(s.BuiltinFile,(0,t.mergeProps)({id:`exec`,description:`A module to handle command execution in a Shell Shock application.`},u,{get imports(){return(0,r.default)(u.imports??{},{"node:path":[`basename`,`extname`,`dirname`,`join`],"node:fs":[`existsSync`],"node:child_process":[{name:`spawn`,alias:`_spawn`},`execFileSync`],"node:stream":[{name:`Stream`,default:!0,type:!0}]})},get builtinImports(){return(0,r.default)(u.builtinImports??{},{env:[`isWindows`,`env`]})},get children(){return[(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveCommandEnv`,parameters:[{name:`params`,type:`{ argv: string[]; env?: NodeJS.ProcessEnv; }`}],returnType:`NodeJS.ProcessEnv`,children:i.code`const argv = params.argv;
83
2
  const shouldSuppressNpmFund = (() => {
84
3
  const cmd = basename(argv[0] ?? "");
85
4
  if (cmd === "npm" || cmd === "npm.cmd" || cmd === "npm.exe") {
@@ -105,32 +24,12 @@ function ExecBuiltin(props) {
105
24
  result.NPM_CONFIG_FUND ??= "false";
106
25
  result.npm_config_fund ??= "false";
107
26
  }
108
- return result; `
109
- }),
110
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
111
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
112
- name: "isWindowsBatchCommand",
113
- parameters: [{
114
- name: "resolvedCommand",
115
- type: "string"
116
- }],
117
- returnType: "boolean",
118
- children: _alloy_js_core.code`if (!isWindows) {
27
+ return result; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`isWindowsBatchCommand`,parameters:[{name:`resolvedCommand`,type:`string`}],returnType:`boolean`,children:i.code`if (!isWindows) {
119
28
  return false;
120
29
  }
121
30
  const ext = extname(resolvedCommand).toLowerCase();
122
31
 
123
- return ext === ".cmd" || ext === ".bat"; `
124
- }),
125
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
126
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
127
- name: "escapeForCmdExe",
128
- parameters: [{
129
- name: "arg",
130
- type: "string"
131
- }],
132
- returnType: "string",
133
- children: _alloy_js_core.code`if (/[&|<>^%\\\\r\\\\n]/.test(arg)) {
32
+ return ext === ".cmd" || ext === ".bat"; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`escapeForCmdExe`,parameters:[{name:`arg`,type:`string`}],returnType:`string`,children:i.code`if (/[&|<>^%\\\\r\\\\n]/.test(arg)) {
134
33
  throw new Error(
135
34
  \`Unsafe Windows cmd.exe argument detected: \${JSON.stringify(arg)}. \` +
136
35
  "Pass an explicit shell-wrapper argv at the call site instead."
@@ -139,33 +38,9 @@ function ExecBuiltin(props) {
139
38
  if (!arg.includes(" ") && !arg.includes('"')) {
140
39
  return arg;
141
40
  }
142
- return \`"\${arg.replace(/"/g, '""')}"\`; `
143
- }),
144
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
145
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
146
- name: "buildCmdExeCommandLine",
147
- parameters: [{
148
- name: "resolvedCommand",
149
- type: "string"
150
- }, {
151
- name: "args",
152
- type: "string[]"
153
- }],
154
- returnType: "string",
155
- children: _alloy_js_core.code`return [escapeForCmdExe(resolvedCommand), ...args.map(escapeForCmdExe)].join(
41
+ return \`"\${arg.replace(/"/g, '""')}"\`; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`buildCmdExeCommandLine`,parameters:[{name:`resolvedCommand`,type:`string`},{name:`args`,type:`string[]`}],returnType:`string`,children:i.code`return [escapeForCmdExe(resolvedCommand), ...args.map(escapeForCmdExe)].join(
156
42
  " "
157
- ); `
158
- }),
159
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
160
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
161
- name: "resolveNpmArgvForWindows",
162
- doc: "On Windows, Node 18.20.2+ (CVE-2024-27980) rejects spawning .cmd/.bat directly without shell, causing EINVAL. Resolve npm/npx to node + cli script so we spawn node.exe instead of npm.cmd.",
163
- parameters: [{
164
- name: "argv",
165
- type: "string[]"
166
- }],
167
- returnType: "string[] | null",
168
- children: _alloy_js_core.code`if (!isWindows || argv.length === 0) {
43
+ ); `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveNpmArgvForWindows`,doc:`On Windows, Node 18.20.2+ (CVE-2024-27980) rejects spawning .cmd/.bat directly without shell, causing EINVAL. Resolve npm/npx to node + cli script so we spawn node.exe instead of npm.cmd.`,parameters:[{name:`argv`,type:`string[]`}],returnType:`string[] | null`,children:i.code`if (!isWindows || argv.length === 0) {
169
44
  return null;
170
45
  }
171
46
  const base = basename(argv[0] ?? "")
@@ -185,18 +60,7 @@ function ExecBuiltin(props) {
185
60
 
186
61
  return [shimmedCommand, ...argv.slice(1)];
187
62
  }
188
- return [process.execPath, cliPath, ...argv.slice(1)]; `
189
- }),
190
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
191
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
192
- name: "resolveCommand",
193
- doc: "Resolves a command for Windows compatibility. On Windows, non-.exe commands (like pnpm, yarn) are resolved to .cmd; npm/npx are handled by resolveNpmArgvForWindows to avoid spawn EINVAL (no direct .cmd).",
194
- parameters: [{
195
- name: "command",
196
- type: "string"
197
- }],
198
- returnType: "string",
199
- children: _alloy_js_core.code`if (!isWindows) {
63
+ return [process.execPath, cliPath, ...argv.slice(1)]; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveCommand`,doc:`Resolves a command for Windows compatibility. On Windows, non-.exe commands (like pnpm, yarn) are resolved to .cmd; npm/npx are handled by resolveNpmArgvForWindows to avoid spawn EINVAL (no direct .cmd).`,parameters:[{name:`command`,type:`string`}],returnType:`string`,children:i.code`if (!isWindows) {
200
64
  return command;
201
65
  }
202
66
  const base = basename(command).toLowerCase();
@@ -206,33 +70,13 @@ function ExecBuiltin(props) {
206
70
  if (["pnpm", "yarn"].includes(base)) {
207
71
  return \`\${command}.cmd\`;
208
72
  }
209
- return command; `
210
- }),
211
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
212
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
213
- name: "resolveCommandStdio",
214
- parameters: [{
215
- name: "params",
216
- type: "{ hasInput: boolean; preferInherit: boolean; }"
217
- }],
218
- returnType: "[\"pipe\" | \"inherit\" | \"ignore\", \"pipe\", \"pipe\"]",
219
- children: _alloy_js_core.code`const stdin = params.hasInput
73
+ return command; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveCommandStdio`,parameters:[{name:`params`,type:`{ hasInput: boolean; preferInherit: boolean; }`}],returnType:`["pipe" | "inherit" | "ignore", "pipe", "pipe"]`,children:i.code`const stdin = params.hasInput
220
74
  ? "pipe"
221
75
  : params.preferInherit
222
76
  ? "inherit"
223
77
  : "pipe";
224
78
 
225
- return [stdin, "pipe", "pipe"]; `
226
- }),
227
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
228
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
229
- name: "resolveProcessExitCode",
230
- parameters: [{
231
- name: "params",
232
- type: "{ explicitCode: number | null | undefined; childExitCode: number | null | undefined; resolvedSignal: NodeJS.Signals | null; usesWindowsExitCodeShim: boolean; timedOut: boolean; noOutputTimedOut: boolean; killIssuedByTimeout: boolean; }"
233
- }],
234
- returnType: "number | null",
235
- children: _alloy_js_core.code`return (
79
+ return [stdin, "pipe", "pipe"]; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`resolveProcessExitCode`,parameters:[{name:`params`,type:`{ explicitCode: number | null | undefined; childExitCode: number | null | undefined; resolvedSignal: NodeJS.Signals | null; usesWindowsExitCodeShim: boolean; timedOut: boolean; noOutputTimedOut: boolean; killIssuedByTimeout: boolean; }`}],returnType:`number | null`,children:i.code`return (
236
80
  params.explicitCode ??
237
81
  params.childExitCode ??
238
82
  (params.usesWindowsExitCodeShim &&
@@ -242,187 +86,13 @@ function ExecBuiltin(props) {
242
86
  !params.killIssuedByTimeout
243
87
  ? 0
244
88
  : null)
245
- ); `
246
- }),
247
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
248
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
249
- name: "shouldSpawnWithShell",
250
- parameters: [{
251
- name: "params",
252
- type: "{ resolvedCommand: string; platform: NodeJS.Platform; }"
253
- }],
254
- returnType: "boolean",
255
- children: _alloy_js_core.code`// SECURITY: never enable \`shell\` for argv-based execution.
89
+ ); `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`shouldSpawnWithShell`,parameters:[{name:`params`,type:`{ resolvedCommand: string; platform: NodeJS.Platform; }`}],returnType:`boolean`,children:i.code`// SECURITY: never enable \`shell\` for argv-based execution.
256
90
  // \`shell\` routes through cmd.exe on Windows, which turns untrusted argv values
257
91
  // (like chat prompts passed as CLI args) into command-injection primitives.
258
92
  // If you need a shell, use an explicit shell-wrapper argv (e.g. \`cmd.exe /c ...\`)
259
93
  // and validate/escape at the call site.
260
94
  void params;
261
- return false; `
262
- }),
263
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
264
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The result of a spawn operation." }),
265
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
266
- "export": true,
267
- name: "SpawnResult",
268
- get children() {
269
- return [
270
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The PID of the spawned child process, if available." }),
271
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
272
- name: "pid",
273
- optional: true,
274
- type: "number"
275
- }),
276
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
277
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The standard output produced by the child process." }),
278
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
279
- name: "stdout",
280
- type: "string"
281
- }),
282
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
283
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The standard error produced by the child process." }),
284
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
285
- name: "stderr",
286
- type: "string"
287
- }),
288
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
289
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The exit code of the child process, if available." }),
290
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
291
- name: "code",
292
- type: "number | null"
293
- }),
294
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
295
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The signal that caused the child process to terminate, if it was killed by a signal." }),
296
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
297
- name: "signal",
298
- type: "NodeJS.Signals | null"
299
- }),
300
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
301
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Whether the child process was killed." }),
302
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
303
- name: "killed",
304
- type: "boolean"
305
- }),
306
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
307
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The reason for the child process termination." }),
308
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
309
- name: "termination",
310
- type: _alloy_js_core.code`"exit" | "timeout" | "no-output-timeout" | "signal"`
311
- }),
312
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
313
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Whether the child process timed out due to no output." }),
314
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
315
- name: "noOutputTimedOut",
316
- optional: true,
317
- type: "boolean"
318
- })
319
- ];
320
- }
321
- }),
322
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
323
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for spawning a child process." }),
324
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
325
- "export": true,
326
- name: "SpawnOptions",
327
- get children() {
328
- return [
329
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
330
- heading: "The timeout in milliseconds for the spawn operation. If the process runs longer than this, it will be killed and the spawn promise will reject. This can also be provided as a number directly to the spawn function for convenience. Providing \\`-1\\` will disable the timeout.",
331
- get children() {
332
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
333
- get type() {
334
- return _powerlines_deepkit_vendor_type.ReflectionKind.number;
335
- },
336
- defaultValue: "300000"
337
- });
338
- }
339
- }),
340
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
341
- name: "timeoutMs",
342
- optional: true,
343
- type: "number"
344
- }),
345
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
346
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The current working directory of the child process." }),
347
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
348
- name: "cwd",
349
- optional: true,
350
- type: "string"
351
- }),
352
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
353
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The input to be passed to the child process." }),
354
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
355
- name: "input",
356
- optional: true,
357
- type: "string"
358
- }),
359
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
360
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The environment variables for the child process." }),
361
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
362
- name: "env",
363
- optional: true,
364
- type: "NodeJS.ProcessEnv"
365
- }),
366
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
367
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Whether to pass arguments to the child process verbatim on Windows." }),
368
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
369
- name: "windowsVerbatimArguments",
370
- optional: true,
371
- type: "boolean"
372
- }),
373
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
374
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The timeout in milliseconds for the child process to produce output on stdout or stderr. If the process produces no output for this duration, it will be killed and the spawn promise will reject with a no-output-timeout termination reason." }),
375
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
376
- name: "noOutputTimeoutMs",
377
- optional: true,
378
- type: "number"
379
- })
380
- ];
381
- }
382
- }),
383
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
384
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
385
- "const": true,
386
- name: "WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS",
387
- initializer: _alloy_js_core.code`250`
388
- }),
389
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
390
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
391
- "const": true,
392
- name: "WINDOWS_CLOSE_STATE_POLL_MS",
393
- initializer: _alloy_js_core.code`10`
394
- }),
395
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
396
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
397
- heading: "Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.",
398
- get children() {
399
- return [
400
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
401
- name: "argv",
402
- children: "The command and its arguments to spawn."
403
- }),
404
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
405
- name: "optionsOrTimeoutMs",
406
- children: `The options for spawning the command, or a number representing the timeout in milliseconds. This allows for a convenient shorthand when only a timeout is needed. Providing \`-1\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`
407
- }),
408
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason." })
409
- ];
410
- }
411
- }),
412
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
413
- "export": true,
414
- async: true,
415
- name: "spawn",
416
- parameters: [{
417
- name: "argv",
418
- type: "string[]"
419
- }, {
420
- name: "optionsOrTimeoutMs",
421
- type: "number | SpawnOptions",
422
- default: "300000"
423
- }],
424
- returnType: "Promise<SpawnResult>",
425
- children: _alloy_js_core.code`const options: SpawnOptions =
95
+ return false; `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The result of a spawn operation.`}),(0,t.createComponent)(o.InterfaceDeclaration,{export:!0,name:`SpawnResult`,get children(){return[(0,t.createComponent)(c.TSDoc,{heading:`The PID of the spawned child process, if available.`}),(0,t.createComponent)(o.InterfaceMember,{name:`pid`,optional:!0,type:`number`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The standard output produced by the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`stdout`,type:`string`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The standard error produced by the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`stderr`,type:`string`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The exit code of the child process, if available.`}),(0,t.createComponent)(o.InterfaceMember,{name:`code`,type:`number | null`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The signal that caused the child process to terminate, if it was killed by a signal.`}),(0,t.createComponent)(o.InterfaceMember,{name:`signal`,type:`NodeJS.Signals | null`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Whether the child process was killed.`}),(0,t.createComponent)(o.InterfaceMember,{name:`killed`,type:`boolean`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The reason for the child process termination.`}),(0,t.createComponent)(o.InterfaceMember,{name:`termination`,type:i.code`"exit" | "timeout" | "no-output-timeout" | "signal"`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Whether the child process timed out due to no output.`}),(0,t.createComponent)(o.InterfaceMember,{name:`noOutputTimedOut`,optional:!0,type:`boolean`})]}}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Options for spawning a child process.`}),(0,t.createComponent)(o.InterfaceDeclaration,{export:!0,name:`SpawnOptions`,get children(){return[(0,t.createComponent)(c.TSDoc,{heading:"The timeout in milliseconds for the spawn operation. If the process runs longer than this, it will be killed and the spawn promise will reject. This can also be provided as a number directly to the spawn function for convenience. Providing \\`-1\\` will disable the timeout.",get children(){return(0,t.createComponent)(c.TSDocDefaultValue,{get type(){return n.ReflectionKind.number},defaultValue:`300000`})}}),(0,t.createComponent)(o.InterfaceMember,{name:`timeoutMs`,optional:!0,type:`number`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The current working directory of the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`cwd`,optional:!0,type:`string`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The input to be passed to the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`input`,optional:!0,type:`string`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The environment variables for the child process.`}),(0,t.createComponent)(o.InterfaceMember,{name:`env`,optional:!0,type:`NodeJS.ProcessEnv`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Whether to pass arguments to the child process verbatim on Windows.`}),(0,t.createComponent)(o.InterfaceMember,{name:`windowsVerbatimArguments`,optional:!0,type:`boolean`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`The timeout in milliseconds for the child process to produce output on stdout or stderr. If the process produces no output for this duration, it will be killed and the spawn promise will reject with a no-output-timeout termination reason.`}),(0,t.createComponent)(o.InterfaceMember,{name:`noOutputTimeoutMs`,optional:!0,type:`number`})]}}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{const:!0,name:`WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS`,initializer:i.code`250`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{const:!0,name:`WINDOWS_CLOSE_STATE_POLL_MS`,initializer:i.code`10`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.`,get children(){return[(0,t.createComponent)(c.TSDocParam,{name:`argv`,children:`The command and its arguments to spawn.`}),(0,t.createComponent)(c.TSDocParam,{name:`optionsOrTimeoutMs`,children:"The options for spawning the command, or a number representing the timeout in milliseconds. This allows for a convenient shorthand when only a timeout is needed. Providing `-1` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used."}),(0,t.createComponent)(c.TSDocReturns,{children:`A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,async:!0,name:`spawn`,parameters:[{name:`argv`,type:`string[]`},{name:`optionsOrTimeoutMs`,type:`number | SpawnOptions`,default:`300000`}],returnType:`Promise<SpawnResult>`,children:i.code`const options: SpawnOptions =
426
96
  typeof optionsOrTimeoutMs === "number"
427
97
  ? { timeoutMs: optionsOrTimeoutMs }
428
98
  : optionsOrTimeoutMs;
@@ -645,104 +315,18 @@ return new Promise((resolve, reject) => {
645
315
  };
646
316
  waitForExitState();
647
317
  });
648
- });`
649
- }),
650
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
651
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
652
- heading: "A helper function that executes a command and returns its stdout.",
653
- get children() {
654
- return [
655
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
656
- name: "argv",
657
- children: `The command and its arguments to spawn. This is passed directly to the spawn function. Remember that on Windows, commands like \`npm\` or \`pnpm\` will be resolved to their .cmd shims, so you can just pass \`npm\` without worrying about the extension.`
658
- }),
659
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
660
- name: "optionsOrTimeoutMs",
661
- children: `The options for spawning the command, or a number representing the timeout in milliseconds. This is passed directly to the spawn function. Providing \`-1\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`
662
- }),
663
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "A promise that resolves with the result of the spawn operation if the command exits with code 0, or rejects with an error if the command exits with a non-zero code or if there is a problem spawning the process." })
664
- ];
665
- }
666
- }),
667
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
668
- "export": true,
669
- async: true,
670
- name: "exec",
671
- parameters: [{
672
- name: "argv",
673
- type: "string[]"
674
- }, {
675
- name: "optionsOrTimeoutMs",
676
- type: "number | SpawnOptions",
677
- default: "300000"
678
- }],
679
- returnType: "Promise<string>",
680
- children: _alloy_js_core.code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);
318
+ });`}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`A helper function that executes a command and returns its stdout.`,get children(){return[(0,t.createComponent)(c.TSDocParam,{name:`argv`,children:"The command and its arguments to spawn. This is passed directly to the spawn function. Remember that on Windows, commands like `npm` or `pnpm` will be resolved to their .cmd shims, so you can just pass `npm` without worrying about the extension."}),(0,t.createComponent)(c.TSDocParam,{name:`optionsOrTimeoutMs`,children:"The options for spawning the command, or a number representing the timeout in milliseconds. This is passed directly to the spawn function. Providing `-1` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used."}),(0,t.createComponent)(c.TSDocReturns,{children:`A promise that resolves with the result of the spawn operation if the command exits with code 0, or rejects with an error if the command exits with a non-zero code or if there is a problem spawning the process.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,async:!0,name:`exec`,parameters:[{name:`argv`,type:`string[]`},{name:`optionsOrTimeoutMs`,type:`number | SpawnOptions`,default:`300000`}],returnType:`Promise<string>`,children:i.code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);
681
319
  if (spawnResult.code !== 0) {
682
320
  throw Object.assign(new Error(
683
321
  \`Command "\${argv.join(" ")}" exited with code \${spawnResult.code} and signal \${spawnResult.signal}\`
684
322
  ), spawnResult);
685
323
  }
686
324
 
687
- return spawnResult.stdout.trim(); `
688
- }),
689
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
690
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
691
- heading: "A helper function that executes a command synchronously and returns its stdout. This is a thin wrapper around \\`child_process.execFileSync\\` with some added Windows compatibility handling.",
692
- get children() {
693
- return [
694
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
695
- name: "argv",
696
- children: `The command and its arguments to spawn. This is passed directly to \`execFileSync\` after Windows-specific resolution. Remember that on Windows, commands like \`npm\` or \`pnpm\` will be resolved to their .cmd shims, so you can just pass \`npm\` without worrying about the extension.`
697
- }),
698
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
699
- name: "options",
700
- children: `The options for spawning the command. This is passed directly to \`execFileSync\` after some processing. The timeout option is supported, but note that it will throw an error if the process runs longer than the specified timeout. If no options are provided, a default timeout of 5 minutes will be used.`
701
- }),
702
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "The standard output produced by the command if it exits with code 0. If the command exits with a non-zero code or if there is a problem spawning the process, an error will be thrown." })
703
- ];
704
- }
705
- }),
706
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
707
- "export": true,
708
- name: "execSync",
709
- parameters: [{
710
- name: "argv",
711
- type: "string[]"
712
- }, {
713
- name: "options",
714
- type: "SpawnOptions",
715
- default: "{}"
716
- }],
717
- returnType: "string",
718
- children: _alloy_js_core.code`return execFileSync(argv.length > 0 ? argv[0] : "", argv.slice(1), {
325
+ return spawnResult.stdout.trim(); `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:"A helper function that executes a command synchronously and returns its stdout. This is a thin wrapper around \\`child_process.execFileSync\\` with some added Windows compatibility handling.",get children(){return[(0,t.createComponent)(c.TSDocParam,{name:`argv`,children:"The command and its arguments to spawn. This is passed directly to `execFileSync` after Windows-specific resolution. Remember that on Windows, commands like `npm` or `pnpm` will be resolved to their .cmd shims, so you can just pass `npm` without worrying about the extension."}),(0,t.createComponent)(c.TSDocParam,{name:`options`,children:"The options for spawning the command. This is passed directly to `execFileSync` after some processing. The timeout option is supported, but note that it will throw an error if the process runs longer than the specified timeout. If no options are provided, a default timeout of 5 minutes will be used."}),(0,t.createComponent)(c.TSDocReturns,{children:`The standard output produced by the command if it exits with code 0. If the command exits with a non-zero code or if there is a problem spawning the process, an error will be thrown.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,name:`execSync`,parameters:[{name:`argv`,type:`string[]`},{name:`options`,type:`SpawnOptions`,default:`{}`}],returnType:`string`,children:i.code`return execFileSync(argv.length > 0 ? argv[0] : "", argv.slice(1), {
719
326
  encoding: "utf8",
720
327
  stdio: ["ignore", "pipe", "ignore"],
721
328
  timeout: options.timeoutMs ?? 300000,
722
329
  env: resolveCommandEnv({ argv, env: options.env }),
723
330
  cwd: options.cwd || process.cwd(),
724
331
  windowsHide: true
725
- }).trim(); `
726
- }),
727
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
728
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
729
- get when() {
730
- return Boolean(children);
731
- },
732
- children
733
- })
734
- ];
735
- }
736
- }));
737
- }
738
- ExecBuiltin.__type = [
739
- () => __ΩExecBuiltinProps,
740
- "props",
741
- "ExecBuiltin",
742
- "A built-in module for handling command execution in Shell Shock.",
743
- "Pn!2\"\"/#?$"
744
- ];
745
-
746
- //#endregion
747
- exports.ExecBuiltin = ExecBuiltin;
748
- exports.__ΩExecBuiltinProps = __ΩExecBuiltinProps;
332
+ }).trim(); `}),(0,t.createComponent)(a.Spacing,{}),(0,t.createComponent)(i.Show,{get when(){return!!l},children:l})]}}))}p.__type=[()=>f,`props`,`ExecBuiltin`,`A built-in module for handling command execution in Shell Shock.`,`Pn!2""/#?$`],exports.ExecBuiltin=p,exports.__ΩExecBuiltinProps=f;