@shell-shock/core 0.17.7 → 0.17.8

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