@shell-shock/core 0.17.8 → 0.17.11
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/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/api.cjs +36 -1
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +2 -77
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +2 -76
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +35 -1
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +291 -1
- package/dist/components/command-validation-logic.cjs.map +1 -0
- package/dist/components/command-validation-logic.d.cts +1 -3
- package/dist/components/command-validation-logic.d.cts.map +1 -1
- package/dist/components/command-validation-logic.d.mts +1 -3
- package/dist/components/command-validation-logic.d.mts.map +1 -1
- package/dist/components/command-validation-logic.mjs +288 -1
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +265 -1
- package/dist/components/docs.cjs.map +1 -0
- package/dist/components/docs.d.cts +4 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +4 -5
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs +256 -1
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/exec-builtin.cjs +429 -15
- package/dist/components/exec-builtin.cjs.map +1 -0
- package/dist/components/exec-builtin.d.cts +1 -2
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts +1 -2
- package/dist/components/exec-builtin.d.mts.map +1 -1
- package/dist/components/exec-builtin.mjs +424 -15
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +119 -1
- package/dist/components/helpers.cjs.map +1 -0
- package/dist/components/helpers.d.cts +6 -8
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +6 -8
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/helpers.mjs +111 -1
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +58 -1
- package/dist/components/index.mjs +10 -1
- package/dist/components/options-parser-logic.cjs +959 -5
- package/dist/components/options-parser-logic.cjs.map +1 -0
- package/dist/components/options-parser-logic.d.cts +8 -9
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +8 -9
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs +944 -5
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +630 -8
- package/dist/components/state-builtin.cjs.map +1 -0
- package/dist/components/state-builtin.d.cts +4 -5
- package/dist/components/state-builtin.d.cts.map +1 -1
- package/dist/components/state-builtin.d.mts +4 -5
- package/dist/components/state-builtin.d.mts.map +1 -1
- package/dist/components/state-builtin.mjs +622 -8
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +116 -1
- package/dist/components/usage.cjs.map +1 -0
- package/dist/components/usage.d.cts +1 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +1 -2
- package/dist/components/usage.d.mts.map +1 -1
- package/dist/components/usage.mjs +113 -1
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +839 -33
- package/dist/components/utils-builtin.cjs.map +1 -0
- package/dist/components/utils-builtin.d.cts +7 -8
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +7 -8
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +828 -33
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +65 -1
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +29 -8
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +29 -8
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +62 -1
- package/dist/config.mjs.map +1 -1
- package/dist/contexts/command.cjs +26 -1
- package/dist/contexts/command.cjs.map +1 -0
- package/dist/contexts/command.d.cts.map +1 -1
- package/dist/contexts/command.d.mts.map +1 -1
- package/dist/contexts/command.mjs +23 -1
- package/dist/contexts/command.mjs.map +1 -1
- package/dist/contexts/index.cjs +9 -1
- package/dist/contexts/index.mjs +4 -1
- package/dist/contexts/options.cjs +63 -1
- package/dist/contexts/options.cjs.map +1 -0
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts.map +1 -1
- package/dist/contexts/options.mjs +57 -1
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/engine.cjs +138 -0
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +79 -0
- package/dist/engine.d.cts.map +1 -0
- package/dist/engine.d.mts +79 -0
- package/dist/engine.d.mts.map +1 -0
- package/dist/engine.mjs +136 -0
- package/dist/engine.mjs.map +1 -0
- package/dist/helpers/automd.cjs +70 -1
- package/dist/helpers/automd.cjs.map +1 -0
- package/dist/helpers/automd.mjs +69 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/docs-helpers.cjs +23 -1
- package/dist/helpers/docs-helpers.cjs.map +1 -0
- package/dist/helpers/docs-helpers.mjs +22 -1
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/get-framework.cjs +24 -0
- package/dist/helpers/get-framework.cjs.map +1 -0
- package/dist/helpers/get-framework.mjs +24 -0
- package/dist/helpers/get-framework.mjs.map +1 -0
- package/dist/helpers/paths.cjs +137 -1
- package/dist/helpers/paths.cjs.map +1 -0
- package/dist/helpers/paths.mjs +133 -1
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +113 -1
- package/dist/helpers/persistence.cjs.map +1 -0
- package/dist/helpers/persistence.mjs +112 -1
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +65 -1
- package/dist/helpers/update-package-json.cjs.map +1 -0
- package/dist/helpers/update-package-json.mjs +63 -1
- package/dist/helpers/update-package-json.mjs.map +1 -1
- package/dist/helpers/utilities.cjs +95 -1
- package/dist/helpers/utilities.cjs.map +1 -0
- package/dist/helpers/utilities.mjs +93 -1
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs +71 -1
- package/dist/helpers/validations.cjs.map +1 -0
- package/dist/helpers/validations.mjs +69 -1
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +123 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +80 -5
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +80 -5
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +119 -1
- package/dist/index.mjs.map +1 -0
- package/dist/package.cjs +12 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.mjs +6 -0
- package/dist/package.mjs.map +1 -0
- package/dist/plugin-utils/compute-bin.cjs +48 -1
- package/dist/plugin-utils/compute-bin.cjs.map +1 -0
- package/dist/plugin-utils/compute-bin.d.cts +2 -2
- package/dist/plugin-utils/compute-bin.d.cts.map +1 -1
- package/dist/plugin-utils/compute-bin.d.mts +2 -2
- package/dist/plugin-utils/compute-bin.d.mts.map +1 -1
- package/dist/plugin-utils/compute-bin.mjs +47 -1
- package/dist/plugin-utils/compute-bin.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +224 -1
- package/dist/plugin-utils/context-helpers.cjs.map +1 -0
- package/dist/plugin-utils/context-helpers.d.cts +4 -4
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +4 -4
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +214 -1
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +70 -1
- package/dist/plugin-utils/deepkit.cjs.map +1 -0
- package/dist/plugin-utils/deepkit.d.cts +5 -5
- package/dist/plugin-utils/deepkit.d.cts.map +1 -1
- package/dist/plugin-utils/deepkit.d.mts +5 -5
- package/dist/plugin-utils/deepkit.d.mts.map +1 -1
- package/dist/plugin-utils/deepkit.mjs +68 -1
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +112 -2
- package/dist/plugin-utils/description-helpers.cjs.map +1 -0
- package/dist/plugin-utils/description-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/description-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/description-helpers.mjs +107 -2
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +118 -1
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs +114 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +39 -1
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +2 -2
- package/dist/plugin-utils/index.mjs +10 -1
- package/dist/plugin-utils/reflect.cjs +52 -1
- package/dist/plugin-utils/reflect.cjs.map +1 -0
- package/dist/plugin-utils/reflect.d.cts.map +1 -1
- package/dist/plugin-utils/reflect.d.mts.map +1 -1
- package/dist/plugin-utils/reflect.mjs +50 -1
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +65 -1
- package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
- package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.mjs +62 -1
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +222 -1
- package/dist/plugin-utils/type-checks.cjs.map +1 -0
- package/dist/plugin-utils/type-checks.d.cts +5 -5
- package/dist/plugin-utils/type-checks.d.cts.map +1 -1
- package/dist/plugin-utils/type-checks.d.mts +5 -5
- package/dist/plugin-utils/type-checks.d.mts.map +1 -1
- package/dist/plugin-utils/type-checks.mjs +217 -1
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +495 -4
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +488 -4
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +182 -1
- package/dist/resolver/helpers.cjs.map +1 -0
- package/dist/resolver/helpers.mjs +178 -1
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/resolve.cjs +479 -1
- package/dist/resolver/resolve.cjs.map +1 -0
- package/dist/resolver/resolve.mjs +478 -1
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +402 -1
- package/dist/types/command.cjs.map +1 -0
- package/dist/types/command.d.cts +61 -119
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +61 -119
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +367 -1
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +175 -1
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +19 -12
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +19 -12
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +163 -1
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +45 -1
- package/dist/types/context.cjs.map +1 -0
- package/dist/types/context.d.cts +3 -2
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +3 -2
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/context.mjs +40 -1
- package/dist/types/context.mjs.map +1 -1
- package/dist/types/env.cjs +53 -1
- package/dist/types/env.cjs.map +1 -0
- package/dist/types/env.d.cts +1 -1
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts +1 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/env.mjs +50 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/index.cjs +53 -1
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +6 -1
- package/dist/types/options.cjs +13 -1
- package/dist/types/options.cjs.map +1 -0
- package/dist/types/options.d.cts.map +1 -1
- package/dist/types/options.d.mts.map +1 -1
- package/dist/types/options.mjs +10 -1
- package/dist/types/options.mjs.map +1 -1
- package/package.json +43 -34
- package/dist/resolver/deepkit.cjs +0 -1
- package/dist/resolver/deepkit.mjs +0 -2
- package/dist/resolver/deepkit.mjs.map +0 -1
- package/dist/resolver/module.cjs +0 -1
- package/dist/resolver/module.mjs +0 -2
- package/dist/resolver/module.mjs.map +0 -1
|
@@ -1,21 +1,581 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
|
|
4
|
+
const require_contexts_options = require('../contexts/options.cjs');
|
|
5
|
+
require('../plugin-utils/index.cjs');
|
|
6
|
+
const require_components_options_parser_logic = require('./options-parser-logic.cjs');
|
|
7
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
8
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
9
|
+
let defu = require("defu");
|
|
10
|
+
defu = require_runtime.__toESM(defu);
|
|
11
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
12
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
13
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
14
|
+
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
15
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
16
|
+
|
|
17
|
+
//#region src/components/state-builtin.tsx
|
|
18
|
+
const __ΩOmit = [
|
|
19
|
+
"T",
|
|
20
|
+
"K",
|
|
21
|
+
() => __ΩPick,
|
|
22
|
+
() => __ΩExclude,
|
|
23
|
+
"Omit",
|
|
24
|
+
"b!b\"e!!e!!ge!\"o$#o##w%y"
|
|
25
|
+
];
|
|
26
|
+
const __ΩPick = [
|
|
27
|
+
"T",
|
|
28
|
+
"K",
|
|
29
|
+
"Pick",
|
|
30
|
+
"l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
|
|
31
|
+
];
|
|
32
|
+
const __ΩExclude = [
|
|
33
|
+
"T",
|
|
34
|
+
"U",
|
|
35
|
+
"Exclude",
|
|
36
|
+
"l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
|
|
37
|
+
];
|
|
38
|
+
function __assignType(fn, args) {
|
|
39
|
+
fn.__type = args;
|
|
40
|
+
return fn;
|
|
41
|
+
}
|
|
42
|
+
function GlobalTypeDefinitions() {
|
|
43
|
+
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
44
|
+
const options = (0, _alloy_js_core.computed)(() => require_contexts_options.computedOptions(context.globalOptions));
|
|
45
|
+
return [
|
|
46
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
47
|
+
return `An object representing the global options available for every command in the ${require_context_helpers.getAppTitle(context, true)} command-line application.`;
|
|
48
|
+
} }),
|
|
49
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
50
|
+
"export": true,
|
|
51
|
+
name: "GlobalOptions",
|
|
52
|
+
get children() {
|
|
53
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
54
|
+
get each() {
|
|
55
|
+
return Object.values(options.value);
|
|
56
|
+
},
|
|
57
|
+
hardline: true,
|
|
58
|
+
get children() {
|
|
59
|
+
return __assignType((option) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_options_parser_logic.OptionsMember, { option }), [
|
|
60
|
+
"option",
|
|
61
|
+
"",
|
|
62
|
+
"P\"2!\"/\""
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
69
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The context object for the current command execution, containing the command path and segments." }),
|
|
70
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
71
|
+
"export": true,
|
|
72
|
+
name: "CommandContext",
|
|
73
|
+
typeParameters: [{
|
|
74
|
+
name: "THandler",
|
|
75
|
+
extends: "(...params: any[]) => any",
|
|
76
|
+
default: "any"
|
|
77
|
+
}],
|
|
78
|
+
get children() {
|
|
79
|
+
return [
|
|
80
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
81
|
+
return `The full command path as a string. For example, if the user runs \`${require_context_helpers.getAppBin(context)} 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.`;
|
|
82
|
+
} }),
|
|
83
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
84
|
+
name: "path",
|
|
85
|
+
type: "string"
|
|
86
|
+
}),
|
|
87
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
88
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
89
|
+
return `An array of command path segments. For example, if the user runs \`${require_context_helpers.getAppBin(context)} 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.`;
|
|
90
|
+
} }),
|
|
91
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
92
|
+
name: "segments",
|
|
93
|
+
type: "string[]"
|
|
94
|
+
}),
|
|
95
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
96
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: `The parameters for the current command's handler function.` }),
|
|
97
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
98
|
+
name: "params",
|
|
99
|
+
type: "Parameters<THandler>"
|
|
100
|
+
})
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
105
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeDeclaration, {
|
|
106
|
+
"export": true,
|
|
107
|
+
name: "GlobalContextStatus",
|
|
108
|
+
children: _alloy_js_core.code`"initializing" | "preparing" | "executing" | "completed"`
|
|
109
|
+
}),
|
|
110
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
111
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
112
|
+
return `The state object for the ${require_context_helpers.getAppTitle(context)} application context.`;
|
|
113
|
+
} }),
|
|
114
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
115
|
+
"export": true,
|
|
116
|
+
name: "GlobalContextState",
|
|
117
|
+
get children() {
|
|
118
|
+
return [
|
|
119
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The unique identifier for the current execution context." }),
|
|
120
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
121
|
+
name: "executionId",
|
|
122
|
+
type: "string"
|
|
123
|
+
}),
|
|
124
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
125
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The status of the current execution context." }),
|
|
126
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
127
|
+
name: "status",
|
|
128
|
+
type: "GlobalContextStatus"
|
|
129
|
+
}),
|
|
130
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
131
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Indicates whether the current execution context has encountered an error." }),
|
|
132
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
133
|
+
name: "isError",
|
|
134
|
+
type: "boolean"
|
|
135
|
+
}),
|
|
136
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
137
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "A map containing arbitrary data associated with the current execution context." }),
|
|
138
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
139
|
+
name: "meta",
|
|
140
|
+
type: "Map<string, unknown>"
|
|
141
|
+
})
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
}),
|
|
145
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
146
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { get heading() {
|
|
147
|
+
return `The context object for the ${require_context_helpers.getAppTitle(context)} application.`;
|
|
148
|
+
} }),
|
|
149
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
150
|
+
"export": true,
|
|
151
|
+
name: "GlobalContext",
|
|
152
|
+
get children() {
|
|
153
|
+
return [
|
|
154
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The global options shared across all commands in the application." }),
|
|
155
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
156
|
+
name: "options",
|
|
157
|
+
type: "GlobalOptions"
|
|
158
|
+
}),
|
|
159
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
160
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The raw command-line arguments passed to the application." }),
|
|
161
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
162
|
+
name: "inputArgs",
|
|
163
|
+
type: "string[]"
|
|
164
|
+
}),
|
|
165
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
166
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "The state of the current execution context." }),
|
|
167
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
168
|
+
name: "state",
|
|
169
|
+
type: "GlobalContextState"
|
|
170
|
+
})
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
GlobalTypeDefinitions.__type = ["GlobalTypeDefinitions", "P\"/!"];
|
|
177
|
+
/**
|
|
178
|
+
* Generates utilities for detecting terminal color support.
|
|
179
|
+
*/
|
|
180
|
+
function ArgsUtilities() {
|
|
181
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
182
|
+
heading: "Retrieves the command-line arguments from Deno or Node.js environments.",
|
|
183
|
+
get children() {
|
|
184
|
+
return [
|
|
185
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function is only intended for internal use. Please use \`useArgs()\` instead.` }),
|
|
186
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
187
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocInternal, {}),
|
|
188
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
189
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `An array of command-line arguments from Deno or Node.js environments.` })
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
193
|
+
name: "getInputArgs",
|
|
194
|
+
returnType: "string[]",
|
|
195
|
+
children: _alloy_js_core.code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`
|
|
196
|
+
})];
|
|
197
|
+
}
|
|
198
|
+
ArgsUtilities.__type = [
|
|
199
|
+
"ArgsUtilities",
|
|
200
|
+
"Generates utilities for detecting terminal color support.",
|
|
201
|
+
"P\"/!?\""
|
|
202
|
+
];
|
|
203
|
+
function ContextUtilities() {
|
|
204
|
+
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
205
|
+
const options = (0, _alloy_js_core.computed)(() => Object.fromEntries(context.globalOptions.map(__assignType((option) => [option.name, option], [
|
|
206
|
+
"option",
|
|
207
|
+
"",
|
|
208
|
+
"P\"2!\"/\""
|
|
209
|
+
]))));
|
|
210
|
+
return [
|
|
211
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
212
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
213
|
+
get heading() {
|
|
214
|
+
return `The global ${require_context_helpers.getAppTitle(context)} application context store instance.`;
|
|
215
|
+
},
|
|
216
|
+
get children() {
|
|
217
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocInternal, {});
|
|
218
|
+
}
|
|
219
|
+
}),
|
|
220
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
221
|
+
"export": true,
|
|
222
|
+
"const": true,
|
|
223
|
+
name: "unstable_globalStore",
|
|
224
|
+
children: _alloy_js_core.code` new AsyncLocalStorage<GlobalContext>({ name: "globalStore" }); `
|
|
225
|
+
}),
|
|
226
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
227
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
228
|
+
get heading() {
|
|
229
|
+
return `Get the ${require_context_helpers.getAppTitle(context)} application context for the current application.`;
|
|
230
|
+
},
|
|
231
|
+
get children() {
|
|
232
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { get children() {
|
|
233
|
+
return `The ${require_context_helpers.getAppTitle(context)} application context for the current application or undefined if the context is not available.`;
|
|
234
|
+
} });
|
|
235
|
+
}
|
|
236
|
+
}),
|
|
237
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
238
|
+
"export": true,
|
|
239
|
+
name: "useGlobal",
|
|
240
|
+
returnType: "GlobalContext",
|
|
241
|
+
children: _alloy_js_core.code`return unstable_globalStore.getStore() as GlobalContext;`
|
|
242
|
+
}),
|
|
243
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
244
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
245
|
+
get heading() {
|
|
246
|
+
return `A utility hook function to get the command-line arguments from the ${require_context_helpers.getAppTitle(context)} application context.`;
|
|
247
|
+
},
|
|
248
|
+
get children() {
|
|
249
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "An array of command-line arguments from the application context." });
|
|
250
|
+
}
|
|
251
|
+
}),
|
|
252
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
253
|
+
"export": true,
|
|
254
|
+
name: "useArgs",
|
|
255
|
+
returnType: "string[]",
|
|
256
|
+
children: _alloy_js_core.code`return useGlobal()?.inputArgs ?? getInputArgs();`
|
|
257
|
+
}),
|
|
258
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
259
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
260
|
+
get heading() {
|
|
261
|
+
return `A utility hook function to get the command-line global options from the ${require_context_helpers.getAppTitle(context)} application context.`;
|
|
262
|
+
},
|
|
263
|
+
get children() {
|
|
264
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "An object containing the global options from the application context." });
|
|
265
|
+
}
|
|
266
|
+
}),
|
|
267
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
268
|
+
"export": true,
|
|
269
|
+
name: "useGlobalOptions",
|
|
270
|
+
returnType: "GlobalOptions",
|
|
271
|
+
children: _alloy_js_core.code`return useGlobal()?.options ?? {};`
|
|
272
|
+
}),
|
|
273
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
274
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
275
|
+
get heading() {
|
|
276
|
+
return `A utility hook function to get the state of the ${require_context_helpers.getAppTitle(context)} application context.`;
|
|
277
|
+
},
|
|
278
|
+
get children() {
|
|
279
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "The state of the application context." });
|
|
280
|
+
}
|
|
281
|
+
}),
|
|
282
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
283
|
+
"export": true,
|
|
284
|
+
name: "useState",
|
|
285
|
+
returnType: "GlobalContextState",
|
|
286
|
+
children: _alloy_js_core.code`return useGlobal()?.state;`
|
|
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, {
|
|
290
|
+
get heading() {
|
|
291
|
+
return `A utility function to update the state of the ${require_context_helpers.getAppTitle(context)} application context.`;
|
|
292
|
+
},
|
|
293
|
+
get children() {
|
|
294
|
+
return [
|
|
295
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `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.` }),
|
|
296
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
297
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
298
|
+
name: "update",
|
|
299
|
+
children: `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.`
|
|
300
|
+
})
|
|
301
|
+
];
|
|
302
|
+
}
|
|
303
|
+
}),
|
|
304
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
305
|
+
"export": true,
|
|
306
|
+
name: "setState",
|
|
307
|
+
parameters: [{
|
|
308
|
+
name: "update",
|
|
309
|
+
type: "Partial<GlobalContextState> | ((prev: GlobalContextState) => GlobalContextState)"
|
|
310
|
+
}],
|
|
311
|
+
get children() {
|
|
312
|
+
return _alloy_js_core.code`const prev = useGlobal()?.state;
|
|
2
313
|
if (!prev) {
|
|
3
314
|
throw new Error(
|
|
4
|
-
\`The ${
|
|
315
|
+
\`The ${require_context_helpers.getAppTitle(context)} application context is not available. Make sure to call setState() within a valid context scope.\`
|
|
5
316
|
);
|
|
6
317
|
}
|
|
7
318
|
|
|
8
|
-
useGlobal().state = typeof update === "function" ? update(prev) : { ...prev, ...update };
|
|
319
|
+
useGlobal().state = typeof update === "function" ? update(prev) : { ...prev, ...update }; `;
|
|
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, {
|
|
324
|
+
get heading() {
|
|
325
|
+
return `A utility hook function to get the execution ID of the ${require_context_helpers.getAppTitle(context)} application context.`;
|
|
326
|
+
},
|
|
327
|
+
get children() {
|
|
328
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "The execution ID of the application context." });
|
|
329
|
+
}
|
|
330
|
+
}),
|
|
331
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
332
|
+
"export": true,
|
|
333
|
+
name: "useExecutionId",
|
|
334
|
+
returnType: "string",
|
|
335
|
+
children: _alloy_js_core.code`return useState().executionId;`
|
|
336
|
+
}),
|
|
337
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
338
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
339
|
+
get heading() {
|
|
340
|
+
return `A utility hook function to get the metadata of the ${require_context_helpers.getAppTitle(context)} application context.`;
|
|
341
|
+
},
|
|
342
|
+
get children() {
|
|
343
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "The metadata of the application context." });
|
|
344
|
+
}
|
|
345
|
+
}),
|
|
346
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
347
|
+
"export": true,
|
|
348
|
+
name: "useMeta",
|
|
349
|
+
returnType: "Map<string, unknown>",
|
|
350
|
+
children: _alloy_js_core.code`return useState().meta;`
|
|
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, {
|
|
354
|
+
get heading() {
|
|
355
|
+
return `A utility hook function to get the current status of the ${require_context_helpers.getAppTitle(context)} application.`;
|
|
356
|
+
},
|
|
357
|
+
get children() {
|
|
358
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "The current status of the application." });
|
|
359
|
+
}
|
|
360
|
+
}),
|
|
361
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
362
|
+
"export": true,
|
|
363
|
+
name: "useStatus",
|
|
364
|
+
returnType: "GlobalContextStatus",
|
|
365
|
+
children: _alloy_js_core.code`return useState().status;`
|
|
366
|
+
}),
|
|
367
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
368
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
369
|
+
get heading() {
|
|
370
|
+
return `The global ${require_context_helpers.getAppTitle(context)} - command context store instance.`;
|
|
371
|
+
},
|
|
372
|
+
get children() {
|
|
373
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocInternal, {});
|
|
374
|
+
}
|
|
375
|
+
}),
|
|
376
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
377
|
+
"export": true,
|
|
378
|
+
name: "unstable_commandStore",
|
|
379
|
+
children: _alloy_js_core.code`new AsyncLocalStorage<CommandContext>({ name: "commandStore" });`
|
|
380
|
+
}),
|
|
381
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
382
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
383
|
+
get heading() {
|
|
384
|
+
return `Get the ${require_context_helpers.getAppTitle(context)} - command context for the current application.`;
|
|
385
|
+
},
|
|
386
|
+
get children() {
|
|
387
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { get children() {
|
|
388
|
+
return `The ${require_context_helpers.getAppTitle(context)} - command context for the current application.`;
|
|
389
|
+
} });
|
|
390
|
+
}
|
|
391
|
+
}),
|
|
392
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
393
|
+
"export": true,
|
|
394
|
+
name: "useCommand",
|
|
395
|
+
returnType: "CommandContext",
|
|
396
|
+
get children() {
|
|
397
|
+
return _alloy_js_core.code`const result = unstable_commandStore.getStore();
|
|
9
398
|
if (!result) {
|
|
10
399
|
throw new Error(
|
|
11
|
-
\`The ${
|
|
400
|
+
\`The ${require_context_helpers.getAppTitle(context)} - command context is not available. Make sure to call useCommand() within a valid context scope.\`
|
|
12
401
|
);
|
|
13
402
|
}
|
|
14
|
-
return result
|
|
403
|
+
return result;`;
|
|
404
|
+
}
|
|
405
|
+
}),
|
|
406
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
407
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
408
|
+
heading: "A utility hook function to get the individual segments of the current command path.",
|
|
409
|
+
get children() {
|
|
410
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "An array of command path segments." });
|
|
411
|
+
}
|
|
412
|
+
}),
|
|
413
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
414
|
+
"export": true,
|
|
415
|
+
name: "useSegments",
|
|
416
|
+
returnType: "string[]",
|
|
417
|
+
children: _alloy_js_core.code`return useCommand().segments;`
|
|
418
|
+
}),
|
|
419
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
420
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
421
|
+
heading: "A utility hook function to get the full command path as a string.",
|
|
422
|
+
get children() {
|
|
423
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { get children() {
|
|
424
|
+
return `The full command path as a string. For example, if the user runs \`${require_context_helpers.getAppBin(context)} 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.`;
|
|
425
|
+
} });
|
|
426
|
+
}
|
|
427
|
+
}),
|
|
428
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
429
|
+
"export": true,
|
|
430
|
+
name: "usePath",
|
|
431
|
+
returnType: "string",
|
|
432
|
+
children: _alloy_js_core.code`return useCommand().path;`
|
|
433
|
+
}),
|
|
434
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
435
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
436
|
+
heading: "Checks if a specific flag is present in the command-line arguments.",
|
|
437
|
+
get children() {
|
|
438
|
+
return [
|
|
439
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: "https://github.com/sindresorhus/has-flag/blob/main/index.js" }),
|
|
440
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
441
|
+
name: "flag",
|
|
442
|
+
children: "The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\"."
|
|
443
|
+
}),
|
|
444
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
445
|
+
name: "argv",
|
|
446
|
+
children: "The command-line arguments to check against. Defaults to global Deno args or process args."
|
|
447
|
+
}),
|
|
448
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "True if the flag is present, false otherwise." })
|
|
449
|
+
];
|
|
450
|
+
}
|
|
451
|
+
}),
|
|
452
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
453
|
+
"export": true,
|
|
454
|
+
name: "hasFlag",
|
|
455
|
+
parameters: [{
|
|
456
|
+
name: "flag",
|
|
457
|
+
type: "string | string[]"
|
|
458
|
+
}, {
|
|
459
|
+
name: "argv",
|
|
460
|
+
type: "string[]",
|
|
461
|
+
default: "useArgs()"
|
|
462
|
+
}],
|
|
463
|
+
get children() {
|
|
464
|
+
return [
|
|
465
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
466
|
+
"const": true,
|
|
467
|
+
name: "position",
|
|
468
|
+
type: "number",
|
|
469
|
+
initializer: _alloy_js_core.code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {
|
|
15
470
|
const pos = argv.findIndex(arg => (f.startsWith("-") ? "" : (f.length === 1 ? "-" : "--") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? "-" : "--") + f + "="));
|
|
16
471
|
return pos !== -1 ? pos : ret;
|
|
17
|
-
}, -1);`
|
|
18
|
-
|
|
472
|
+
}, -1);`
|
|
473
|
+
}),
|
|
474
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
475
|
+
_alloy_js_core.code`return position !== -1 && argv.indexOf("--") === -1 || position < argv.indexOf("--");`
|
|
476
|
+
];
|
|
477
|
+
}
|
|
478
|
+
}),
|
|
479
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
480
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
481
|
+
heading: "A utility function to determine if the help flag is present or if the command is in an error state during preparation.",
|
|
482
|
+
get children() {
|
|
483
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `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.` });
|
|
484
|
+
}
|
|
485
|
+
}),
|
|
486
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
487
|
+
"export": true,
|
|
488
|
+
name: "isHelp",
|
|
489
|
+
returnType: "boolean",
|
|
490
|
+
children: _alloy_js_core.code`return !isCI && (hasFlag(["help", "h", "?"]) || (useStatus() === "preparing" && useState().isError)); `
|
|
491
|
+
}),
|
|
492
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
493
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
494
|
+
get heading() {
|
|
495
|
+
return `A utility function to wrap the ${require_context_helpers.getAppTitle(context)} application within the global context scope.`;
|
|
496
|
+
},
|
|
497
|
+
get children() {
|
|
498
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
499
|
+
name: "handler",
|
|
500
|
+
children: `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.`
|
|
501
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The result of the callback function, which can be a value or a promise that resolves to a value.` })];
|
|
502
|
+
}
|
|
503
|
+
}),
|
|
504
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
505
|
+
"export": true,
|
|
506
|
+
async: true,
|
|
507
|
+
name: "withGlobal",
|
|
508
|
+
parameters: [{
|
|
509
|
+
name: "handler",
|
|
510
|
+
type: "() => any"
|
|
511
|
+
}],
|
|
512
|
+
returnType: "Promise<void>",
|
|
513
|
+
get children() {
|
|
514
|
+
return [
|
|
515
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
516
|
+
"const": true,
|
|
517
|
+
name: "args",
|
|
518
|
+
initializer: _alloy_js_core.code`getInputArgs(); `
|
|
519
|
+
}),
|
|
520
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
521
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_options_parser_logic.OptionsParserLogic, {
|
|
522
|
+
get options() {
|
|
523
|
+
return options.value;
|
|
524
|
+
},
|
|
525
|
+
get appSpecificEnvPrefix() {
|
|
526
|
+
return context.config.appSpecificEnvPrefix;
|
|
527
|
+
},
|
|
528
|
+
get isCaseSensitive() {
|
|
529
|
+
return context.config.isCaseSensitive;
|
|
530
|
+
}
|
|
531
|
+
}),
|
|
532
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
533
|
+
_alloy_js_core.code`
|
|
534
|
+
return unstable_globalStore.run({ options, inputArgs: args, state: { executionId: randomUUID(), status: "initializing", isError: false, meta: new Map() } as GlobalContextState }, handler);`
|
|
535
|
+
];
|
|
536
|
+
}
|
|
537
|
+
}),
|
|
538
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
539
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
540
|
+
get heading() {
|
|
541
|
+
return `A utility function to wrap a ${require_context_helpers.getAppTitle(context)} application command handler within the command context scope.`;
|
|
542
|
+
},
|
|
543
|
+
get children() {
|
|
544
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
545
|
+
name: "handler",
|
|
546
|
+
children: `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.`
|
|
547
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The result of the callback function, which can be a value or a promise that resolves to a value.` })];
|
|
548
|
+
}
|
|
549
|
+
}),
|
|
550
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
551
|
+
"export": true,
|
|
552
|
+
async: true,
|
|
553
|
+
name: "withCommand",
|
|
554
|
+
typeParameters: [{
|
|
555
|
+
name: "THandler",
|
|
556
|
+
extends: "(this: CommandContext, ...params: any[]) => any",
|
|
557
|
+
default: "(this: CommandContext, ...params: any[]) => any"
|
|
558
|
+
}],
|
|
559
|
+
parameters: [
|
|
560
|
+
{
|
|
561
|
+
name: "path",
|
|
562
|
+
type: "string"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
name: "segments",
|
|
566
|
+
type: "string[]"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
name: "params",
|
|
570
|
+
type: "Parameters<THandler>"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
name: "handler",
|
|
574
|
+
type: "THandler"
|
|
575
|
+
}
|
|
576
|
+
],
|
|
577
|
+
returnType: "Promise<{ error: string | Error | null }>",
|
|
578
|
+
children: _alloy_js_core.code`setState({ status: "preparing", isError: false });
|
|
19
579
|
|
|
20
580
|
const ctx = { path, segments, params } as CommandContext<THandler>;
|
|
21
581
|
const result = await Promise.resolve(unstable_commandStore.run(ctx, () => Reflect.apply(handler, ctx, params)));
|
|
@@ -25,4 +585,66 @@ return result;`}}),(0,i.createComponent)(s.Spacing,{}),(0,i.createComponent)(d.T
|
|
|
25
585
|
}
|
|
26
586
|
|
|
27
587
|
setState({ status: "completed", isError: false });
|
|
28
|
-
return { error: null }; `
|
|
588
|
+
return { error: null }; `
|
|
589
|
+
})
|
|
590
|
+
];
|
|
591
|
+
}
|
|
592
|
+
ContextUtilities.__type = ["ContextUtilities", "P\"/!"];
|
|
593
|
+
const __ΩStateBuiltinProps = [
|
|
594
|
+
() => __ΩOmit,
|
|
595
|
+
"id",
|
|
596
|
+
"description",
|
|
597
|
+
"StateBuiltinProps",
|
|
598
|
+
"P!P.\".#Jo!#Mw$y"
|
|
599
|
+
];
|
|
600
|
+
/**
|
|
601
|
+
* A built-in module for handling application state utilities in Shell Shock.
|
|
602
|
+
*/
|
|
603
|
+
function StateBuiltin(props) {
|
|
604
|
+
const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
|
|
605
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
606
|
+
id: "state",
|
|
607
|
+
description: "A module that provides context hooks and utilities for accessing the application state."
|
|
608
|
+
}, rest, {
|
|
609
|
+
get imports() {
|
|
610
|
+
return (0, defu.default)(rest.imports ?? {}, {
|
|
611
|
+
"node:async_hooks": ["AsyncLocalStorage"],
|
|
612
|
+
"node:crypto": ["randomUUID"]
|
|
613
|
+
});
|
|
614
|
+
},
|
|
615
|
+
get builtinImports() {
|
|
616
|
+
return (0, defu.default)(rest.builtinImports ?? {}, { env: ["isCI", "env"] });
|
|
617
|
+
},
|
|
618
|
+
get children() {
|
|
619
|
+
return [
|
|
620
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(GlobalTypeDefinitions, {}),
|
|
621
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
622
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(ArgsUtilities, {}),
|
|
623
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
624
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(ContextUtilities, {}),
|
|
625
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
626
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
627
|
+
get when() {
|
|
628
|
+
return Boolean(children);
|
|
629
|
+
},
|
|
630
|
+
children
|
|
631
|
+
})
|
|
632
|
+
];
|
|
633
|
+
}
|
|
634
|
+
}));
|
|
635
|
+
}
|
|
636
|
+
StateBuiltin.__type = [
|
|
637
|
+
() => __ΩStateBuiltinProps,
|
|
638
|
+
"props",
|
|
639
|
+
"StateBuiltin",
|
|
640
|
+
"A built-in module for handling application state utilities in Shell Shock.",
|
|
641
|
+
"Pn!2\"\"/#?$"
|
|
642
|
+
];
|
|
643
|
+
|
|
644
|
+
//#endregion
|
|
645
|
+
exports.ArgsUtilities = ArgsUtilities;
|
|
646
|
+
exports.ContextUtilities = ContextUtilities;
|
|
647
|
+
exports.GlobalTypeDefinitions = GlobalTypeDefinitions;
|
|
648
|
+
exports.StateBuiltin = StateBuiltin;
|
|
649
|
+
exports.__ΩStateBuiltinProps = __ΩStateBuiltinProps;
|
|
650
|
+
//# sourceMappingURL=state-builtin.cjs.map
|