@shell-shock/core 0.17.4 → 0.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/command-validation-logic.cjs +214 -152
- package/dist/components/command-validation-logic.mjs +213 -152
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +113 -9
- package/dist/components/docs.mjs +109 -9
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/exec-builtin.cjs +36 -1
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts.map +1 -1
- package/dist/components/exec-builtin.mjs +35 -1
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +51 -2
- package/dist/components/helpers.mjs +50 -2
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +17 -1
- package/dist/components/index.mjs +9 -9
- package/dist/components/options-parser-logic.cjs +411 -174
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +405 -174
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +61 -5
- package/dist/components/state-builtin.mjs +60 -5
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +46 -3
- package/dist/components/usage.mjs +45 -3
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +68 -3
- package/dist/components/utils-builtin.mjs +67 -3
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/helpers/automd.cjs +28 -13
- package/dist/helpers/automd.mjs +28 -13
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/plugin-utils/compute-bin.cjs +50 -0
- package/dist/plugin-utils/compute-bin.d.cts +13 -0
- package/dist/plugin-utils/compute-bin.d.cts.map +1 -0
- package/dist/plugin-utils/compute-bin.d.mts +13 -0
- package/dist/plugin-utils/compute-bin.d.mts.map +1 -0
- package/dist/plugin-utils/compute-bin.mjs +50 -0
- package/dist/plugin-utils/compute-bin.mjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.cjs +50 -0
- package/dist/plugin-utils/get-command-tree.d.cts +15 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts +15 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs +49 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +4 -0
- package/dist/plugin-utils/index.d.cts +3 -2
- package/dist/plugin-utils/index.d.mts +3 -2
- package/dist/plugin-utils/index.mjs +3 -2
- package/dist/plugin.cjs +170 -55
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +170 -54
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +1 -1
- package/dist/resolver/deepkit.mjs +1 -1
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/types/command.cjs +120 -10
- package/dist/types/command.d.cts +95 -8
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +95 -8
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +109 -10
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +2 -3
- package/dist/types/config.d.cts +2 -3
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +2 -3
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +2 -3
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/index.cjs +12 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-builtin.mjs","names":[],"sources":["../../src/components/state-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, computed, For, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n TypeDeclaration,\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 defu from \"defu\";\nimport { computedOptions } from \"../contexts/options\";\nimport { getAppBin } from \"../plugin-utils\";\nimport { getAppTitle } from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types\";\nimport { OptionsMember, OptionsParserLogic } from \"./options-parser-logic\";\n\nexport function GlobalTypeDefinitions() {\n const context = usePowerlines<Context>();\n\n const options = computed(() => computedOptions(context.options));\n\n return (\n <>\n <TSDoc\n heading={`An object representing the global options available for every command in the ${getAppTitle(\n context,\n true\n )} command-line application.`}\n />\n <InterfaceDeclaration export name=\"GlobalOptions\">\n <For each={Object.values(options.value)} hardline>\n {option => <OptionsMember option={option} />}\n </For>\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"The context object for the current command execution, containing the command path and segments.\" />\n <InterfaceDeclaration\n export\n name=\"CommandContext\"\n typeParameters={[\n {\n name: \"THandler\",\n extends: \"(...params: any[]) => any\",\n default: \"any\"\n }\n ]}>\n <TSDoc\n heading={`The full command path as a string. For example, if the user runs \\`${getAppBin(\n context\n )} foo bar\\`, this would be \\`foo bar\\`. This is useful for commands that need to know their full invocation path, such as for help text or for commands that have dynamic behavior based on their position in the command hierarchy.`}\n />\n <InterfaceMember name=\"path\" type=\"string\" />\n <Spacing />\n <TSDoc\n heading={`An array of command path segments. For example, if the user runs \\`${getAppBin(\n context\n )} foo bar\\`, this would be \\`[\"foo\", \"bar\"]\\`. This is useful for commands that need to know their individual path segments, such as for dynamic routing or for commands that have behavior based on specific segments in the command hierarchy.`}\n />\n <InterfaceMember name=\"segments\" type=\"string[]\" />\n <Spacing />\n <TSDoc\n heading={`The parameters for the current command's handler function.`}\n />\n <InterfaceMember name=\"params\" type=\"Parameters<THandler>\" />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration export name=\"GlobalContextStatus\">\n {code`\"initializing\" | \"preparing\" | \"executing\" | \"completed\"`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc\n heading={`The state object for the ${getAppTitle(context)} application context.`}\n />\n <InterfaceDeclaration export name=\"GlobalContextState\">\n <TSDoc heading=\"The unique identifier for the current execution context.\" />\n <InterfaceMember name=\"executionId\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The status of the current execution context.\" />\n <InterfaceMember name=\"status\" type=\"GlobalContextStatus\" />\n <Spacing />\n <TSDoc heading=\"Indicates whether the current execution context has encountered an error.\" />\n <InterfaceMember name=\"isError\" type=\"boolean\" />\n <Spacing />\n <TSDoc heading=\"A map containing arbitrary data associated with the current execution context.\" />\n <InterfaceMember name=\"meta\" type=\"Map<string, unknown>\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc\n heading={`The context object for the ${getAppTitle(context)} application.`}\n />\n <InterfaceDeclaration export name=\"GlobalContext\">\n <TSDoc heading=\"The global options shared across all commands in the application.\" />\n <InterfaceMember name=\"options\" type=\"GlobalOptions\" />\n <Spacing />\n <TSDoc heading=\"The raw command-line arguments passed to the application.\" />\n <InterfaceMember name=\"inputArgs\" type=\"string[]\" />\n <Spacing />\n <TSDoc heading=\"The state of the current execution context.\" />\n <InterfaceMember name=\"state\" type=\"GlobalContextState\" />\n </InterfaceDeclaration>\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 {`This function is only intended for internal use. Please use \\`useArgs()\\` instead.`}\n </TSDocRemarks>\n <Spacing />\n <TSDocInternal />\n <Spacing />\n <TSDocReturns>\n {`An array of command-line arguments from Deno or Node.js environments.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration name=\"getInputArgs\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n const context = usePowerlines<Context>();\n\n const options = computed(() =>\n Object.fromEntries(context.options.map(option => [option.name, option]))\n );\n\n return (\n <>\n <Spacing />\n\n <TSDoc\n heading={`The global ${getAppTitle(context)} application context store instance.`}>\n <TSDocInternal />\n </TSDoc>\n <VarDeclaration export const name=\"unstable_globalStore\">\n {code` new AsyncLocalStorage<GlobalContext>({ name: \"globalStore\" }); `}\n </VarDeclaration>\n <Spacing />\n <TSDoc\n heading={`Get the ${getAppTitle(\n context\n )} application context for the current application.`}>\n <TSDocReturns>\n {`The ${getAppTitle(\n context\n )} application context for the current application or undefined if the context is not available.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useGlobal\" returnType=\"GlobalContext\">\n {code`return unstable_globalStore.getStore() as GlobalContext;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the command-line arguments from the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\"An array of command-line arguments from the application context.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useArgs\" returnType=\"string[]\">\n {code`return useGlobal()?.inputArgs ?? getInputArgs();`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the command-line global options from the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\n \"An object containing the global options from the application context.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useGlobalOptions\"\n returnType=\"GlobalOptions\">\n {code`return useGlobal()?.options ?? {};`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the state of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>{\"The state of the application context.\"}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useState\"\n returnType=\"GlobalContextState\">\n {code`return useGlobal()?.state;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility function to update the state of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocRemarks>\n {`This function will throw an error if the global context is not available, so it should only be used within a valid context scope, such as within a command handler or within the \\`withGlobal()\\` function.`}\n </TSDocRemarks>\n <Spacing />\n <TSDocParam name=\"update\">\n {`The new state or a function that receives the previous state and returns the new state. This allows for both direct state updates and functional updates based on the previous state.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"setState\"\n parameters={[\n {\n name: \"update\",\n type: \"Partial<GlobalContextState> | ((prev: GlobalContextState) => GlobalContextState)\"\n }\n ]}>\n {code`const prev = useGlobal()?.state;\n if (!prev) {\n throw new Error(\n \\`The ${getAppTitle(\n context\n )} application context is not available. Make sure to call setState() within a valid context scope.\\`\n );\n }\n\n useGlobal().state = typeof update === \"function\" ? update(prev) : { ...prev, ...update }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the execution ID of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\"The execution ID of the application context.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useExecutionId\" returnType=\"string\">\n {code`return useState().executionId;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the metadata of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\"The metadata of the application context.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useMeta\"\n returnType=\"Map<string, unknown>\">\n {code`return useState().meta;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the current status of the ${getAppTitle(\n context\n )} application.`}>\n <TSDocReturns>{\"The current status of the application.\"}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useStatus\"\n returnType=\"GlobalContextStatus\">\n {code`return useState().status;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`The global ${getAppTitle(context)} - command context store instance.`}>\n <TSDocInternal />\n </TSDoc>\n <VarDeclaration export name=\"unstable_commandStore\">\n {code`new AsyncLocalStorage<CommandContext>({ name: \"commandStore\" });`}\n </VarDeclaration>\n <Spacing />\n <TSDoc\n heading={`Get the ${getAppTitle(context)} - command context for the current application.`}>\n <TSDocReturns>\n {`The ${getAppTitle(context)} - command context for the current application.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useCommand\" returnType=\"CommandContext\">\n {code`const result = unstable_commandStore.getStore();\nif (!result) {\n throw new Error(\n \\`The ${getAppTitle(context)} - command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n}\nreturn result;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility hook function to get the individual segments of the current command path.\">\n <TSDocReturns>{\"An array of command path segments.\"}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useSegments\" returnType=\"string[]\">\n {code`return useCommand().segments;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility hook function to get the full command path as a string.\">\n <TSDocReturns>\n {`The full command path as a string. For example, if the user runs \\`${getAppBin(\n context\n )} foo bar\\`, this would return \\`\"foo bar\"\\`. This is useful for commands that need to know their full invocation path, such as for help text or for commands that have dynamic behavior based on their position in the command hierarchy.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"usePath\" returnType=\"string\">\n {code`return useCommand().path;`}\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 <TSDoc heading=\"A utility function to determine if the help flag is present or if the command is in an error state during preparation.\">\n <TSDocReturns>\n {`True if the help flag is present or if the command is in an error state during preparation, false otherwise. This can be used to conditionally display help text or to alter command behavior when the user is likely seeking help.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"isHelp\" returnType=\"boolean\">\n {code`return !isCI && (hasFlag([\"help\", \"h\", \"?\"]) || (useStatus() === \"preparing\" && useState().isError)); `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility function to wrap the ${getAppTitle(\n context\n )} application within the global context scope.`}>\n <TSDocParam name=\"handler\">\n {`The callback function to run within the global context scope. This function will receive the global context as its argument, allowing it to access any properties or utilities defined on the context. The callback function can be asynchronous and can return a value or a promise.`}\n </TSDocParam>\n <TSDocReturns>\n {`The result of the callback function, which can be a value or a promise that resolves to a value.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"withGlobal\"\n parameters={[{ name: \"handler\", type: \"() => any\" }]}\n returnType=\"Promise<void>\">\n <VarDeclaration\n const\n name=\"args\"\n initializer={code`getInputArgs(); `}\n />\n <Spacing />\n <OptionsParserLogic\n options={options.value}\n appSpecificEnvPrefix={context.config.appSpecificEnvPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <Spacing />\n {code`\n return unstable_globalStore.run({ options, inputArgs: args, state: { executionId: randomUUID(), status: \"initializing\", isError: false, meta: new Map() } as GlobalContextState }, handler);`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility function to wrap a ${getAppTitle(\n context\n )} application command handler within the command context scope.`}>\n <TSDocParam name=\"handler\">\n {`The callback function to run within the command context scope. This function will receive the command context as its argument, allowing it to access any properties or utilities defined on the context. The callback function can be asynchronous and can return a value or a promise.`}\n </TSDocParam>\n <TSDocReturns>\n {`The result of the callback function, which can be a value or a promise that resolves to a value.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"withCommand\"\n typeParameters={[\n {\n name: \"THandler\",\n extends: \"(this: CommandContext, ...params: any[]) => any\",\n default: \"(this: CommandContext, ...params: any[]) => any\"\n }\n ]}\n parameters={[\n { name: \"path\", type: \"string\" },\n { name: \"segments\", type: \"string[]\" },\n { name: \"params\", type: \"Parameters<THandler>\" },\n { name: \"handler\", type: \"THandler\" }\n ]}\n returnType=\"Promise<{ error: string | Error | null }>\">\n {code`setState({ status: \"preparing\", isError: false });\n\n const ctx = { path, segments, params } as CommandContext<THandler>;\n const result = await Promise.resolve(unstable_commandStore.run(ctx, () => Reflect.apply(handler, ctx, params)));\n if (result instanceof Error || (typeof result === \"object\" && ((result as { error: unknown }).error instanceof Error || typeof (result as { error: unknown }).error === \"string\"))) {\n setState({ status: \"completed\", isError: true });\n return { error: result instanceof Error ? result : (result as { error: Error | string }).error };\n }\n\n setState({ status: \"completed\", isError: false });\n return { error: null }; `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface StateBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * A built-in module for handling application state utilities in Shell Shock.\n */\nexport function StateBuiltin(props: StateBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"state\"\n description=\"A module that provides context hooks and utilities for accessing the application state.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:async_hooks\": [\"AsyncLocalStorage\"],\n \"node:crypto\": [\"randomUUID\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n env: [\"isCI\", \"env\"]\n })}>\n <GlobalTypeDefinitions />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <ContextUtilities />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAgCA,SAAe,wBAAA;CACb,MAAA,UAAS,eAAA;CACT,MAAA,UAAU,eAAA,gBAAA,QAAA,QAAA,CAAA;AACV,QAAA;EAAA,gBAAY,OAAA,EACZ,IAAA,UAAA;AACI,UAAG,gFA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AAK;KACN,CAAC,EAAA,gBAAO,cAA2B,EAClC,UAAA,oGACD,CAAA,CAAA;;GAEJ,CAAC;EAAE,gBAAc,qBAAyB;GACzC,UAAM;GACN,OAAO;GACP,MAAK;GACL,YAAY,CAAA;IACV,MAAI;IACJ,MAAG;IACJ,CAAC;GACF,YAAM;GACN,IAAI,WAAK;AACP,WAAC;KAAA,gBAAA,gBAAA;MACC,SAAA;MACA,MAAA;MACA,aAAM,IAAW;MAClB,CAAC;KAAA,gBAAgB,SAAA,EAAA,CAAA;KAAA,gBAAA,oBAAA;MAChB,IAAE,UAAA;AACA,cAAO,QAAE;;MAEX,IAAI,uBAAiB;AACnB,cAAA,QAAA,OAAA;;MAEF,IAAA,kBAAY;AACV,cAAO,QAAQ,OAAO;;MAEzB,CAAC;KAAE,gBAAkB,SAAO,EAAA,CAAA;KAAA,IAAW;;KACA;;GAE3C,CAAC;EAAE,gBAAc,SAAU,EAAK,CAAC;EAAC,gBAAiB,OAAQ;GAC1D,IAAI,UAAM;;;GAGV,IAAI,WAAM;AACR,WAAM,CAAA,gBAAkB,YAAU;KAChC,MAAE;KACF,UAAU;KACX,CAAC,EAAA,gBAAA,cAAA,gHAED,CAAC,CAAA;;GAEL,CAAC;EAAE,gBAAE,qBAAmB;GACvB,UAAE;GACH,OAAA;GACH,MAAA;;IAEM,MAAC;IACL,SAAA;IACI,SAAI;IACP,CAAA;;;KAED,MAAA;KACG,MAAM;KACT;IAAA;KACI,MAAC;KACL,MAAS;;;KAET,MAAO;KACJ,MAAA;KACA;IAAC;KACA,MAAA;KACA,MAAI;KACL;IAAC;GACF,YAAU;GACV,UAAU,IAAA;;;;;;;;;;;GAWX,CAAC;EAAC"}
|
|
1
|
+
{"version":3,"file":"state-builtin.mjs","names":[],"sources":["../../src/components/state-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, computed, For, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n TypeDeclaration,\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 defu from \"defu\";\nimport { computedOptions } from \"../contexts/options\";\nimport { getAppBin } from \"../plugin-utils\";\nimport { getAppTitle } from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types\";\nimport { OptionsMember, OptionsParserLogic } from \"./options-parser-logic\";\n\nexport function GlobalTypeDefinitions() {\n const context = usePowerlines<Context>();\n\n const options = computed(() => computedOptions(context.options));\n\n return (\n <>\n <TSDoc\n heading={`An object representing the global options available for every command in the ${getAppTitle(\n context,\n true\n )} command-line application.`}\n />\n <InterfaceDeclaration export name=\"GlobalOptions\">\n <For each={Object.values(options.value)} hardline>\n {option => <OptionsMember option={option} />}\n </For>\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"The context object for the current command execution, containing the command path and segments.\" />\n <InterfaceDeclaration\n export\n name=\"CommandContext\"\n typeParameters={[\n {\n name: \"THandler\",\n extends: \"(...params: any[]) => any\",\n default: \"any\"\n }\n ]}>\n <TSDoc\n heading={`The full command path as a string. For example, if the user runs \\`${getAppBin(\n context\n )} foo bar\\`, this would be \\`foo bar\\`. This is useful for commands that need to know their full invocation path, such as for help text or for commands that have dynamic behavior based on their position in the command hierarchy.`}\n />\n <InterfaceMember name=\"path\" type=\"string\" />\n <Spacing />\n <TSDoc\n heading={`An array of command path segments. For example, if the user runs \\`${getAppBin(\n context\n )} foo bar\\`, this would be \\`[\"foo\", \"bar\"]\\`. This is useful for commands that need to know their individual path segments, such as for dynamic routing or for commands that have behavior based on specific segments in the command hierarchy.`}\n />\n <InterfaceMember name=\"segments\" type=\"string[]\" />\n <Spacing />\n <TSDoc\n heading={`The parameters for the current command's handler function.`}\n />\n <InterfaceMember name=\"params\" type=\"Parameters<THandler>\" />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration export name=\"GlobalContextStatus\">\n {code`\"initializing\" | \"preparing\" | \"executing\" | \"completed\"`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc\n heading={`The state object for the ${getAppTitle(context)} application context.`}\n />\n <InterfaceDeclaration export name=\"GlobalContextState\">\n <TSDoc heading=\"The unique identifier for the current execution context.\" />\n <InterfaceMember name=\"executionId\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The status of the current execution context.\" />\n <InterfaceMember name=\"status\" type=\"GlobalContextStatus\" />\n <Spacing />\n <TSDoc heading=\"Indicates whether the current execution context has encountered an error.\" />\n <InterfaceMember name=\"isError\" type=\"boolean\" />\n <Spacing />\n <TSDoc heading=\"A map containing arbitrary data associated with the current execution context.\" />\n <InterfaceMember name=\"meta\" type=\"Map<string, unknown>\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc\n heading={`The context object for the ${getAppTitle(context)} application.`}\n />\n <InterfaceDeclaration export name=\"GlobalContext\">\n <TSDoc heading=\"The global options shared across all commands in the application.\" />\n <InterfaceMember name=\"options\" type=\"GlobalOptions\" />\n <Spacing />\n <TSDoc heading=\"The raw command-line arguments passed to the application.\" />\n <InterfaceMember name=\"inputArgs\" type=\"string[]\" />\n <Spacing />\n <TSDoc heading=\"The state of the current execution context.\" />\n <InterfaceMember name=\"state\" type=\"GlobalContextState\" />\n </InterfaceDeclaration>\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 {`This function is only intended for internal use. Please use \\`useArgs()\\` instead.`}\n </TSDocRemarks>\n <Spacing />\n <TSDocInternal />\n <Spacing />\n <TSDocReturns>\n {`An array of command-line arguments from Deno or Node.js environments.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration name=\"getInputArgs\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n const context = usePowerlines<Context>();\n\n const options = computed(() =>\n Object.fromEntries(context.options.map(option => [option.name, option]))\n );\n\n return (\n <>\n <Spacing />\n\n <TSDoc\n heading={`The global ${getAppTitle(context)} application context store instance.`}>\n <TSDocInternal />\n </TSDoc>\n <VarDeclaration export const name=\"unstable_globalStore\">\n {code` new AsyncLocalStorage<GlobalContext>({ name: \"globalStore\" }); `}\n </VarDeclaration>\n <Spacing />\n <TSDoc\n heading={`Get the ${getAppTitle(\n context\n )} application context for the current application.`}>\n <TSDocReturns>\n {`The ${getAppTitle(\n context\n )} application context for the current application or undefined if the context is not available.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useGlobal\" returnType=\"GlobalContext\">\n {code`return unstable_globalStore.getStore() as GlobalContext;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the command-line arguments from the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\"An array of command-line arguments from the application context.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useArgs\" returnType=\"string[]\">\n {code`return useGlobal()?.inputArgs ?? getInputArgs();`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the command-line global options from the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\n \"An object containing the global options from the application context.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useGlobalOptions\"\n returnType=\"GlobalOptions\">\n {code`return useGlobal()?.options ?? {};`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the state of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>{\"The state of the application context.\"}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useState\"\n returnType=\"GlobalContextState\">\n {code`return useGlobal()?.state;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility function to update the state of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocRemarks>\n {`This function will throw an error if the global context is not available, so it should only be used within a valid context scope, such as within a command handler or within the \\`withGlobal()\\` function.`}\n </TSDocRemarks>\n <Spacing />\n <TSDocParam name=\"update\">\n {`The new state or a function that receives the previous state and returns the new state. This allows for both direct state updates and functional updates based on the previous state.`}\n </TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"setState\"\n parameters={[\n {\n name: \"update\",\n type: \"Partial<GlobalContextState> | ((prev: GlobalContextState) => GlobalContextState)\"\n }\n ]}>\n {code`const prev = useGlobal()?.state;\n if (!prev) {\n throw new Error(\n \\`The ${getAppTitle(\n context\n )} application context is not available. Make sure to call setState() within a valid context scope.\\`\n );\n }\n\n useGlobal().state = typeof update === \"function\" ? update(prev) : { ...prev, ...update }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the execution ID of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\"The execution ID of the application context.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useExecutionId\" returnType=\"string\">\n {code`return useState().executionId;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the metadata of the ${getAppTitle(\n context\n )} application context.`}>\n <TSDocReturns>\n {\"The metadata of the application context.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useMeta\"\n returnType=\"Map<string, unknown>\">\n {code`return useState().meta;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility hook function to get the current status of the ${getAppTitle(\n context\n )} application.`}>\n <TSDocReturns>{\"The current status of the application.\"}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"useStatus\"\n returnType=\"GlobalContextStatus\">\n {code`return useState().status;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`The global ${getAppTitle(context)} - command context store instance.`}>\n <TSDocInternal />\n </TSDoc>\n <VarDeclaration export name=\"unstable_commandStore\">\n {code`new AsyncLocalStorage<CommandContext>({ name: \"commandStore\" });`}\n </VarDeclaration>\n <Spacing />\n <TSDoc\n heading={`Get the ${getAppTitle(context)} - command context for the current application.`}>\n <TSDocReturns>\n {`The ${getAppTitle(context)} - command context for the current application.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useCommand\" returnType=\"CommandContext\">\n {code`const result = unstable_commandStore.getStore();\nif (!result) {\n throw new Error(\n \\`The ${getAppTitle(context)} - command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n}\nreturn result;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility hook function to get the individual segments of the current command path.\">\n <TSDocReturns>{\"An array of command path segments.\"}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"useSegments\" returnType=\"string[]\">\n {code`return useCommand().segments;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A utility hook function to get the full command path as a string.\">\n <TSDocReturns>\n {`The full command path as a string. For example, if the user runs \\`${getAppBin(\n context\n )} foo bar\\`, this would return \\`\"foo bar\"\\`. This is useful for commands that need to know their full invocation path, such as for help text or for commands that have dynamic behavior based on their position in the command hierarchy.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"usePath\" returnType=\"string\">\n {code`return useCommand().path;`}\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 <TSDoc heading=\"A utility function to determine if the help flag is present or if the command is in an error state during preparation.\">\n <TSDocReturns>\n {`True if the help flag is present or if the command is in an error state during preparation, false otherwise. This can be used to conditionally display help text or to alter command behavior when the user is likely seeking help.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"isHelp\" returnType=\"boolean\">\n {code`return !isCI && (hasFlag([\"help\", \"h\", \"?\"]) || (useStatus() === \"preparing\" && useState().isError)); `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility function to wrap the ${getAppTitle(\n context\n )} application within the global context scope.`}>\n <TSDocParam name=\"handler\">\n {`The callback function to run within the global context scope. This function will receive the global context as its argument, allowing it to access any properties or utilities defined on the context. The callback function can be asynchronous and can return a value or a promise.`}\n </TSDocParam>\n <TSDocReturns>\n {`The result of the callback function, which can be a value or a promise that resolves to a value.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"withGlobal\"\n parameters={[{ name: \"handler\", type: \"() => any\" }]}\n returnType=\"Promise<void>\">\n <VarDeclaration\n const\n name=\"args\"\n initializer={code`getInputArgs(); `}\n />\n <Spacing />\n <OptionsParserLogic\n options={options.value}\n appSpecificEnvPrefix={context.config.appSpecificEnvPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <Spacing />\n {code`\n return unstable_globalStore.run({ options, inputArgs: args, state: { executionId: randomUUID(), status: \"initializing\", isError: false, meta: new Map() } as GlobalContextState }, handler);`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc\n heading={`A utility function to wrap a ${getAppTitle(\n context\n )} application command handler within the command context scope.`}>\n <TSDocParam name=\"handler\">\n {`The callback function to run within the command context scope. This function will receive the command context as its argument, allowing it to access any properties or utilities defined on the context. The callback function can be asynchronous and can return a value or a promise.`}\n </TSDocParam>\n <TSDocReturns>\n {`The result of the callback function, which can be a value or a promise that resolves to a value.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"withCommand\"\n typeParameters={[\n {\n name: \"THandler\",\n extends: \"(this: CommandContext, ...params: any[]) => any\",\n default: \"(this: CommandContext, ...params: any[]) => any\"\n }\n ]}\n parameters={[\n { name: \"path\", type: \"string\" },\n { name: \"segments\", type: \"string[]\" },\n { name: \"params\", type: \"Parameters<THandler>\" },\n { name: \"handler\", type: \"THandler\" }\n ]}\n returnType=\"Promise<{ error: string | Error | null }>\">\n {code`setState({ status: \"preparing\", isError: false });\n\n const ctx = { path, segments, params } as CommandContext<THandler>;\n const result = await Promise.resolve(unstable_commandStore.run(ctx, () => Reflect.apply(handler, ctx, params)));\n if (result instanceof Error || (typeof result === \"object\" && ((result as { error: unknown }).error instanceof Error || typeof (result as { error: unknown }).error === \"string\"))) {\n setState({ status: \"completed\", isError: true });\n return { error: result instanceof Error ? result : (result as { error: Error | string }).error };\n }\n\n setState({ status: \"completed\", isError: false });\n return { error: null }; `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface StateBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * A built-in module for handling application state utilities in Shell Shock.\n */\nexport function StateBuiltin(props: StateBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"state\"\n description=\"A module that provides context hooks and utilities for accessing the application state.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:async_hooks\": [\"AsyncLocalStorage\"],\n \"node:crypto\": [\"randomUUID\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n env: [\"isCI\", \"env\"]\n })}>\n <GlobalTypeDefinitions />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <ContextUtilities />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAG;CAAM;CAAS;CAAQ;;;;;;;AAE3C,SAAM,aAAS,IAAW,MAAM;AAC/B,IAAG,SAAU;AACb,QAAQ;;AA8BT,SAAE,wBAAA;CACA,MAAM,WAAW,cAAc,IAAA,CAAA,CAAA,WAAW,OAAW,CAAA,EAAA,eAAM;CAC7D,MAAO,UAAW,eAAK,gBAAA,QAAA,QAAA,CAAA;AACvB,QAAS;EAAA,gBAAkB,OAAQ,EACnC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ACC,MAAI;KACL;IAAC;KACA,MAAI;KACJ,MAAA;KACD;IAAE;KACD,MAAG;KACH,MAAE;KACH;IAAC;KACA,MAAM;KACN,MAAG;KACJ;IAAC;GACF,YAAY;GACZ,UAAG,IAAA"}
|
|
@@ -7,6 +7,25 @@ let _alloy_js_core = require("@alloy-js/core");
|
|
|
7
7
|
let _stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
|
|
8
8
|
|
|
9
9
|
//#region src/components/usage.tsx
|
|
10
|
+
function __assignType(fn, args) {
|
|
11
|
+
fn.__type = args;
|
|
12
|
+
return fn;
|
|
13
|
+
}
|
|
14
|
+
const __ΩUsageProps = [
|
|
15
|
+
"CommandTree",
|
|
16
|
+
"command",
|
|
17
|
+
"The command to generate help for.",
|
|
18
|
+
"npm",
|
|
19
|
+
"yarn",
|
|
20
|
+
"pnpm",
|
|
21
|
+
"bun",
|
|
22
|
+
"packageManager",
|
|
23
|
+
"The package manager to generate the usage example for.",
|
|
24
|
+
"bin",
|
|
25
|
+
"The bin name to use in the usage display.",
|
|
26
|
+
"UsageProps",
|
|
27
|
+
"P\"w!4\"?#P.$.%.&.'J4(8?)&4*?+Mw,y"
|
|
28
|
+
];
|
|
10
29
|
/**
|
|
11
30
|
* A component that generates the usage display for a command.
|
|
12
31
|
*/
|
|
@@ -34,7 +53,15 @@ function Usage(props) {
|
|
|
34
53
|
})
|
|
35
54
|
];
|
|
36
55
|
} }),
|
|
37
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${bin}${command.segments.length > 0 ? ` ${command.segments.map((segment) => require_context_helpers.isDynamicPathSegment(segment) ? `[${(0, _stryke_string_format_snake_case.snakeCase)(require_context_helpers.getDynamicPathSegmentName(segment))}]` : segment
|
|
56
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${bin}${command.segments.length > 0 ? ` ${command.segments.map(__assignType((segment) => require_context_helpers.isDynamicPathSegment(segment) ? `[${(0, _stryke_string_format_snake_case.snakeCase)(require_context_helpers.getDynamicPathSegmentName(segment))}]` : segment, [
|
|
57
|
+
"segment",
|
|
58
|
+
"",
|
|
59
|
+
"P\"2!\"/\""
|
|
60
|
+
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " [commands]" : ""}${command.args.length > 0 ? ` ${command.args.map(__assignType((param) => `<${(0, _stryke_string_format_snake_case.snakeCase)(param.name)}${(param.kind === require_types_command.CommandParameterKinds.string || param.kind === require_types_command.CommandParameterKinds.number) && param.variadic ? "..." : ""}>`, [
|
|
61
|
+
"param",
|
|
62
|
+
"",
|
|
63
|
+
"P\"2!\"/\""
|
|
64
|
+
])).join(" ")}` : ""} [options]`),
|
|
38
65
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
39
66
|
get when() {
|
|
40
67
|
return command.args.length > 0;
|
|
@@ -63,12 +90,28 @@ function Usage(props) {
|
|
|
63
90
|
})
|
|
64
91
|
];
|
|
65
92
|
} }),
|
|
66
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${bin}${command.segments.length > 0 ? ` ${command.segments.map((segment) => require_context_helpers.isDynamicPathSegment(segment) ? `[${(0, _stryke_string_format_snake_case.snakeCase)(require_context_helpers.getDynamicPathSegmentName(segment))}]` : segment
|
|
93
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`${bin}${command.segments.length > 0 ? ` ${command.segments.map(__assignType((segment) => require_context_helpers.isDynamicPathSegment(segment) ? `[${(0, _stryke_string_format_snake_case.snakeCase)(require_context_helpers.getDynamicPathSegmentName(segment))}]` : segment, [
|
|
94
|
+
"segment",
|
|
95
|
+
"",
|
|
96
|
+
"P\"2!\"/\""
|
|
97
|
+
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " [commands]" : ""} [options] ${command.args.length > 0 ? ` ${command.args.map(__assignType((param) => `<${(0, _stryke_string_format_snake_case.snakeCase)(param.name)}${(param.kind === require_types_command.CommandParameterKinds.string || param.kind === require_types_command.CommandParameterKinds.number) && param.variadic ? "..." : ""}>`, [
|
|
98
|
+
"param",
|
|
99
|
+
"",
|
|
100
|
+
"P\"2!\"/\""
|
|
101
|
+
])).join(" ")}` : ""}`)
|
|
67
102
|
];
|
|
68
103
|
}
|
|
69
104
|
})
|
|
70
105
|
];
|
|
71
106
|
}
|
|
107
|
+
Usage.__type = [
|
|
108
|
+
() => __ΩUsageProps,
|
|
109
|
+
"props",
|
|
110
|
+
"Usage",
|
|
111
|
+
"A component that generates the usage display for a command.",
|
|
112
|
+
"Pn!2\"\"/#?$"
|
|
113
|
+
];
|
|
72
114
|
|
|
73
115
|
//#endregion
|
|
74
|
-
exports.Usage = Usage;
|
|
116
|
+
exports.Usage = Usage;
|
|
117
|
+
exports.__ΩUsageProps = __ΩUsageProps;
|
|
@@ -5,6 +5,25 @@ import { Match, Show, Switch, code } from "@alloy-js/core";
|
|
|
5
5
|
import { snakeCase } from "@stryke/string-format/snake-case";
|
|
6
6
|
|
|
7
7
|
//#region src/components/usage.tsx
|
|
8
|
+
function __assignType(fn, args) {
|
|
9
|
+
fn.__type = args;
|
|
10
|
+
return fn;
|
|
11
|
+
}
|
|
12
|
+
const __ΩUsageProps = [
|
|
13
|
+
"CommandTree",
|
|
14
|
+
"command",
|
|
15
|
+
"The command to generate help for.",
|
|
16
|
+
"npm",
|
|
17
|
+
"yarn",
|
|
18
|
+
"pnpm",
|
|
19
|
+
"bun",
|
|
20
|
+
"packageManager",
|
|
21
|
+
"The package manager to generate the usage example for.",
|
|
22
|
+
"bin",
|
|
23
|
+
"The bin name to use in the usage display.",
|
|
24
|
+
"UsageProps",
|
|
25
|
+
"P\"w!4\"?#P.$.%.&.'J4(8?)&4*?+Mw,y"
|
|
26
|
+
];
|
|
8
27
|
/**
|
|
9
28
|
* A component that generates the usage display for a command.
|
|
10
29
|
*/
|
|
@@ -32,7 +51,15 @@ function Usage(props) {
|
|
|
32
51
|
})
|
|
33
52
|
];
|
|
34
53
|
} }),
|
|
35
|
-
memo(() => code`${bin}${command.segments.length > 0 ? ` ${command.segments.map((segment) => isDynamicPathSegment(segment) ? `[${snakeCase(getDynamicPathSegmentName(segment))}]` : segment
|
|
54
|
+
memo(() => code`${bin}${command.segments.length > 0 ? ` ${command.segments.map(__assignType((segment) => isDynamicPathSegment(segment) ? `[${snakeCase(getDynamicPathSegmentName(segment))}]` : segment, [
|
|
55
|
+
"segment",
|
|
56
|
+
"",
|
|
57
|
+
"P\"2!\"/\""
|
|
58
|
+
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " [commands]" : ""}${command.args.length > 0 ? ` ${command.args.map(__assignType((param) => `<${snakeCase(param.name)}${(param.kind === CommandParameterKinds.string || param.kind === CommandParameterKinds.number) && param.variadic ? "..." : ""}>`, [
|
|
59
|
+
"param",
|
|
60
|
+
"",
|
|
61
|
+
"P\"2!\"/\""
|
|
62
|
+
])).join(" ")}` : ""} [options]`),
|
|
36
63
|
createComponent(Show, {
|
|
37
64
|
get when() {
|
|
38
65
|
return command.args.length > 0;
|
|
@@ -61,13 +88,28 @@ function Usage(props) {
|
|
|
61
88
|
})
|
|
62
89
|
];
|
|
63
90
|
} }),
|
|
64
|
-
memo(() => code`${bin}${command.segments.length > 0 ? ` ${command.segments.map((segment) => isDynamicPathSegment(segment) ? `[${snakeCase(getDynamicPathSegmentName(segment))}]` : segment
|
|
91
|
+
memo(() => code`${bin}${command.segments.length > 0 ? ` ${command.segments.map(__assignType((segment) => isDynamicPathSegment(segment) ? `[${snakeCase(getDynamicPathSegmentName(segment))}]` : segment, [
|
|
92
|
+
"segment",
|
|
93
|
+
"",
|
|
94
|
+
"P\"2!\"/\""
|
|
95
|
+
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " [commands]" : ""} [options] ${command.args.length > 0 ? ` ${command.args.map(__assignType((param) => `<${snakeCase(param.name)}${(param.kind === CommandParameterKinds.string || param.kind === CommandParameterKinds.number) && param.variadic ? "..." : ""}>`, [
|
|
96
|
+
"param",
|
|
97
|
+
"",
|
|
98
|
+
"P\"2!\"/\""
|
|
99
|
+
])).join(" ")}` : ""}`)
|
|
65
100
|
];
|
|
66
101
|
}
|
|
67
102
|
})
|
|
68
103
|
];
|
|
69
104
|
}
|
|
105
|
+
Usage.__type = [
|
|
106
|
+
() => __ΩUsageProps,
|
|
107
|
+
"props",
|
|
108
|
+
"Usage",
|
|
109
|
+
"A component that generates the usage display for a command.",
|
|
110
|
+
"Pn!2\"\"/#?$"
|
|
111
|
+
];
|
|
70
112
|
|
|
71
113
|
//#endregion
|
|
72
|
-
export { Usage };
|
|
114
|
+
export { Usage, __ΩUsageProps };
|
|
73
115
|
//# sourceMappingURL=usage.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.mjs","names":[],"sources":["../../src/components/usage.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, Match, Show, Switch } from \"@alloy-js/core\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"../plugin-utils/context-helpers\";\nimport type { CommandTree } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\nexport interface UsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\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 packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The bin name to use in the usage display.\n */\n bin: string;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function Usage(props: UsageProps) {\n const { command, bin, packageManager } = props;\n\n return (\n <>\n {code`$ `}\n <Switch>\n <Match when={packageManager === \"npm\"}>{`npx `}</Match>\n <Match when={packageManager === \"yarn\"}>{`yarn exec `}</Match>\n <Match when={packageManager === \"pnpm\"}>{`pnpm exec `}</Match>\n <Match when={packageManager === \"bun\"}>{`bun x `}</Match>\n </Switch>\n {code`${bin}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? \" [commands]\" : \"\"}${\n command.args.length > 0\n ? ` ${command.args\n .map(\n param =>\n `<${snakeCase(param.name)}${\n (param.kind === CommandParameterKinds.string ||\n param.kind === CommandParameterKinds.number) &&\n param.variadic\n ? \"...\"\n : \"\"\n }>`\n )\n .join(\" \")}`\n : \"\"\n } [options]`}\n <Show when={command.args.length > 0}>\n <hbr />\n {code`$ `}\n <Switch>\n <Match when={packageManager === \"npm\"}>{`npx `}</Match>\n <Match when={packageManager === \"yarn\"}>{`yarn exec `}</Match>\n <Match when={packageManager === \"pnpm\"}>{`pnpm exec `}</Match>\n <Match when={packageManager === \"bun\"}>{`bun x `}</Match>\n </Switch>\n {code`${bin}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? \" [commands]\" : \"\"} [options] ${\n command.args.length > 0\n ? ` ${command.args\n .map(\n param =>\n `<${snakeCase(param.name)}${\n (param.kind === CommandParameterKinds.string ||\n param.kind === CommandParameterKinds.number) &&\n param.variadic\n ? \"...\"\n : \"\"\n }>`\n )\n .join(\" \")}`\n : \"\"\n }`}\n </Show>\n </>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usage.mjs","names":[],"sources":["../../src/components/usage.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, Match, Show, Switch } from \"@alloy-js/core\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"../plugin-utils/context-helpers\";\nimport type { CommandTree } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\nexport interface UsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\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 packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The bin name to use in the usage display.\n */\n bin: string;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function Usage(props: UsageProps) {\n const { command, bin, packageManager } = props;\n\n return (\n <>\n {code`$ `}\n <Switch>\n <Match when={packageManager === \"npm\"}>{`npx `}</Match>\n <Match when={packageManager === \"yarn\"}>{`yarn exec `}</Match>\n <Match when={packageManager === \"pnpm\"}>{`pnpm exec `}</Match>\n <Match when={packageManager === \"bun\"}>{`bun x `}</Match>\n </Switch>\n {code`${bin}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? \" [commands]\" : \"\"}${\n command.args.length > 0\n ? ` ${command.args\n .map(\n param =>\n `<${snakeCase(param.name)}${\n (param.kind === CommandParameterKinds.string ||\n param.kind === CommandParameterKinds.number) &&\n param.variadic\n ? \"...\"\n : \"\"\n }>`\n )\n .join(\" \")}`\n : \"\"\n } [options]`}\n <Show when={command.args.length > 0}>\n <hbr />\n {code`$ `}\n <Switch>\n <Match when={packageManager === \"npm\"}>{`npx `}</Match>\n <Match when={packageManager === \"yarn\"}>{`yarn exec `}</Match>\n <Match when={packageManager === \"pnpm\"}>{`pnpm exec `}</Match>\n <Match when={packageManager === \"bun\"}>{`bun x `}</Match>\n </Switch>\n {code`${bin}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? \" [commands]\" : \"\"} [options] ${\n command.args.length > 0\n ? ` ${command.args\n .map(\n param =>\n `<${snakeCase(param.name)}${\n (param.kind === CommandParameterKinds.string ||\n param.kind === CommandParameterKinds.number) &&\n param.variadic\n ? \"...\"\n : \"\"\n }>`\n )\n .join(\" \")}`\n : \"\"\n }`}\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;AAEE,IAAG,SAAS;;;;;;;;;;;;;;;;;;;;;AA6Bd,SAAW,MAAW,OAAA;SAElB,SACA,KACD,mBACG;AACJ,QAAM;EAAA,IAAI;EAAA,gBAAwB,QAAI,EACpC,IAAA,WAAA;AACF,UAAA;IAAA,gBAA8B,OAAK;;KAEjC,UAAA;KACC,CAAG;IAAC,gBAAmB,OAAI;KAC5B,MAAA,mBAAA;KACG,UAAM;KACb,CAAA;IAAA,gBAAA,OAAA;;KAEE,UAAA;KACG,CAAA;IAAA,gBAAe,OAAc;KAChC,MAAA,mBAAA;KACK,UAAS;KACT,CAAC;IAAC;KAEP,CAAA;EAAA,WAAO,IAAA,GAAA,MAAA,QAAA,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QAAA,KAAA,SAAA,IAAA,IAAA,QAAA,KAAA,IAAA,cAAA,UAAA,IAAA,UAAA,MAAA,KAAA,IAAA,MAAA,SAAA,sBAAA,UAAA,MAAA,SAAA,sBAAA,WAAA,MAAA,WAAA,QAAA,GAAA,IAAA;MAAA;MAAA;MAAA;MAAA,CAAA,CAAA,CAAA,KAAA,IAAA,KAAA,KAAA;KAAA;;GAErB,CAAC;EAAC;;AAEL,MAAM,SAAS;OAAM;CAAe;CAAA;CAAA;CAA8B;CAAA"}
|
|
@@ -11,11 +11,38 @@ let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powe
|
|
|
11
11
|
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
12
12
|
|
|
13
13
|
//#region src/components/utils-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 __ΩUtilsBuiltinProps = [
|
|
35
|
+
() => __ΩOmit,
|
|
36
|
+
"id",
|
|
37
|
+
"description",
|
|
38
|
+
"UtilsBuiltinProps",
|
|
39
|
+
"P!P.\".#Jo!#Mw$y"
|
|
40
|
+
];
|
|
14
41
|
/**
|
|
15
42
|
* Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.
|
|
16
43
|
*/
|
|
17
44
|
function FindSuggestionsDeclaration() {
|
|
18
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
45
|
+
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
19
46
|
return [
|
|
20
47
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
21
48
|
"const": true,
|
|
@@ -209,6 +236,11 @@ function FindSuggestionsDeclaration() {
|
|
|
209
236
|
})
|
|
210
237
|
];
|
|
211
238
|
}
|
|
239
|
+
FindSuggestionsDeclaration.__type = [
|
|
240
|
+
"FindSuggestionsDeclaration",
|
|
241
|
+
"Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.",
|
|
242
|
+
"P\"/!?\""
|
|
243
|
+
];
|
|
212
244
|
/**
|
|
213
245
|
* Generates utilities for detecting terminal size and whether the process is running in the foreground, which can be used to determine how to render output (e.g., whether to use a progress bar or spinner).
|
|
214
246
|
*/
|
|
@@ -352,6 +384,11 @@ function TerminalSizeDeclaration() {
|
|
|
352
384
|
})
|
|
353
385
|
];
|
|
354
386
|
}
|
|
387
|
+
TerminalSizeDeclaration.__type = [
|
|
388
|
+
"TerminalSizeDeclaration",
|
|
389
|
+
"Generates utilities for detecting terminal size and whether the process is running in the foreground, which can be used to determine how to render output (e.g., whether to use a progress bar or spinner).",
|
|
390
|
+
"P\"/!?\""
|
|
391
|
+
];
|
|
355
392
|
/**
|
|
356
393
|
* Generates utilities for detecting terminal color support.
|
|
357
394
|
*/
|
|
@@ -382,6 +419,11 @@ function EnvSupportUtilities() {
|
|
|
382
419
|
})
|
|
383
420
|
];
|
|
384
421
|
}
|
|
422
|
+
EnvSupportUtilities.__type = [
|
|
423
|
+
"EnvSupportUtilities",
|
|
424
|
+
"Generates utilities for detecting terminal color support.",
|
|
425
|
+
"P\"/!?\""
|
|
426
|
+
];
|
|
385
427
|
/**
|
|
386
428
|
* Generates utilities for detecting terminal color support.
|
|
387
429
|
*/
|
|
@@ -579,6 +621,11 @@ function ColorSupportUtilities() {
|
|
|
579
621
|
})
|
|
580
622
|
];
|
|
581
623
|
}
|
|
624
|
+
ColorSupportUtilities.__type = [
|
|
625
|
+
"ColorSupportUtilities",
|
|
626
|
+
"Generates utilities for detecting terminal color support.",
|
|
627
|
+
"P\"/!?\""
|
|
628
|
+
];
|
|
582
629
|
/**
|
|
583
630
|
* Generates utilities for detecting terminal color support.
|
|
584
631
|
*/
|
|
@@ -687,11 +734,16 @@ function HyperlinkSupportUtilities() {
|
|
|
687
734
|
})
|
|
688
735
|
];
|
|
689
736
|
}
|
|
737
|
+
HyperlinkSupportUtilities.__type = [
|
|
738
|
+
"HyperlinkSupportUtilities",
|
|
739
|
+
"Generates utilities for detecting terminal color support.",
|
|
740
|
+
"P\"/!?\""
|
|
741
|
+
];
|
|
690
742
|
/**
|
|
691
743
|
* Generates the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.
|
|
692
744
|
*/
|
|
693
745
|
function ResolveModuleFunctionDeclaration() {
|
|
694
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
746
|
+
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
695
747
|
return [
|
|
696
748
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
697
749
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
@@ -1681,6 +1733,11 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1681
1733
|
})
|
|
1682
1734
|
];
|
|
1683
1735
|
}
|
|
1736
|
+
ResolveModuleFunctionDeclaration.__type = [
|
|
1737
|
+
"ResolveModuleFunctionDeclaration",
|
|
1738
|
+
"Generates the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.",
|
|
1739
|
+
"P\"/!?\""
|
|
1740
|
+
];
|
|
1684
1741
|
/**
|
|
1685
1742
|
* A built-in utilities module for Shell Shock.
|
|
1686
1743
|
*/
|
|
@@ -1774,6 +1831,13 @@ function UtilsBuiltin(props) {
|
|
|
1774
1831
|
}
|
|
1775
1832
|
}));
|
|
1776
1833
|
}
|
|
1834
|
+
UtilsBuiltin.__type = [
|
|
1835
|
+
() => __ΩUtilsBuiltinProps,
|
|
1836
|
+
"props",
|
|
1837
|
+
"UtilsBuiltin",
|
|
1838
|
+
"A built-in utilities module for Shell Shock.",
|
|
1839
|
+
"Pn!2\"\"/#?$"
|
|
1840
|
+
];
|
|
1777
1841
|
|
|
1778
1842
|
//#endregion
|
|
1779
1843
|
exports.ColorSupportUtilities = ColorSupportUtilities;
|
|
@@ -1782,4 +1846,5 @@ exports.FindSuggestionsDeclaration = FindSuggestionsDeclaration;
|
|
|
1782
1846
|
exports.HyperlinkSupportUtilities = HyperlinkSupportUtilities;
|
|
1783
1847
|
exports.ResolveModuleFunctionDeclaration = ResolveModuleFunctionDeclaration;
|
|
1784
1848
|
exports.TerminalSizeDeclaration = TerminalSizeDeclaration;
|
|
1785
|
-
exports.UtilsBuiltin = UtilsBuiltin;
|
|
1849
|
+
exports.UtilsBuiltin = UtilsBuiltin;
|
|
1850
|
+
exports.__ΩUtilsBuiltinProps = __ΩUtilsBuiltinProps;
|
|
@@ -8,11 +8,38 @@ import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/buil
|
|
|
8
8
|
import { TSDoc, TSDocInternal, TSDocLink, TSDocParam, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
9
9
|
|
|
10
10
|
//#region src/components/utils-builtin.tsx
|
|
11
|
+
const __ΩOmit = [
|
|
12
|
+
"T",
|
|
13
|
+
"K",
|
|
14
|
+
() => __ΩPick,
|
|
15
|
+
() => __ΩExclude,
|
|
16
|
+
"Omit",
|
|
17
|
+
"b!b\"e!!e!!ge!\"o$#o##w%y"
|
|
18
|
+
];
|
|
19
|
+
const __ΩPick = [
|
|
20
|
+
"T",
|
|
21
|
+
"K",
|
|
22
|
+
"Pick",
|
|
23
|
+
"l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
|
|
24
|
+
];
|
|
25
|
+
const __ΩExclude = [
|
|
26
|
+
"T",
|
|
27
|
+
"U",
|
|
28
|
+
"Exclude",
|
|
29
|
+
"l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
|
|
30
|
+
];
|
|
31
|
+
const __ΩUtilsBuiltinProps = [
|
|
32
|
+
() => __ΩOmit,
|
|
33
|
+
"id",
|
|
34
|
+
"description",
|
|
35
|
+
"UtilsBuiltinProps",
|
|
36
|
+
"P!P.\".#Jo!#Mw$y"
|
|
37
|
+
];
|
|
11
38
|
/**
|
|
12
39
|
* Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.
|
|
13
40
|
*/
|
|
14
41
|
function FindSuggestionsDeclaration() {
|
|
15
|
-
const context = usePowerlines();
|
|
42
|
+
const context = (usePowerlines.Ω = [["Context", "\"w!"]], usePowerlines());
|
|
16
43
|
return [
|
|
17
44
|
createComponent(VarDeclaration, {
|
|
18
45
|
"const": true,
|
|
@@ -206,6 +233,11 @@ function FindSuggestionsDeclaration() {
|
|
|
206
233
|
})
|
|
207
234
|
];
|
|
208
235
|
}
|
|
236
|
+
FindSuggestionsDeclaration.__type = [
|
|
237
|
+
"FindSuggestionsDeclaration",
|
|
238
|
+
"Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.",
|
|
239
|
+
"P\"/!?\""
|
|
240
|
+
];
|
|
209
241
|
/**
|
|
210
242
|
* Generates utilities for detecting terminal size and whether the process is running in the foreground, which can be used to determine how to render output (e.g., whether to use a progress bar or spinner).
|
|
211
243
|
*/
|
|
@@ -349,6 +381,11 @@ function TerminalSizeDeclaration() {
|
|
|
349
381
|
})
|
|
350
382
|
];
|
|
351
383
|
}
|
|
384
|
+
TerminalSizeDeclaration.__type = [
|
|
385
|
+
"TerminalSizeDeclaration",
|
|
386
|
+
"Generates utilities for detecting terminal size and whether the process is running in the foreground, which can be used to determine how to render output (e.g., whether to use a progress bar or spinner).",
|
|
387
|
+
"P\"/!?\""
|
|
388
|
+
];
|
|
352
389
|
/**
|
|
353
390
|
* Generates utilities for detecting terminal color support.
|
|
354
391
|
*/
|
|
@@ -379,6 +416,11 @@ function EnvSupportUtilities() {
|
|
|
379
416
|
})
|
|
380
417
|
];
|
|
381
418
|
}
|
|
419
|
+
EnvSupportUtilities.__type = [
|
|
420
|
+
"EnvSupportUtilities",
|
|
421
|
+
"Generates utilities for detecting terminal color support.",
|
|
422
|
+
"P\"/!?\""
|
|
423
|
+
];
|
|
382
424
|
/**
|
|
383
425
|
* Generates utilities for detecting terminal color support.
|
|
384
426
|
*/
|
|
@@ -576,6 +618,11 @@ function ColorSupportUtilities() {
|
|
|
576
618
|
})
|
|
577
619
|
];
|
|
578
620
|
}
|
|
621
|
+
ColorSupportUtilities.__type = [
|
|
622
|
+
"ColorSupportUtilities",
|
|
623
|
+
"Generates utilities for detecting terminal color support.",
|
|
624
|
+
"P\"/!?\""
|
|
625
|
+
];
|
|
579
626
|
/**
|
|
580
627
|
* Generates utilities for detecting terminal color support.
|
|
581
628
|
*/
|
|
@@ -684,11 +731,16 @@ function HyperlinkSupportUtilities() {
|
|
|
684
731
|
})
|
|
685
732
|
];
|
|
686
733
|
}
|
|
734
|
+
HyperlinkSupportUtilities.__type = [
|
|
735
|
+
"HyperlinkSupportUtilities",
|
|
736
|
+
"Generates utilities for detecting terminal color support.",
|
|
737
|
+
"P\"/!?\""
|
|
738
|
+
];
|
|
687
739
|
/**
|
|
688
740
|
* Generates the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.
|
|
689
741
|
*/
|
|
690
742
|
function ResolveModuleFunctionDeclaration() {
|
|
691
|
-
const context = usePowerlines();
|
|
743
|
+
const context = (usePowerlines.Ω = [["Context", "\"w!"]], usePowerlines());
|
|
692
744
|
return [
|
|
693
745
|
createComponent(Spacing, {}),
|
|
694
746
|
createComponent(InterfaceDeclaration, {
|
|
@@ -1678,6 +1730,11 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1678
1730
|
})
|
|
1679
1731
|
];
|
|
1680
1732
|
}
|
|
1733
|
+
ResolveModuleFunctionDeclaration.__type = [
|
|
1734
|
+
"ResolveModuleFunctionDeclaration",
|
|
1735
|
+
"Generates the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.",
|
|
1736
|
+
"P\"/!?\""
|
|
1737
|
+
];
|
|
1681
1738
|
/**
|
|
1682
1739
|
* A built-in utilities module for Shell Shock.
|
|
1683
1740
|
*/
|
|
@@ -1771,7 +1828,14 @@ function UtilsBuiltin(props) {
|
|
|
1771
1828
|
}
|
|
1772
1829
|
}));
|
|
1773
1830
|
}
|
|
1831
|
+
UtilsBuiltin.__type = [
|
|
1832
|
+
() => __ΩUtilsBuiltinProps,
|
|
1833
|
+
"props",
|
|
1834
|
+
"UtilsBuiltin",
|
|
1835
|
+
"A built-in utilities module for Shell Shock.",
|
|
1836
|
+
"Pn!2\"\"/#?$"
|
|
1837
|
+
];
|
|
1774
1838
|
|
|
1775
1839
|
//#endregion
|
|
1776
|
-
export { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, TerminalSizeDeclaration, UtilsBuiltin };
|
|
1840
|
+
export { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, TerminalSizeDeclaration, UtilsBuiltin, __ΩUtilsBuiltinProps };
|
|
1777
1841
|
//# sourceMappingURL=utils-builtin.mjs.map
|