@shell-shock/core 0.17.6 → 0.17.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/api.cjs +1 -95
- package/dist/api.d.cts +52 -4
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +52 -4
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +1 -92
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +1 -292
- package/dist/components/command-validation-logic.mjs +1 -289
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +1 -265
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs +1 -256
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/exec-builtin.cjs +13 -429
- package/dist/components/exec-builtin.mjs +13 -425
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +1 -120
- package/dist/components/helpers.mjs +1 -112
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +1 -58
- package/dist/components/index.mjs +1 -10
- package/dist/components/options-parser-logic.cjs +5 -960
- package/dist/components/options-parser-logic.d.cts +1 -1
- package/dist/components/options-parser-logic.mjs +5 -945
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/state-builtin.cjs +8 -629
- package/dist/components/state-builtin.d.cts.map +1 -1
- package/dist/components/state-builtin.d.mts.map +1 -1
- package/dist/components/state-builtin.mjs +8 -622
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +1 -117
- package/dist/components/usage.mjs +1 -114
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +33 -838
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +33 -828
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +1 -31
- package/dist/config.mjs +1 -29
- package/dist/config.mjs.map +1 -1
- package/dist/contexts/command.cjs +1 -26
- package/dist/contexts/command.mjs +1 -23
- package/dist/contexts/command.mjs.map +1 -1
- package/dist/contexts/index.cjs +1 -9
- package/dist/contexts/index.mjs +1 -4
- package/dist/contexts/options.cjs +1 -63
- package/dist/contexts/options.mjs +1 -58
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +1 -71
- package/dist/helpers/automd.mjs +1 -70
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/docs-helpers.cjs +1 -23
- package/dist/helpers/docs-helpers.mjs +1 -22
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/paths.cjs +1 -137
- package/dist/helpers/paths.mjs +1 -133
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +1 -113
- package/dist/helpers/persistence.mjs +1 -110
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +1 -59
- package/dist/helpers/update-package-json.mjs +1 -57
- package/dist/helpers/update-package-json.mjs.map +1 -1
- package/dist/helpers/utilities.cjs +1 -95
- package/dist/helpers/utilities.mjs +1 -93
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs +1 -71
- package/dist/helpers/validations.mjs +1 -71
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +1 -52
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -7
- package/dist/plugin-utils/compute-bin.cjs +1 -50
- package/dist/plugin-utils/compute-bin.mjs +1 -49
- package/dist/plugin-utils/compute-bin.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +1 -231
- package/dist/plugin-utils/context-helpers.mjs +1 -221
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +1 -71
- package/dist/plugin-utils/deepkit.mjs +1 -69
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +2 -111
- package/dist/plugin-utils/description-helpers.mjs +2 -107
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +1 -117
- package/dist/plugin-utils/get-command-tree.mjs +1 -114
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +1 -39
- package/dist/plugin-utils/index.mjs +1 -10
- package/dist/plugin-utils/reflect.cjs +1 -52
- package/dist/plugin-utils/reflect.mjs +1 -52
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +1 -64
- package/dist/plugin-utils/traverse-command-tree.mjs +1 -62
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +1 -93
- package/dist/plugin-utils/type-checks.mjs +1 -88
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +4 -429
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +4 -423
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +1 -135
- package/dist/resolver/deepkit.mjs +1 -134
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +1 -173
- package/dist/resolver/helpers.mjs +1 -168
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +1 -145
- package/dist/resolver/module.mjs +1 -144
- package/dist/resolver/module.mjs.map +1 -1
- package/dist/resolver/resolve.cjs +1 -222
- package/dist/resolver/resolve.mjs +1 -221
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +1 -441
- package/dist/types/command.mjs +1 -405
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +1 -144
- package/dist/types/config.d.cts +3 -2
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +3 -2
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +1 -138
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +1 -37
- 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 +1 -34
- package/dist/types/context.mjs.map +1 -1
- package/dist/types/env.cjs +1 -52
- package/dist/types/env.mjs +1 -50
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/index.cjs +1 -49
- package/dist/types/index.mjs +1 -6
- package/dist/types/options.cjs +1 -12
- package/dist/types/options.mjs +1 -10
- package/package.json +23 -23
|
@@ -1,53 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
-
let defu = require("defu");
|
|
5
|
-
defu = require_runtime.__toESM(defu);
|
|
6
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
7
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
10
|
-
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
11
|
-
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
12
|
-
|
|
13
|
-
//#region src/components/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
|
-
];
|
|
41
|
-
/**
|
|
42
|
-
* Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.
|
|
43
|
-
*/
|
|
44
|
-
function FindSuggestionsDeclaration() {
|
|
45
|
-
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
46
|
-
return [
|
|
47
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
48
|
-
"const": true,
|
|
49
|
-
name: "deburred",
|
|
50
|
-
initializer: _alloy_js_core.code` {
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@alloy-js/core/jsx-runtime`),n=require(`defu`);n=e.__toESM(n);let r=require(`@alloy-js/core`),i=require(`@powerlines/plugin-alloy/core/components/spacing`),a=require(`@powerlines/plugin-alloy/core/contexts/context`),o=require(`@alloy-js/typescript`),s=require(`@powerlines/plugin-alloy/typescript/components/builtin-file`),c=require(`@powerlines/plugin-alloy/typescript/components/tsdoc`);const l=[`T`,`K`,()=>u,()=>d,`Omit`,`b!b"e!!e!!ge!"o$#o##w%y`],u=[`T`,`K`,`Pick`,`l+e#!e"!fRb!b"Pde""N#!w#y`],d=[`T`,`U`,`Exclude`,`l6!Re$!RPe#!e$"qk#%QRb!b"Pde"!p)w#y`],f=[()=>l,`id`,`description`,`UtilsBuiltinProps`,`P!P.".#Jo!#Mw$y`];function p(){let e=(a.usePowerlines.Ω=[[`Context`,`"w!`]],(0,a.usePowerlines)());return[(0,t.createComponent)(o.VarDeclaration,{const:!0,name:`deburred`,initializer:r.code` {
|
|
51
2
|
"\\xc0": "A", "\\xc1": "A", "\\xc2": "A", "\\xc3": "A", "\\xc4": "A", "\\xc5": "A",
|
|
52
3
|
"\\xe0": "a", "\\xe1": "a", "\\xe2": "a", "\\xe3": "a", "\\xe4": "a", "\\xe5": "a",
|
|
53
4
|
"\\xc7": "C", "\\xe7": "c",
|
|
@@ -100,51 +51,7 @@ function FindSuggestionsDeclaration() {
|
|
|
100
51
|
"\\u0132": "IJ", "\\u0133": "ij",
|
|
101
52
|
"\\u0152": "Oe", "\\u0153": "oe",
|
|
102
53
|
"\\u0149": "n", "\\u017f": "s"
|
|
103
|
-
} as Record<string, string>; `
|
|
104
|
-
}),
|
|
105
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
106
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
107
|
-
heading: "A utility function that takes an input string and a list of possible matches, and returns a list of suggested matches based on the Levenshtein distance between the input and the possible matches.",
|
|
108
|
-
get children() {
|
|
109
|
-
return [
|
|
110
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: "This function is intended to be used to suggest corrections for potentially misspelled options or commands." }),
|
|
111
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
112
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocInternal, {}),
|
|
113
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
114
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
115
|
-
name: "input",
|
|
116
|
-
children: "The input string to check for potential matches."
|
|
117
|
-
}),
|
|
118
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
119
|
-
name: "options",
|
|
120
|
-
children: "A list of possible matches to compare against the input."
|
|
121
|
-
}),
|
|
122
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "A list of suggested matches based on the Levenshtein distance." })
|
|
123
|
-
];
|
|
124
|
-
}
|
|
125
|
-
}),
|
|
126
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
127
|
-
"export": true,
|
|
128
|
-
name: "findSuggestions",
|
|
129
|
-
parameters: [{
|
|
130
|
-
name: "input",
|
|
131
|
-
type: "string"
|
|
132
|
-
}, {
|
|
133
|
-
name: "options",
|
|
134
|
-
type: "string[]"
|
|
135
|
-
}],
|
|
136
|
-
returnType: "string[]",
|
|
137
|
-
get children() {
|
|
138
|
-
return [
|
|
139
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
140
|
-
"const": true,
|
|
141
|
-
name: "normalizedInput",
|
|
142
|
-
get initializer() {
|
|
143
|
-
return _alloy_js_core.code`String(input ?? "")${context.config.isCaseSensitive ? "" : ".toLowerCase()"}.trim().replaceAll(/[\\s\\-_\\.]+/gu, " ").replace(/[\\\\xc0-\\\\xd6\\\\xd8-\\\\xf6\\\\xf8-\\\\xff\\\\u0100-\\\\u017f]/g, key => deburred[key]).replace(/[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]/g, ""); `;
|
|
144
|
-
}
|
|
145
|
-
}),
|
|
146
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
147
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
54
|
+
} as Record<string, string>; `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`A utility function that takes an input string and a list of possible matches, and returns a list of suggested matches based on the Levenshtein distance between the input and the possible matches.`,get children(){return[(0,t.createComponent)(c.TSDocRemarks,{children:`This function is intended to be used to suggest corrections for potentially misspelled options or commands.`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(c.TSDocInternal,{}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(c.TSDocParam,{name:`input`,children:`The input string to check for potential matches.`}),(0,t.createComponent)(c.TSDocParam,{name:`options`,children:`A list of possible matches to compare against the input.`}),(0,t.createComponent)(c.TSDocReturns,{children:`A list of suggested matches based on the Levenshtein distance.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,name:`findSuggestions`,parameters:[{name:`input`,type:`string`},{name:`options`,type:`string[]`}],returnType:`string[]`,get children(){return[(0,t.createComponent)(o.VarDeclaration,{const:!0,name:`normalizedInput`,get initializer(){return r.code`String(input ?? "")${e.config.isCaseSensitive?``:`.toLowerCase()`}.trim().replaceAll(/[\\s\\-_\\.]+/gu, " ").replace(/[\\\\xc0-\\\\xd6\\\\xd8-\\\\xf6\\\\xf8-\\\\xff\\\\u0100-\\\\u017f]/g, key => deburred[key]).replace(/[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]/g, ""); `}}),(0,t.createComponent)(i.Spacing,{}),(0,t.memo)(()=>r.code`
|
|
148
55
|
if (!normalizedInput || options.length === 0) {
|
|
149
56
|
return [];
|
|
150
57
|
}
|
|
@@ -153,7 +60,7 @@ function FindSuggestionsDeclaration() {
|
|
|
153
60
|
const results: Array<{ option: string; distance: number }> = [];
|
|
154
61
|
|
|
155
62
|
for (const option of options) {
|
|
156
|
-
const normalizedOption = String(option ?? "")${
|
|
63
|
+
const normalizedOption = String(option ?? "")${e.config.isCaseSensitive?``:`.toLowerCase()`}.trim().replaceAll(/[\\s\\-_\\.]+/gu, " ").replace(/[\\\\xc0-\\\\xd6\\\\xd8-\\\\xf6\\\\xf8-\\\\xff\\\\u0100-\\\\u017f]/g, key => deburred[key]).replace(/[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]/g, "");
|
|
157
64
|
|
|
158
65
|
if (!normalizedOption) {
|
|
159
66
|
continue;
|
|
@@ -230,41 +137,7 @@ function FindSuggestionsDeclaration() {
|
|
|
230
137
|
}
|
|
231
138
|
|
|
232
139
|
return results.sort((a, b) => a.distance - b.distance).map(r => r.option);
|
|
233
|
-
`)
|
|
234
|
-
];
|
|
235
|
-
}
|
|
236
|
-
})
|
|
237
|
-
];
|
|
238
|
-
}
|
|
239
|
-
FindSuggestionsDeclaration.__type = [
|
|
240
|
-
"FindSuggestionsDeclaration",
|
|
241
|
-
"Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.",
|
|
242
|
-
"P\"/!?\""
|
|
243
|
-
];
|
|
244
|
-
/**
|
|
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).
|
|
246
|
-
*/
|
|
247
|
-
function TerminalSizeDeclaration() {
|
|
248
|
-
return [
|
|
249
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
250
|
-
"export": true,
|
|
251
|
-
"const": true,
|
|
252
|
-
name: "DEFAULT_TERMINAL_COLUMNS",
|
|
253
|
-
doc: "Default number of terminal columns",
|
|
254
|
-
initializer: _alloy_js_core.code`80`
|
|
255
|
-
}),
|
|
256
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
257
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
258
|
-
"export": true,
|
|
259
|
-
"const": true,
|
|
260
|
-
name: "DEFAULT_TERMINAL_ROWS",
|
|
261
|
-
doc: "Default number of terminal rows",
|
|
262
|
-
initializer: _alloy_js_core.code`24`
|
|
263
|
-
}),
|
|
264
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
265
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
266
|
-
name: "isForegroundProcess",
|
|
267
|
-
children: _alloy_js_core.code`if (isLinux) {
|
|
140
|
+
`)]}})]}p.__type=[`FindSuggestionsDeclaration`,"Generates the `findSuggestions` function for suggesting corrections for potentially misspelled options or commands.",`P"/!?"`];function m(){return[(0,t.createComponent)(o.VarDeclaration,{export:!0,const:!0,name:`DEFAULT_TERMINAL_COLUMNS`,doc:`Default number of terminal columns`,initializer:r.code`80`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{export:!0,const:!0,name:`DEFAULT_TERMINAL_ROWS`,doc:`Default number of terminal rows`,initializer:r.code`24`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`isForegroundProcess`,children:r.code`if (isLinux) {
|
|
268
141
|
return true;
|
|
269
142
|
}
|
|
270
143
|
|
|
@@ -291,24 +164,14 @@ function TerminalSizeDeclaration() {
|
|
|
291
164
|
return processGroupId === foregroundProcessGroupId;
|
|
292
165
|
} catch {
|
|
293
166
|
return false;
|
|
294
|
-
} `
|
|
295
|
-
}),
|
|
296
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
297
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
298
|
-
name: "tput",
|
|
299
|
-
children: _alloy_js_core.code`try {
|
|
167
|
+
} `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`tput`,children:r.code`try {
|
|
300
168
|
const columns = execSync(["tput", "cols"], { env: { TERM: 'dumb', ...process.env } });
|
|
301
169
|
const rows = execSync(["tput", "lines"], { env: { TERM: 'dumb', ...process.env } });
|
|
302
170
|
|
|
303
171
|
if (columns && rows) {
|
|
304
172
|
return { columns: Number.parseInt(columns.toString().trim(), 10), rows: Number.parseInt(rows.toString().trim(), 10) };
|
|
305
173
|
}
|
|
306
|
-
} catch {} `
|
|
307
|
-
}),
|
|
308
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
309
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
310
|
-
name: "devTty",
|
|
311
|
-
children: _alloy_js_core.code`try {
|
|
174
|
+
} catch {} `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`devTty`,children:r.code`try {
|
|
312
175
|
const writeStream = new WriteStream(
|
|
313
176
|
openSync(
|
|
314
177
|
"/dev/tty",
|
|
@@ -317,160 +180,21 @@ function TerminalSizeDeclaration() {
|
|
|
317
180
|
).getWindowSize();
|
|
318
181
|
|
|
319
182
|
return { columns: writeStream[0], rows: writeStream[1] };
|
|
320
|
-
} catch {} `
|
|
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
|
-
heading: "A utility function that attempts to determine the size of the terminal (number of columns and rows) using various methods, and falls back to default values if it cannot be determined. This can be used to adjust output formatting based on the available terminal size.",
|
|
325
|
-
get children() {
|
|
326
|
-
return [
|
|
327
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: "The function first checks if the process is running in a TTY environment and if the stdout or stderr streams provide column and row information. If not, it attempts to use platform-specific methods (like reading from /proc/self/stat on Linux, using tput on Unix-like systems, or checking /dev/tty) to determine the terminal size. If all else fails, it returns default values." }),
|
|
328
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
329
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "An object containing the number of columns and rows of the terminal." })
|
|
330
|
-
];
|
|
331
|
-
}
|
|
332
|
-
}),
|
|
333
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
334
|
-
"export": true,
|
|
335
|
-
name: "getTerminalSize",
|
|
336
|
-
returnType: "{ columns: number; rows: number; }",
|
|
337
|
-
get children() {
|
|
338
|
-
return [
|
|
339
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
340
|
-
condition: _alloy_js_core.code`process.stdout?.columns && process.stdout?.rows`,
|
|
341
|
-
children: _alloy_js_core.code`return { columns: process.stdout.columns, rows: process.stdout.rows }; `
|
|
342
|
-
}),
|
|
343
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
344
|
-
condition: _alloy_js_core.code`process.stderr?.columns && process.stderr?.rows`,
|
|
345
|
-
children: _alloy_js_core.code`return { columns: process.stderr.columns, rows: process.stderr.rows };`
|
|
346
|
-
}),
|
|
347
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
348
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
349
|
-
condition: _alloy_js_core.code`isWindows`,
|
|
350
|
-
children: _alloy_js_core.code`return tput() ?? {
|
|
183
|
+
} catch {} `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`A utility function that attempts to determine the size of the terminal (number of columns and rows) using various methods, and falls back to default values if it cannot be determined. This can be used to adjust output formatting based on the available terminal size.`,get children(){return[(0,t.createComponent)(c.TSDocRemarks,{children:`The function first checks if the process is running in a TTY environment and if the stdout or stderr streams provide column and row information. If not, it attempts to use platform-specific methods (like reading from /proc/self/stat on Linux, using tput on Unix-like systems, or checking /dev/tty) to determine the terminal size. If all else fails, it returns default values.`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(c.TSDocReturns,{children:`An object containing the number of columns and rows of the terminal.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,name:`getTerminalSize`,returnType:`{ columns: number; rows: number; }`,get children(){return[(0,t.createComponent)(o.IfStatement,{condition:r.code`process.stdout?.columns && process.stdout?.rows`,children:r.code`return { columns: process.stdout.columns, rows: process.stdout.rows }; `}),(0,t.createComponent)(o.IfStatement,{condition:r.code`process.stderr?.columns && process.stderr?.rows`,children:r.code`return { columns: process.stderr.columns, rows: process.stderr.rows };`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.IfStatement,{condition:r.code`isWindows`,children:r.code`return tput() ?? {
|
|
351
184
|
columns: DEFAULT_TERMINAL_COLUMNS,
|
|
352
185
|
rows: DEFAULT_TERMINAL_ROWS,
|
|
353
|
-
}; `
|
|
354
|
-
}),
|
|
355
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
356
|
-
condition: _alloy_js_core.code`isMacOS`,
|
|
357
|
-
children: _alloy_js_core.code`return devTty() ?? tput() ?? {
|
|
186
|
+
}; `}),(0,t.createComponent)(o.IfStatement,{condition:r.code`isMacOS`,children:r.code`return devTty() ?? tput() ?? {
|
|
358
187
|
columns: DEFAULT_TERMINAL_COLUMNS,
|
|
359
188
|
rows: DEFAULT_TERMINAL_ROWS,
|
|
360
|
-
}; `
|
|
361
|
-
}),
|
|
362
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
363
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
364
|
-
"let": true,
|
|
365
|
-
name: "result",
|
|
366
|
-
initializer: _alloy_js_core.code`devTty() ?? tput(); `
|
|
367
|
-
}),
|
|
368
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
369
|
-
condition: _alloy_js_core.code`!result && isForegroundProcess()`,
|
|
370
|
-
children: _alloy_js_core.code`try {
|
|
189
|
+
}; `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{let:!0,name:`result`,initializer:r.code`devTty() ?? tput(); `}),(0,t.createComponent)(o.IfStatement,{condition:r.code`!result && isForegroundProcess()`,children:r.code`try {
|
|
371
190
|
const size = execSync(["resize", "-u"]).match(/\\d+/g);
|
|
372
191
|
if (size.length === 2) {
|
|
373
192
|
result = { columns: Number.parseInt(size[0], 10), rows: Number.parseInt(size[1], 10) };
|
|
374
193
|
}
|
|
375
|
-
} catch {} `
|
|
376
|
-
}),
|
|
377
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
378
|
-
_alloy_js_core.code`return result ?? {
|
|
194
|
+
} catch {} `}),(0,t.createComponent)(i.Spacing,{}),r.code`return result ?? {
|
|
379
195
|
columns: DEFAULT_TERMINAL_COLUMNS,
|
|
380
196
|
rows: DEFAULT_TERMINAL_ROWS,
|
|
381
|
-
}; `
|
|
382
|
-
];
|
|
383
|
-
}
|
|
384
|
-
})
|
|
385
|
-
];
|
|
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
|
-
];
|
|
392
|
-
/**
|
|
393
|
-
* Generates utilities for detecting terminal color support.
|
|
394
|
-
*/
|
|
395
|
-
function EnvSupportUtilities() {
|
|
396
|
-
return [
|
|
397
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
398
|
-
"export": true,
|
|
399
|
-
"const": true,
|
|
400
|
-
name: "isTTY",
|
|
401
|
-
doc: "Detect if stdout.TTY is available",
|
|
402
|
-
initializer: _alloy_js_core.code`Boolean(process.stdout && process.stdout.isTTY);`
|
|
403
|
-
}),
|
|
404
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
405
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
406
|
-
"export": true,
|
|
407
|
-
"const": true,
|
|
408
|
-
name: "isMinimal",
|
|
409
|
-
doc: "Detect if the current environment is minimal (CI, non-TTY, etc.)",
|
|
410
|
-
initializer: _alloy_js_core.code` env.MINIMAL || isCI || isTest || !isTTY; `
|
|
411
|
-
}),
|
|
412
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
413
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
414
|
-
"export": true,
|
|
415
|
-
"const": true,
|
|
416
|
-
name: "isInteractive",
|
|
417
|
-
doc: "Detect if the current environment is interactive",
|
|
418
|
-
initializer: _alloy_js_core.code` !isMinimal && process.stdin?.isTTY && env.TERM !== "dumb" && !hasFlag(["no-interactive", "non-interactive", "no-interact"]); `
|
|
419
|
-
})
|
|
420
|
-
];
|
|
421
|
-
}
|
|
422
|
-
EnvSupportUtilities.__type = [
|
|
423
|
-
"EnvSupportUtilities",
|
|
424
|
-
"Generates utilities for detecting terminal color support.",
|
|
425
|
-
"P\"/!?\""
|
|
426
|
-
];
|
|
427
|
-
/**
|
|
428
|
-
* Generates utilities for detecting terminal color support.
|
|
429
|
-
*/
|
|
430
|
-
function ColorSupportUtilities() {
|
|
431
|
-
return [
|
|
432
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
433
|
-
"export": true,
|
|
434
|
-
name: "GetColorSupportLevelOptions",
|
|
435
|
-
doc: "Options for the getColorSupportLevel function",
|
|
436
|
-
get children() {
|
|
437
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
438
|
-
name: "ignoreFlags",
|
|
439
|
-
type: "boolean",
|
|
440
|
-
doc: "Indicates if the function should skip checking command-line flags for color support"
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
}),
|
|
444
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
445
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
446
|
-
heading: "Checks if a specific flag is present in the command-line arguments.",
|
|
447
|
-
get children() {
|
|
448
|
-
return [
|
|
449
|
-
(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" }),
|
|
450
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
451
|
-
name: "flag",
|
|
452
|
-
children: "The flag to check for, e.g., \"color\", \"no-color\"."
|
|
453
|
-
}),
|
|
454
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
455
|
-
name: "argv",
|
|
456
|
-
children: "The command-line arguments to check against. Defaults to global Deno args or process args."
|
|
457
|
-
}),
|
|
458
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "True if the flag is present, false otherwise." })
|
|
459
|
-
];
|
|
460
|
-
}
|
|
461
|
-
}),
|
|
462
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
463
|
-
"export": true,
|
|
464
|
-
name: "getColorSupportLevel",
|
|
465
|
-
parameters: [{
|
|
466
|
-
name: "stream",
|
|
467
|
-
type: "NodeJS.WriteStream & { fd: 1 | 2; }"
|
|
468
|
-
}, {
|
|
469
|
-
name: "options",
|
|
470
|
-
type: "GetColorSupportLevelOptions",
|
|
471
|
-
default: "{ ignoreFlags: false }"
|
|
472
|
-
}],
|
|
473
|
-
children: _alloy_js_core.code`const { ignoreFlags } = options;
|
|
197
|
+
}; `]}})]}m.__type=[`TerminalSizeDeclaration`,`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).`,`P"/!?"`];function h(){return[(0,t.createComponent)(o.VarDeclaration,{export:!0,const:!0,name:`isTTY`,doc:`Detect if stdout.TTY is available`,initializer:r.code`Boolean(process.stdout && process.stdout.isTTY);`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{export:!0,const:!0,name:`isMinimal`,doc:`Detect if the current environment is minimal (CI, non-TTY, etc.)`,initializer:r.code` env.MINIMAL || isCI || isTest || !isTTY; `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{export:!0,const:!0,name:`isInteractive`,doc:`Detect if the current environment is interactive`,initializer:r.code` !isMinimal && process.stdin?.isTTY && env.TERM !== "dumb" && !hasFlag(["no-interactive", "non-interactive", "no-interact"]); `})]}h.__type=[`EnvSupportUtilities`,`Generates utilities for detecting terminal color support.`,`P"/!?"`];function g(){return[(0,t.createComponent)(o.InterfaceDeclaration,{export:!0,name:`GetColorSupportLevelOptions`,doc:`Options for the getColorSupportLevel function`,get children(){return(0,t.createComponent)(o.InterfaceMember,{name:`ignoreFlags`,type:`boolean`,doc:`Indicates if the function should skip checking command-line flags for color support`})}}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Checks if a specific flag is present in the command-line arguments.`,get children(){return[(0,t.createComponent)(c.TSDocLink,{children:`https://github.com/sindresorhus/has-flag/blob/main/index.js`}),(0,t.createComponent)(c.TSDocParam,{name:`flag`,children:`The flag to check for, e.g., "color", "no-color".`}),(0,t.createComponent)(c.TSDocParam,{name:`argv`,children:`The command-line arguments to check against. Defaults to global Deno args or process args.`}),(0,t.createComponent)(c.TSDocReturns,{children:`True if the flag is present, false otherwise.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,name:`getColorSupportLevel`,parameters:[{name:`stream`,type:`NodeJS.WriteStream & { fd: 1 | 2; }`},{name:`options`,type:`GetColorSupportLevelOptions`,default:`{ ignoreFlags: false }`}],children:r.code`const { ignoreFlags } = options;
|
|
474
198
|
|
|
475
199
|
let forceColor: number | undefined;
|
|
476
200
|
if (env.FORCE_COLOR !== undefined) {
|
|
@@ -579,34 +303,10 @@ function ColorSupportUtilities() {
|
|
|
579
303
|
has16m: level >= 3,
|
|
580
304
|
};
|
|
581
305
|
|
|
582
|
-
`
|
|
583
|
-
}),
|
|
584
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
585
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
586
|
-
"export": true,
|
|
587
|
-
"const": true,
|
|
588
|
-
name: "colorSupportLevels",
|
|
589
|
-
doc: "Detect the terminal color support level in the current environment",
|
|
590
|
-
initializer: _alloy_js_core.code` {
|
|
306
|
+
`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{export:!0,const:!0,name:`colorSupportLevels`,doc:`Detect the terminal color support level in the current environment`,initializer:r.code` {
|
|
591
307
|
stdout: getColorSupportLevel(process.stdout),
|
|
592
308
|
stderr: getColorSupportLevel(process.stderr),
|
|
593
|
-
}; `
|
|
594
|
-
}),
|
|
595
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
596
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
597
|
-
"export": true,
|
|
598
|
-
"const": true,
|
|
599
|
-
name: "isColorSupported",
|
|
600
|
-
doc: "Detect if terminal color is supported in the current environment",
|
|
601
|
-
initializer: _alloy_js_core.code` Boolean(colorSupportLevels.stdout); `
|
|
602
|
-
}),
|
|
603
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
604
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
605
|
-
"export": true,
|
|
606
|
-
"const": true,
|
|
607
|
-
name: "isUnicodeSupported",
|
|
608
|
-
doc: "Detect if Unicode characters are supported in the current environment",
|
|
609
|
-
initializer: _alloy_js_core.code` !isWindows
|
|
309
|
+
}; `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{export:!0,const:!0,name:`isColorSupported`,doc:`Detect if terminal color is supported in the current environment`,initializer:r.code` Boolean(colorSupportLevels.stdout); `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{export:!0,const:!0,name:`isUnicodeSupported`,doc:`Detect if Unicode characters are supported in the current environment`,initializer:r.code` !isWindows
|
|
610
310
|
? env.TERM !== "linux"
|
|
611
311
|
: Boolean(env.WT_SESSION) ||
|
|
612
312
|
Boolean(env.TERMINUS_SUBLIME) ||
|
|
@@ -617,28 +317,7 @@ function ColorSupportUtilities() {
|
|
|
617
317
|
env.TERM === "alacritty" ||
|
|
618
318
|
env.TERM === "rxvt-unicode" ||
|
|
619
319
|
env.TERM === "rxvt-unicode-256color" ||
|
|
620
|
-
env.TERMINAL_EMULATOR === "JetBrains-JediTerm"; `
|
|
621
|
-
})
|
|
622
|
-
];
|
|
623
|
-
}
|
|
624
|
-
ColorSupportUtilities.__type = [
|
|
625
|
-
"ColorSupportUtilities",
|
|
626
|
-
"Generates utilities for detecting terminal color support.",
|
|
627
|
-
"P\"/!?\""
|
|
628
|
-
];
|
|
629
|
-
/**
|
|
630
|
-
* Generates utilities for detecting terminal color support.
|
|
631
|
-
*/
|
|
632
|
-
function HyperlinkSupportUtilities() {
|
|
633
|
-
return [
|
|
634
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
635
|
-
name: "parseVersion",
|
|
636
|
-
parameters: [{
|
|
637
|
-
name: "version",
|
|
638
|
-
type: "string",
|
|
639
|
-
default: "\"\""
|
|
640
|
-
}],
|
|
641
|
-
children: _alloy_js_core.code`if (/^\d{3,4}$/.test(version)) {
|
|
320
|
+
env.TERMINAL_EMULATOR === "JetBrains-JediTerm"; `})]}g.__type=[`ColorSupportUtilities`,`Generates utilities for detecting terminal color support.`,`P"/!?"`];function _(){return[(0,t.createComponent)(o.FunctionDeclaration,{name:`parseVersion`,parameters:[{name:`version`,type:`string`,default:`""`}],children:r.code`if (/^\d{3,4}$/.test(version)) {
|
|
642
321
|
const match = /(\d{1,2})(\d{2})/.exec(version) ?? [];
|
|
643
322
|
|
|
644
323
|
return {
|
|
@@ -656,20 +335,7 @@ function HyperlinkSupportUtilities() {
|
|
|
656
335
|
major: versionParts[0],
|
|
657
336
|
minor: versionParts[1],
|
|
658
337
|
patch: versionParts[2]
|
|
659
|
-
}; `
|
|
660
|
-
}),
|
|
661
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
662
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
663
|
-
heading: "Check if the current environment/terminal supports hyperlinks in the terminal.",
|
|
664
|
-
get children() {
|
|
665
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: "True if the current environment/terminal supports hyperlinks." });
|
|
666
|
-
}
|
|
667
|
-
}),
|
|
668
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
669
|
-
"export": true,
|
|
670
|
-
name: "isHyperlinkSupported",
|
|
671
|
-
returnType: "boolean",
|
|
672
|
-
children: _alloy_js_core.code`if (Boolean(env.FORCE_HYPERLINK)) {
|
|
338
|
+
}; `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`Check if the current environment/terminal supports hyperlinks in the terminal.`,get children(){return(0,t.createComponent)(c.TSDocReturns,{children:`True if the current environment/terminal supports hyperlinks.`})}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,name:`isHyperlinkSupported`,returnType:`boolean`,children:r.code`if (Boolean(env.FORCE_HYPERLINK)) {
|
|
673
339
|
return true;
|
|
674
340
|
}
|
|
675
341
|
|
|
@@ -730,126 +396,7 @@ function HyperlinkSupportUtilities() {
|
|
|
730
396
|
return true;
|
|
731
397
|
}
|
|
732
398
|
|
|
733
|
-
return false; `
|
|
734
|
-
})
|
|
735
|
-
];
|
|
736
|
-
}
|
|
737
|
-
HyperlinkSupportUtilities.__type = [
|
|
738
|
-
"HyperlinkSupportUtilities",
|
|
739
|
-
"Generates utilities for detecting terminal color support.",
|
|
740
|
-
"P\"/!?\""
|
|
741
|
-
];
|
|
742
|
-
/**
|
|
743
|
-
* Generates the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.
|
|
744
|
-
*/
|
|
745
|
-
function ResolveModuleFunctionDeclaration() {
|
|
746
|
-
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
747
|
-
return [
|
|
748
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
749
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
750
|
-
name: "ResolveModuleOptions",
|
|
751
|
-
doc: "Options for the `resolve` handler function.",
|
|
752
|
-
get children() {
|
|
753
|
-
return [
|
|
754
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
755
|
-
name: "parentURL",
|
|
756
|
-
optional: true,
|
|
757
|
-
type: "string",
|
|
758
|
-
doc: "The parent URL to use for resolving paths."
|
|
759
|
-
}),
|
|
760
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
761
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
762
|
-
name: "conditions",
|
|
763
|
-
optional: true,
|
|
764
|
-
type: "string[]",
|
|
765
|
-
doc: "The conditions to use for resolving paths."
|
|
766
|
-
}),
|
|
767
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
768
|
-
];
|
|
769
|
-
}
|
|
770
|
-
}),
|
|
771
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
772
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
773
|
-
name: "PackageConfig",
|
|
774
|
-
doc: "Parsed package.json configuration for module resolution.",
|
|
775
|
-
get children() {
|
|
776
|
-
return [
|
|
777
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
778
|
-
name: "pjsonPath",
|
|
779
|
-
type: "string",
|
|
780
|
-
doc: "The path to the package.json file."
|
|
781
|
-
}),
|
|
782
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
783
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
784
|
-
name: "exists",
|
|
785
|
-
type: "boolean",
|
|
786
|
-
doc: "Whether the package.json file exists."
|
|
787
|
-
}),
|
|
788
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
789
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
790
|
-
name: "main",
|
|
791
|
-
optional: true,
|
|
792
|
-
type: "string",
|
|
793
|
-
doc: "The main entry point of the package."
|
|
794
|
-
}),
|
|
795
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
796
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
797
|
-
name: "name",
|
|
798
|
-
optional: true,
|
|
799
|
-
type: "string",
|
|
800
|
-
doc: "The name of the package."
|
|
801
|
-
}),
|
|
802
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
803
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
804
|
-
name: "type",
|
|
805
|
-
optional: true,
|
|
806
|
-
type: `"commonjs" | "module" | "none"`,
|
|
807
|
-
doc: "The module type of the package."
|
|
808
|
-
}),
|
|
809
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
810
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
811
|
-
name: "exports",
|
|
812
|
-
optional: true,
|
|
813
|
-
type: "Record<string, unknown>",
|
|
814
|
-
doc: "The exports map of the package."
|
|
815
|
-
}),
|
|
816
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
817
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
818
|
-
name: "imports",
|
|
819
|
-
optional: true,
|
|
820
|
-
type: "Record<string, unknown>",
|
|
821
|
-
doc: "The imports map of the package."
|
|
822
|
-
})
|
|
823
|
-
];
|
|
824
|
-
}
|
|
825
|
-
}),
|
|
826
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
827
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
828
|
-
"const": true,
|
|
829
|
-
name: "DEFAULT_CONDITIONS_SET",
|
|
830
|
-
initializer: _alloy_js_core.code`new Set(["node", "import"]);`
|
|
831
|
-
}),
|
|
832
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
833
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
834
|
-
"const": true,
|
|
835
|
-
name: "DEFAULT_EXTENSIONS",
|
|
836
|
-
initializer: _alloy_js_core.code`[".mjs", ".cjs", ".js", ".json", ".node"];`
|
|
837
|
-
}),
|
|
838
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
839
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
840
|
-
"const": true,
|
|
841
|
-
name: "invalidPackageNameRegEx",
|
|
842
|
-
initializer: _alloy_js_core.code`/^\\.|\\/|%/;`
|
|
843
|
-
}),
|
|
844
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
845
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
846
|
-
name: "readPackageConfig",
|
|
847
|
-
parameters: [{
|
|
848
|
-
name: "jsonPath",
|
|
849
|
-
type: "string"
|
|
850
|
-
}],
|
|
851
|
-
returnType: "PackageConfig",
|
|
852
|
-
children: _alloy_js_core.code`const result: PackageConfig = {
|
|
399
|
+
return false; `})]}_.__type=[`HyperlinkSupportUtilities`,`Generates utilities for detecting terminal color support.`,`P"/!?"`];function v(){let e=(a.usePowerlines.Ω=[[`Context`,`"w!`]],(0,a.usePowerlines)());return[(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.InterfaceDeclaration,{name:`ResolveModuleOptions`,doc:"Options for the `resolve` handler function.",get children(){return[(0,t.createComponent)(o.InterfaceMember,{name:`parentURL`,optional:!0,type:`string`,doc:`The parent URL to use for resolving paths.`}),(0,t.createIntrinsic)(`hbr`,{}),(0,t.createComponent)(o.InterfaceMember,{name:`conditions`,optional:!0,type:`string[]`,doc:`The conditions to use for resolving paths.`}),(0,t.createIntrinsic)(`hbr`,{})]}}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.InterfaceDeclaration,{name:`PackageConfig`,doc:`Parsed package.json configuration for module resolution.`,get children(){return[(0,t.createComponent)(o.InterfaceMember,{name:`pjsonPath`,type:`string`,doc:`The path to the package.json file.`}),(0,t.createIntrinsic)(`hbr`,{}),(0,t.createComponent)(o.InterfaceMember,{name:`exists`,type:`boolean`,doc:`Whether the package.json file exists.`}),(0,t.createIntrinsic)(`hbr`,{}),(0,t.createComponent)(o.InterfaceMember,{name:`main`,optional:!0,type:`string`,doc:`The main entry point of the package.`}),(0,t.createIntrinsic)(`hbr`,{}),(0,t.createComponent)(o.InterfaceMember,{name:`name`,optional:!0,type:`string`,doc:`The name of the package.`}),(0,t.createIntrinsic)(`hbr`,{}),(0,t.createComponent)(o.InterfaceMember,{name:`type`,optional:!0,type:`"commonjs" | "module" | "none"`,doc:`The module type of the package.`}),(0,t.createIntrinsic)(`hbr`,{}),(0,t.createComponent)(o.InterfaceMember,{name:`exports`,optional:!0,type:`Record<string, unknown>`,doc:`The exports map of the package.`}),(0,t.createIntrinsic)(`hbr`,{}),(0,t.createComponent)(o.InterfaceMember,{name:`imports`,optional:!0,type:`Record<string, unknown>`,doc:`The imports map of the package.`})]}}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{const:!0,name:`DEFAULT_CONDITIONS_SET`,initializer:r.code`new Set(["node", "import"]);`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{const:!0,name:`DEFAULT_EXTENSIONS`,initializer:r.code`[".mjs", ".cjs", ".js", ".json", ".node"];`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.VarDeclaration,{const:!0,name:`invalidPackageNameRegEx`,initializer:r.code`/^\\.|\\/|%/;`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`readPackageConfig`,parameters:[{name:`jsonPath`,type:`string`}],returnType:`PackageConfig`,children:r.code`const result: PackageConfig = {
|
|
853
400
|
pjsonPath: jsonPath,
|
|
854
401
|
exists: false,
|
|
855
402
|
main: undefined,
|
|
@@ -894,17 +441,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
894
441
|
result.type = parsed.type;
|
|
895
442
|
}
|
|
896
443
|
|
|
897
|
-
return result;`
|
|
898
|
-
}),
|
|
899
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
900
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
901
|
-
name: "getPackageScopeConfig",
|
|
902
|
-
parameters: [{
|
|
903
|
-
name: "resolved",
|
|
904
|
-
type: "URL | string"
|
|
905
|
-
}],
|
|
906
|
-
returnType: "PackageConfig",
|
|
907
|
-
children: _alloy_js_core.code`let packageJSONUrl = new URL("package.json", resolved);
|
|
444
|
+
return result;`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`getPackageScopeConfig`,parameters:[{name:`resolved`,type:`URL | string`}],returnType:`PackageConfig`,children:r.code`let packageJSONUrl = new URL("package.json", resolved);
|
|
908
445
|
|
|
909
446
|
while (true) {
|
|
910
447
|
const packageJSONPath = packageJSONUrl.pathname;
|
|
@@ -929,17 +466,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
929
466
|
pjsonPath: fileURLToPath(packageJSONUrl),
|
|
930
467
|
exists: false,
|
|
931
468
|
type: "none"
|
|
932
|
-
};`
|
|
933
|
-
}),
|
|
934
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
935
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
936
|
-
name: "isConditionalExportsMainSugar",
|
|
937
|
-
parameters: [{
|
|
938
|
-
name: "exports",
|
|
939
|
-
type: "unknown"
|
|
940
|
-
}],
|
|
941
|
-
returnType: "boolean",
|
|
942
|
-
children: _alloy_js_core.code`if (typeof exports === "string" || Array.isArray(exports)) {
|
|
469
|
+
};`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`isConditionalExportsMainSugar`,parameters:[{name:`exports`,type:`unknown`}],returnType:`boolean`,children:r.code`if (typeof exports === "string" || Array.isArray(exports)) {
|
|
943
470
|
return true;
|
|
944
471
|
}
|
|
945
472
|
if (typeof exports !== "object" || exports === null) {
|
|
@@ -961,47 +488,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
961
488
|
}
|
|
962
489
|
}
|
|
963
490
|
|
|
964
|
-
return isConditionalSugar;`
|
|
965
|
-
}),
|
|
966
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
967
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
968
|
-
name: "resolvePackageTarget",
|
|
969
|
-
parameters: [
|
|
970
|
-
{
|
|
971
|
-
name: "packageJsonUrl",
|
|
972
|
-
type: "URL"
|
|
973
|
-
},
|
|
974
|
-
{
|
|
975
|
-
name: "target",
|
|
976
|
-
type: "unknown"
|
|
977
|
-
},
|
|
978
|
-
{
|
|
979
|
-
name: "subpath",
|
|
980
|
-
type: "string"
|
|
981
|
-
},
|
|
982
|
-
{
|
|
983
|
-
name: "packageSubpath",
|
|
984
|
-
type: "string"
|
|
985
|
-
},
|
|
986
|
-
{
|
|
987
|
-
name: "base",
|
|
988
|
-
type: "URL"
|
|
989
|
-
},
|
|
990
|
-
{
|
|
991
|
-
name: "pattern",
|
|
992
|
-
type: "boolean"
|
|
993
|
-
},
|
|
994
|
-
{
|
|
995
|
-
name: "internal",
|
|
996
|
-
type: "boolean"
|
|
997
|
-
},
|
|
998
|
-
{
|
|
999
|
-
name: "conditions",
|
|
1000
|
-
type: "Set<string>"
|
|
1001
|
-
}
|
|
1002
|
-
],
|
|
1003
|
-
returnType: "URL | null | undefined",
|
|
1004
|
-
children: _alloy_js_core.code`if (typeof target === "string") {
|
|
491
|
+
return isConditionalSugar;`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`resolvePackageTarget`,parameters:[{name:`packageJsonUrl`,type:`URL`},{name:`target`,type:`unknown`},{name:`subpath`,type:`string`},{name:`packageSubpath`,type:`string`},{name:`base`,type:`URL`},{name:`pattern`,type:`boolean`},{name:`internal`,type:`boolean`},{name:`conditions`,type:`Set<string>`}],returnType:`URL | null | undefined`,children:r.code`if (typeof target === "string") {
|
|
1005
492
|
if (!target.startsWith("./")) {
|
|
1006
493
|
if (internal && !target.startsWith("../") && !target.startsWith("/")) {
|
|
1007
494
|
let isURL = false;
|
|
@@ -1098,35 +585,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1098
585
|
return null;
|
|
1099
586
|
}
|
|
1100
587
|
|
|
1101
|
-
return null;`
|
|
1102
|
-
}),
|
|
1103
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1104
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1105
|
-
name: "packageExportsResolve",
|
|
1106
|
-
parameters: [
|
|
1107
|
-
{
|
|
1108
|
-
name: "packageJsonUrl",
|
|
1109
|
-
type: "URL"
|
|
1110
|
-
},
|
|
1111
|
-
{
|
|
1112
|
-
name: "packageSubpath",
|
|
1113
|
-
type: "string"
|
|
1114
|
-
},
|
|
1115
|
-
{
|
|
1116
|
-
name: "packageConfig",
|
|
1117
|
-
type: "PackageConfig"
|
|
1118
|
-
},
|
|
1119
|
-
{
|
|
1120
|
-
name: "base",
|
|
1121
|
-
type: "URL"
|
|
1122
|
-
},
|
|
1123
|
-
{
|
|
1124
|
-
name: "conditions",
|
|
1125
|
-
type: "Set<string>"
|
|
1126
|
-
}
|
|
1127
|
-
],
|
|
1128
|
-
returnType: "URL | null | undefined",
|
|
1129
|
-
children: _alloy_js_core.code`let exports = packageConfig.exports;
|
|
588
|
+
return null;`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`packageExportsResolve`,parameters:[{name:`packageJsonUrl`,type:`URL`},{name:`packageSubpath`,type:`string`},{name:`packageConfig`,type:`PackageConfig`},{name:`base`,type:`URL`},{name:`conditions`,type:`Set<string>`}],returnType:`URL | null | undefined`,children:r.code`let exports = packageConfig.exports;
|
|
1130
589
|
if (isConditionalExportsMainSugar(exports)) {
|
|
1131
590
|
exports = { ".": exports } as Record<string, unknown>;
|
|
1132
591
|
}
|
|
@@ -1200,20 +659,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1200
659
|
\`Package subpath '\${packageSubpath}' is not defined by "exports" in \${fileURLToPath(packageJsonUrl)}\`
|
|
1201
660
|
);
|
|
1202
661
|
(err as any).code = "ERR_PACKAGE_PATH_NOT_EXPORTED";
|
|
1203
|
-
throw err;`
|
|
1204
|
-
}),
|
|
1205
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1206
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1207
|
-
name: "patternKeyCompare",
|
|
1208
|
-
parameters: [{
|
|
1209
|
-
name: "a",
|
|
1210
|
-
type: "string"
|
|
1211
|
-
}, {
|
|
1212
|
-
name: "b",
|
|
1213
|
-
type: "string"
|
|
1214
|
-
}],
|
|
1215
|
-
returnType: "number",
|
|
1216
|
-
children: _alloy_js_core.code`const aPatternIndex = a.indexOf("*");
|
|
662
|
+
throw err;`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`patternKeyCompare`,parameters:[{name:`a`,type:`string`},{name:`b`,type:`string`}],returnType:`number`,children:r.code`const aPatternIndex = a.indexOf("*");
|
|
1217
663
|
const bPatternIndex = b.indexOf("*");
|
|
1218
664
|
const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
1219
665
|
const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
@@ -1223,20 +669,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1223
669
|
if (bPatternIndex === -1) return -1;
|
|
1224
670
|
if (a.length > b.length) return -1;
|
|
1225
671
|
if (b.length > a.length) return 1;
|
|
1226
|
-
return 0;`
|
|
1227
|
-
}),
|
|
1228
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1229
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1230
|
-
name: "legacyMainResolve",
|
|
1231
|
-
parameters: [{
|
|
1232
|
-
name: "packageJsonUrl",
|
|
1233
|
-
type: "URL"
|
|
1234
|
-
}, {
|
|
1235
|
-
name: "packageConfig",
|
|
1236
|
-
type: "PackageConfig"
|
|
1237
|
-
}],
|
|
1238
|
-
returnType: "URL | undefined",
|
|
1239
|
-
children: _alloy_js_core.code`let guess: URL | undefined;
|
|
672
|
+
return 0;`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`legacyMainResolve`,parameters:[{name:`packageJsonUrl`,type:`URL`},{name:`packageConfig`,type:`PackageConfig`}],returnType:`URL | undefined`,children:r.code`let guess: URL | undefined;
|
|
1240
673
|
const tries: string[] = [];
|
|
1241
674
|
|
|
1242
675
|
if (packageConfig.main !== undefined) {
|
|
@@ -1264,20 +697,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1264
697
|
guess = undefined;
|
|
1265
698
|
}
|
|
1266
699
|
|
|
1267
|
-
return undefined;`
|
|
1268
|
-
}),
|
|
1269
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1270
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1271
|
-
name: "parsePackageName",
|
|
1272
|
-
parameters: [{
|
|
1273
|
-
name: "specifier",
|
|
1274
|
-
type: "string"
|
|
1275
|
-
}, {
|
|
1276
|
-
name: "base",
|
|
1277
|
-
type: "URL"
|
|
1278
|
-
}],
|
|
1279
|
-
returnType: "{ packageName: string; packageSubpath: string; isScoped: boolean }",
|
|
1280
|
-
children: _alloy_js_core.code`let separatorIndex = specifier.indexOf("/");
|
|
700
|
+
return undefined;`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`parsePackageName`,parameters:[{name:`specifier`,type:`string`},{name:`base`,type:`URL`}],returnType:`{ packageName: string; packageSubpath: string; isScoped: boolean }`,children:r.code`let separatorIndex = specifier.indexOf("/");
|
|
1281
701
|
let validPackageName = true;
|
|
1282
702
|
let isScoped = false;
|
|
1283
703
|
|
|
@@ -1310,27 +730,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1310
730
|
? ""
|
|
1311
731
|
: specifier.slice(separatorIndex));
|
|
1312
732
|
|
|
1313
|
-
return { packageName, packageSubpath, isScoped };`
|
|
1314
|
-
}),
|
|
1315
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1316
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1317
|
-
name: "packageResolve",
|
|
1318
|
-
parameters: [
|
|
1319
|
-
{
|
|
1320
|
-
name: "specifier",
|
|
1321
|
-
type: "string"
|
|
1322
|
-
},
|
|
1323
|
-
{
|
|
1324
|
-
name: "base",
|
|
1325
|
-
type: "URL"
|
|
1326
|
-
},
|
|
1327
|
-
{
|
|
1328
|
-
name: "conditions",
|
|
1329
|
-
type: "Set<string>"
|
|
1330
|
-
}
|
|
1331
|
-
],
|
|
1332
|
-
returnType: "URL",
|
|
1333
|
-
children: _alloy_js_core.code`if (builtinModules.includes(specifier)) {
|
|
733
|
+
return { packageName, packageSubpath, isScoped };`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`packageResolve`,parameters:[{name:`specifier`,type:`string`},{name:`base`,type:`URL`},{name:`conditions`,type:`Set<string>`}],returnType:`URL`,children:r.code`if (builtinModules.includes(specifier)) {
|
|
1334
734
|
return new URL("node:" + specifier);
|
|
1335
735
|
}
|
|
1336
736
|
|
|
@@ -1404,20 +804,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1404
804
|
const err = new Error(\`Cannot find package \\\`\${packageName}\\\`\`);
|
|
1405
805
|
(err as any).code = "ERR_MODULE_NOT_FOUND";
|
|
1406
806
|
|
|
1407
|
-
throw err;`
|
|
1408
|
-
}),
|
|
1409
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1410
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1411
|
-
name: "finalizeResolution",
|
|
1412
|
-
parameters: [{
|
|
1413
|
-
name: "resolved",
|
|
1414
|
-
type: "URL"
|
|
1415
|
-
}, {
|
|
1416
|
-
name: "base",
|
|
1417
|
-
type: "URL"
|
|
1418
|
-
}],
|
|
1419
|
-
returnType: "URL",
|
|
1420
|
-
children: _alloy_js_core.code`if (/%2f|%5c/i.test(resolved.pathname)) {
|
|
807
|
+
throw err;`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`finalizeResolution`,parameters:[{name:`resolved`,type:`URL`},{name:`base`,type:`URL`}],returnType:`URL`,children:r.code`if (/%2f|%5c/i.test(resolved.pathname)) {
|
|
1421
808
|
const err = new Error(
|
|
1422
809
|
\`Invalid module \\\`\${resolved.pathname}\\\` must not include encoded "/" or "\\\\" characters imported from \${fileURLToPath(base)}\`
|
|
1423
810
|
);
|
|
@@ -1455,27 +842,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1455
842
|
realUrl.search = search;
|
|
1456
843
|
realUrl.hash = hash;
|
|
1457
844
|
|
|
1458
|
-
return realUrl;`
|
|
1459
|
-
}),
|
|
1460
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1461
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1462
|
-
name: "moduleResolve",
|
|
1463
|
-
parameters: [
|
|
1464
|
-
{
|
|
1465
|
-
name: "specifier",
|
|
1466
|
-
type: "string"
|
|
1467
|
-
},
|
|
1468
|
-
{
|
|
1469
|
-
name: "base",
|
|
1470
|
-
type: "URL"
|
|
1471
|
-
},
|
|
1472
|
-
{
|
|
1473
|
-
name: "conditions",
|
|
1474
|
-
type: "Set<string>"
|
|
1475
|
-
}
|
|
1476
|
-
],
|
|
1477
|
-
returnType: "URL",
|
|
1478
|
-
children: _alloy_js_core.code`let resolved: URL | undefined;
|
|
845
|
+
return realUrl;`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`moduleResolve`,parameters:[{name:`specifier`,type:`string`},{name:`base`,type:`URL`},{name:`conditions`,type:`Set<string>`}],returnType:`URL`,children:r.code`let resolved: URL | undefined;
|
|
1479
846
|
|
|
1480
847
|
if (
|
|
1481
848
|
specifier[0] === "/" ||
|
|
@@ -1564,27 +931,7 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1564
931
|
return resolved;
|
|
1565
932
|
}
|
|
1566
933
|
|
|
1567
|
-
return finalizeResolution(resolved, base);`
|
|
1568
|
-
}),
|
|
1569
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1570
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1571
|
-
name: "tryModuleResolve",
|
|
1572
|
-
parameters: [
|
|
1573
|
-
{
|
|
1574
|
-
name: "id",
|
|
1575
|
-
type: "string"
|
|
1576
|
-
},
|
|
1577
|
-
{
|
|
1578
|
-
name: "url",
|
|
1579
|
-
type: "URL"
|
|
1580
|
-
},
|
|
1581
|
-
{
|
|
1582
|
-
name: "conditions",
|
|
1583
|
-
type: "Set<string>"
|
|
1584
|
-
}
|
|
1585
|
-
],
|
|
1586
|
-
returnType: "URL | undefined",
|
|
1587
|
-
children: _alloy_js_core.code`try {
|
|
934
|
+
return finalizeResolution(resolved, base);`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(o.FunctionDeclaration,{name:`tryModuleResolve`,parameters:[{name:`id`,type:`string`},{name:`url`,type:`URL`},{name:`conditions`,type:`Set<string>`}],returnType:`URL | undefined`,children:r.code`try {
|
|
1588
935
|
return moduleResolve(id, url, conditions);
|
|
1589
936
|
} catch (error: any) {
|
|
1590
937
|
if (
|
|
@@ -1598,46 +945,13 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1598
945
|
) {
|
|
1599
946
|
throw error;
|
|
1600
947
|
}
|
|
1601
|
-
}`
|
|
1602
|
-
}),
|
|
1603
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1604
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
1605
|
-
heading: "A function to resolve module specifiers to URLs.",
|
|
1606
|
-
get children() {
|
|
1607
|
-
return [
|
|
1608
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
1609
|
-
name: "specifier",
|
|
1610
|
-
children: `The module specifier to resolve.`
|
|
1611
|
-
}),
|
|
1612
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
1613
|
-
name: "options",
|
|
1614
|
-
children: `The options for resolving the module. Defaults to an empty object.`
|
|
1615
|
-
}),
|
|
1616
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The result of the resolve operation.` })
|
|
1617
|
-
];
|
|
1618
|
-
}
|
|
1619
|
-
}),
|
|
1620
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1621
|
-
async: true,
|
|
1622
|
-
"export": true,
|
|
1623
|
-
name: "resolveModule",
|
|
1624
|
-
parameters: [{
|
|
1625
|
-
name: "specifier",
|
|
1626
|
-
type: "string"
|
|
1627
|
-
}, {
|
|
1628
|
-
name: "options",
|
|
1629
|
-
type: "ResolveModuleOptions",
|
|
1630
|
-
default: "{} as ResolveModuleOptions"
|
|
1631
|
-
}],
|
|
1632
|
-
returnType: "Promise<string>",
|
|
1633
|
-
get children() {
|
|
1634
|
-
return _alloy_js_core.code`const parentURL = options.parentURL ? new URL(options.parentURL) : undefined;
|
|
948
|
+
}`}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(c.TSDoc,{heading:`A function to resolve module specifiers to URLs.`,get children(){return[(0,t.createComponent)(c.TSDocParam,{name:`specifier`,children:`The module specifier to resolve.`}),(0,t.createComponent)(c.TSDocParam,{name:`options`,children:`The options for resolving the module. Defaults to an empty object.`}),(0,t.createComponent)(c.TSDocReturns,{children:`The result of the resolve operation.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{async:!0,export:!0,name:`resolveModule`,parameters:[{name:`specifier`,type:`string`},{name:`options`,type:`ResolveModuleOptions`,default:`{} as ResolveModuleOptions`}],returnType:`Promise<string>`,get children(){return r.code`const parentURL = options.parentURL ? new URL(options.parentURL) : undefined;
|
|
1635
949
|
const conditionsSet = options.conditions?.length
|
|
1636
950
|
? new Set(options.conditions)
|
|
1637
951
|
: DEFAULT_CONDITIONS_SET;
|
|
1638
952
|
|
|
1639
|
-
// Handle protocol-prefixed specifiers (node:, data:, http:, https:, ${
|
|
1640
|
-
if (/^(?:node|data|https?|${
|
|
953
|
+
// Handle protocol-prefixed specifiers (node:, data:, http:, https:, ${e.config.framework}:)
|
|
954
|
+
if (/^(?:node|data|https?|${e.config.framework}):/.test(specifier)) {
|
|
1641
955
|
return specifier;
|
|
1642
956
|
}
|
|
1643
957
|
|
|
@@ -1665,12 +979,12 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1665
979
|
|
|
1666
980
|
const roots = [parentURL ?? pathToFileURL(join(process.cwd(), "_"))];
|
|
1667
981
|
|
|
1668
|
-
const projectRootURL = pathToFileURL("${
|
|
982
|
+
const projectRootURL = pathToFileURL("${e.config.root}");
|
|
1669
983
|
if (!roots.some(root => root.href === projectRootURL.href)) {
|
|
1670
984
|
roots.push(projectRootURL);
|
|
1671
985
|
}
|
|
1672
986
|
|
|
1673
|
-
const workspaceRootURL = pathToFileURL("${
|
|
987
|
+
const workspaceRootURL = pathToFileURL("${e.config.cwd}");
|
|
1674
988
|
if (!roots.some(root => root.href === workspaceRootURL.href)) {
|
|
1675
989
|
roots.push(workspaceRootURL);
|
|
1676
990
|
}
|
|
@@ -1728,123 +1042,4 @@ function ResolveModuleFunctionDeclaration() {
|
|
|
1728
1042
|
}
|
|
1729
1043
|
|
|
1730
1044
|
return pathToFileURL(fileURLToPath(resolved)).href;
|
|
1731
|
-
|
|
1732
|
-
}
|
|
1733
|
-
})
|
|
1734
|
-
];
|
|
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
|
-
];
|
|
1741
|
-
/**
|
|
1742
|
-
* A built-in utilities module for Shell Shock.
|
|
1743
|
-
*/
|
|
1744
|
-
function UtilsBuiltin(props) {
|
|
1745
|
-
const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
|
|
1746
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
1747
|
-
id: "utils",
|
|
1748
|
-
description: "A collection of helper utilities that ease command-line application development."
|
|
1749
|
-
}, rest, {
|
|
1750
|
-
get imports() {
|
|
1751
|
-
return (0, defu.default)(rest.imports ?? {}, {
|
|
1752
|
-
"node:os": "os",
|
|
1753
|
-
"node:process": "process",
|
|
1754
|
-
"node:path": [
|
|
1755
|
-
"join",
|
|
1756
|
-
"sep",
|
|
1757
|
-
"isAbsolute"
|
|
1758
|
-
],
|
|
1759
|
-
"node:fs": [
|
|
1760
|
-
{
|
|
1761
|
-
name: "constants",
|
|
1762
|
-
alias: "fsConstants"
|
|
1763
|
-
},
|
|
1764
|
-
"openSync",
|
|
1765
|
-
"closeSync",
|
|
1766
|
-
"read",
|
|
1767
|
-
"readFileSync",
|
|
1768
|
-
"statSync",
|
|
1769
|
-
"realpathSync"
|
|
1770
|
-
],
|
|
1771
|
-
"node:tty": ["WriteStream"],
|
|
1772
|
-
"node:url": ["fileURLToPath", "pathToFileURL"],
|
|
1773
|
-
"node:module": ["builtinModules"]
|
|
1774
|
-
});
|
|
1775
|
-
},
|
|
1776
|
-
get builtinImports() {
|
|
1777
|
-
return (0, defu.default)(rest.builtinImports ?? {}, {
|
|
1778
|
-
env: [
|
|
1779
|
-
"env",
|
|
1780
|
-
"isCI",
|
|
1781
|
-
"isTest",
|
|
1782
|
-
"isWindows",
|
|
1783
|
-
"isLinux",
|
|
1784
|
-
"isMacOS"
|
|
1785
|
-
],
|
|
1786
|
-
exec: ["execSync"],
|
|
1787
|
-
state: ["hasFlag"]
|
|
1788
|
-
});
|
|
1789
|
-
},
|
|
1790
|
-
get children() {
|
|
1791
|
-
return [
|
|
1792
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
1793
|
-
heading: "A utility function to pause execution for a specified duration, which can be used in prompt interactions to create delays or timeouts. The function returns a promise that resolves after the specified duration in milliseconds, allowing it to be used with async/await syntax for easier handling of asynchronous prompt logic.",
|
|
1794
|
-
get children() {
|
|
1795
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
1796
|
-
name: "durationMs",
|
|
1797
|
-
children: `The duration to sleep in milliseconds.`
|
|
1798
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `A promise that resolves after the specified duration, allowing for asynchronous delays in prompt interactions.` })];
|
|
1799
|
-
}
|
|
1800
|
-
}),
|
|
1801
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
1802
|
-
"export": true,
|
|
1803
|
-
name: "sleep",
|
|
1804
|
-
parameters: [{
|
|
1805
|
-
name: "durationMs",
|
|
1806
|
-
type: "number"
|
|
1807
|
-
}],
|
|
1808
|
-
returnType: "Promise<void>",
|
|
1809
|
-
children: _alloy_js_core.code`return new Promise((resolve) => setTimeout(resolve, durationMs)); `
|
|
1810
|
-
}),
|
|
1811
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1812
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(TerminalSizeDeclaration, {}),
|
|
1813
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1814
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(EnvSupportUtilities, {}),
|
|
1815
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1816
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(HyperlinkSupportUtilities, {}),
|
|
1817
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1818
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(ColorSupportUtilities, {}),
|
|
1819
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1820
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(ResolveModuleFunctionDeclaration, {}),
|
|
1821
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1822
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(FindSuggestionsDeclaration, {}),
|
|
1823
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
1824
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
1825
|
-
get when() {
|
|
1826
|
-
return Boolean(children);
|
|
1827
|
-
},
|
|
1828
|
-
children
|
|
1829
|
-
})
|
|
1830
|
-
];
|
|
1831
|
-
}
|
|
1832
|
-
}));
|
|
1833
|
-
}
|
|
1834
|
-
UtilsBuiltin.__type = [
|
|
1835
|
-
() => __ΩUtilsBuiltinProps,
|
|
1836
|
-
"props",
|
|
1837
|
-
"UtilsBuiltin",
|
|
1838
|
-
"A built-in utilities module for Shell Shock.",
|
|
1839
|
-
"Pn!2\"\"/#?$"
|
|
1840
|
-
];
|
|
1841
|
-
|
|
1842
|
-
//#endregion
|
|
1843
|
-
exports.ColorSupportUtilities = ColorSupportUtilities;
|
|
1844
|
-
exports.EnvSupportUtilities = EnvSupportUtilities;
|
|
1845
|
-
exports.FindSuggestionsDeclaration = FindSuggestionsDeclaration;
|
|
1846
|
-
exports.HyperlinkSupportUtilities = HyperlinkSupportUtilities;
|
|
1847
|
-
exports.ResolveModuleFunctionDeclaration = ResolveModuleFunctionDeclaration;
|
|
1848
|
-
exports.TerminalSizeDeclaration = TerminalSizeDeclaration;
|
|
1849
|
-
exports.UtilsBuiltin = UtilsBuiltin;
|
|
1850
|
-
exports.__ΩUtilsBuiltinProps = __ΩUtilsBuiltinProps;
|
|
1045
|
+
`}})]}v.__type=[`ResolveModuleFunctionDeclaration`,"Generates the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.",`P"/!?"`];function y(e){let[{children:a},l]=(0,r.splitProps)(e,[`children`]);return(0,t.createComponent)(s.BuiltinFile,(0,t.mergeProps)({id:`utils`,description:`A collection of helper utilities that ease command-line application development.`},l,{get imports(){return(0,n.default)(l.imports??{},{"node:os":`os`,"node:process":`process`,"node:path":[`join`,`sep`,`isAbsolute`],"node:fs":[{name:`constants`,alias:`fsConstants`},`openSync`,`closeSync`,`read`,`readFileSync`,`statSync`,`realpathSync`],"node:tty":[`WriteStream`],"node:url":[`fileURLToPath`,`pathToFileURL`],"node:module":[`builtinModules`]})},get builtinImports(){return(0,n.default)(l.builtinImports??{},{env:[`env`,`isCI`,`isTest`,`isWindows`,`isLinux`,`isMacOS`],exec:[`execSync`],state:[`hasFlag`]})},get children(){return[(0,t.createComponent)(c.TSDoc,{heading:`A utility function to pause execution for a specified duration, which can be used in prompt interactions to create delays or timeouts. The function returns a promise that resolves after the specified duration in milliseconds, allowing it to be used with async/await syntax for easier handling of asynchronous prompt logic.`,get children(){return[(0,t.createComponent)(c.TSDocParam,{name:`durationMs`,children:`The duration to sleep in milliseconds.`}),(0,t.createComponent)(c.TSDocReturns,{children:`A promise that resolves after the specified duration, allowing for asynchronous delays in prompt interactions.`})]}}),(0,t.createComponent)(o.FunctionDeclaration,{export:!0,name:`sleep`,parameters:[{name:`durationMs`,type:`number`}],returnType:`Promise<void>`,children:r.code`return new Promise((resolve) => setTimeout(resolve, durationMs)); `}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(m,{}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(h,{}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(_,{}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(g,{}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(v,{}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(p,{}),(0,t.createComponent)(i.Spacing,{}),(0,t.createComponent)(r.Show,{get when(){return!!a},children:a})]}}))}y.__type=[()=>f,`props`,`UtilsBuiltin`,`A built-in utilities module for Shell Shock.`,`Pn!2""/#?$`],exports.ColorSupportUtilities=g,exports.EnvSupportUtilities=h,exports.FindSuggestionsDeclaration=p,exports.HyperlinkSupportUtilities=_,exports.ResolveModuleFunctionDeclaration=v,exports.TerminalSizeDeclaration=m,exports.UtilsBuiltin=y,exports.__ΩUtilsBuiltinProps=f;
|