@shell-shock/preset-script 0.2.1 → 0.3.0
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/components/bin-entry.cjs +0 -1
- package/dist/components/bin-entry.cjs.map +1 -1
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts.map +1 -1
- package/dist/components/bin-entry.mjs +0 -1
- package/dist/components/bin-entry.mjs.map +1 -1
- package/dist/components/command-entry.d.mts +4 -4
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-router.cjs +2 -2
- package/dist/components/command-router.cjs.map +1 -1
- package/dist/components/command-router.mjs +2 -2
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/console-builtin.cjs +246 -34
- package/dist/components/console-builtin.cjs.map +1 -1
- package/dist/components/console-builtin.d.cts +12 -2
- package/dist/components/console-builtin.d.cts.map +1 -1
- package/dist/components/console-builtin.d.mts +12 -2
- package/dist/components/console-builtin.d.mts.map +1 -1
- package/dist/components/console-builtin.mjs +247 -36
- package/dist/components/console-builtin.mjs.map +1 -1
- package/dist/components/help.cjs +4 -4
- package/dist/components/help.cjs.map +1 -1
- package/dist/components/help.mjs +4 -4
- package/dist/components/help.mjs.map +1 -1
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/components/utils-builtin.cjs +18 -16
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +7 -7
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +18 -16
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/helpers/ansi-utils.cjs +74 -10
- package/dist/helpers/ansi-utils.cjs.map +1 -1
- package/dist/helpers/ansi-utils.mjs +74 -10
- package/dist/helpers/ansi-utils.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +20 -0
- package/dist/helpers/get-default-options.cjs.map +1 -1
- package/dist/helpers/get-default-options.mjs +20 -0
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +10 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +11 -9
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +10 -10
|
@@ -3,9 +3,13 @@ const require_contexts_theme = require('../contexts/theme.cjs');
|
|
|
3
3
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
4
|
let __alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
7
|
+
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
6
8
|
let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
7
9
|
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
10
|
+
let __shell_shock_core_contexts_command = require("@shell-shock/core/contexts/command");
|
|
8
11
|
let __powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
12
|
+
let __stryke_string_format_vowels = require("@stryke/string-format/vowels");
|
|
9
13
|
|
|
10
14
|
//#region src/components/console-builtin.tsx
|
|
11
15
|
/**
|
|
@@ -104,61 +108,216 @@ function ColorsDeclaration() {
|
|
|
104
108
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
105
109
|
__alloy_js_core.code`text: {
|
|
106
110
|
banner: {
|
|
107
|
-
|
|
111
|
+
header: {
|
|
112
|
+
primary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
108
113
|
get ansi16() {
|
|
109
|
-
return colors.ansi16.theme.text.banner.
|
|
114
|
+
return colors.ansi16.theme.text.banner.header.primary;
|
|
110
115
|
},
|
|
111
116
|
get ansi256() {
|
|
112
|
-
return colors.ansi256.theme.text.banner.
|
|
117
|
+
return colors.ansi256.theme.text.banner.header.primary;
|
|
113
118
|
},
|
|
114
119
|
get ansi16m() {
|
|
115
|
-
return colors.ansi16m.theme.text.banner.
|
|
120
|
+
return colors.ansi16m.theme.text.banner.header.primary;
|
|
116
121
|
}
|
|
117
122
|
})},
|
|
118
|
-
|
|
123
|
+
secondary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
119
124
|
get ansi16() {
|
|
120
|
-
return colors.ansi16.theme.text.banner.header;
|
|
125
|
+
return colors.ansi16.theme.text.banner.header.secondary;
|
|
121
126
|
},
|
|
122
127
|
get ansi256() {
|
|
123
|
-
return colors.ansi256.theme.text.banner.header;
|
|
128
|
+
return colors.ansi256.theme.text.banner.header.secondary;
|
|
124
129
|
},
|
|
125
130
|
get ansi16m() {
|
|
126
|
-
return colors.ansi16m.theme.text.banner.header;
|
|
131
|
+
return colors.ansi16m.theme.text.banner.header.secondary;
|
|
127
132
|
}
|
|
128
133
|
})},
|
|
129
|
-
|
|
134
|
+
tertiary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
130
135
|
get ansi16() {
|
|
131
|
-
return colors.ansi16.theme.text.banner.
|
|
136
|
+
return colors.ansi16.theme.text.banner.header.tertiary;
|
|
132
137
|
},
|
|
133
138
|
get ansi256() {
|
|
134
|
-
return colors.ansi256.theme.text.banner.
|
|
139
|
+
return colors.ansi256.theme.text.banner.header.tertiary;
|
|
135
140
|
},
|
|
136
141
|
get ansi16m() {
|
|
137
|
-
return colors.ansi16m.theme.text.banner.
|
|
142
|
+
return colors.ansi16m.theme.text.banner.header.tertiary;
|
|
143
|
+
}
|
|
144
|
+
})}
|
|
145
|
+
},
|
|
146
|
+
footer: {
|
|
147
|
+
primary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
148
|
+
get ansi16() {
|
|
149
|
+
return colors.ansi16.theme.text.banner.footer.primary;
|
|
150
|
+
},
|
|
151
|
+
get ansi256() {
|
|
152
|
+
return colors.ansi256.theme.text.banner.footer.primary;
|
|
153
|
+
},
|
|
154
|
+
get ansi16m() {
|
|
155
|
+
return colors.ansi16m.theme.text.banner.footer.primary;
|
|
138
156
|
}
|
|
139
157
|
})},
|
|
140
|
-
|
|
158
|
+
secondary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
141
159
|
get ansi16() {
|
|
142
|
-
return colors.ansi16.theme.text.banner.
|
|
160
|
+
return colors.ansi16.theme.text.banner.footer.secondary;
|
|
143
161
|
},
|
|
144
162
|
get ansi256() {
|
|
145
|
-
return colors.ansi256.theme.text.banner.
|
|
163
|
+
return colors.ansi256.theme.text.banner.footer.secondary;
|
|
146
164
|
},
|
|
147
165
|
get ansi16m() {
|
|
148
|
-
return colors.ansi16m.theme.text.banner.
|
|
166
|
+
return colors.ansi16m.theme.text.banner.footer.secondary;
|
|
149
167
|
}
|
|
150
168
|
})},
|
|
151
|
-
|
|
169
|
+
tertiary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
152
170
|
get ansi16() {
|
|
153
|
-
return colors.ansi16.theme.text.banner.
|
|
171
|
+
return colors.ansi16.theme.text.banner.footer.tertiary;
|
|
154
172
|
},
|
|
155
173
|
get ansi256() {
|
|
156
|
-
return colors.ansi256.theme.text.banner.
|
|
174
|
+
return colors.ansi256.theme.text.banner.footer.tertiary;
|
|
157
175
|
},
|
|
158
176
|
get ansi16m() {
|
|
159
|
-
return colors.ansi16m.theme.text.banner.
|
|
177
|
+
return colors.ansi16m.theme.text.banner.footer.tertiary;
|
|
160
178
|
}
|
|
161
179
|
})}
|
|
180
|
+
},
|
|
181
|
+
command: {
|
|
182
|
+
primary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
183
|
+
get ansi16() {
|
|
184
|
+
return colors.ansi16.theme.text.banner.command.primary;
|
|
185
|
+
},
|
|
186
|
+
get ansi256() {
|
|
187
|
+
return colors.ansi256.theme.text.banner.command.primary;
|
|
188
|
+
},
|
|
189
|
+
get ansi16m() {
|
|
190
|
+
return colors.ansi16m.theme.text.banner.command.primary;
|
|
191
|
+
}
|
|
192
|
+
})},
|
|
193
|
+
secondary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
194
|
+
get ansi16() {
|
|
195
|
+
return colors.ansi16.theme.text.banner.command.secondary;
|
|
196
|
+
},
|
|
197
|
+
get ansi256() {
|
|
198
|
+
return colors.ansi256.theme.text.banner.command.secondary;
|
|
199
|
+
},
|
|
200
|
+
get ansi16m() {
|
|
201
|
+
return colors.ansi16m.theme.text.banner.command.secondary;
|
|
202
|
+
}
|
|
203
|
+
})},
|
|
204
|
+
tertiary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
205
|
+
get ansi16() {
|
|
206
|
+
return colors.ansi16.theme.text.banner.command.tertiary;
|
|
207
|
+
},
|
|
208
|
+
get ansi256() {
|
|
209
|
+
return colors.ansi256.theme.text.banner.command.tertiary;
|
|
210
|
+
},
|
|
211
|
+
get ansi16m() {
|
|
212
|
+
return colors.ansi16m.theme.text.banner.command.tertiary;
|
|
213
|
+
}
|
|
214
|
+
})},
|
|
215
|
+
},
|
|
216
|
+
title: {
|
|
217
|
+
primary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
218
|
+
get ansi16() {
|
|
219
|
+
return colors.ansi16.theme.text.banner.title.primary;
|
|
220
|
+
},
|
|
221
|
+
get ansi256() {
|
|
222
|
+
return colors.ansi256.theme.text.banner.title.primary;
|
|
223
|
+
},
|
|
224
|
+
get ansi16m() {
|
|
225
|
+
return colors.ansi16m.theme.text.banner.title.primary;
|
|
226
|
+
}
|
|
227
|
+
})},
|
|
228
|
+
secondary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
229
|
+
get ansi16() {
|
|
230
|
+
return colors.ansi16.theme.text.banner.title.secondary;
|
|
231
|
+
},
|
|
232
|
+
get ansi256() {
|
|
233
|
+
return colors.ansi256.theme.text.banner.title.secondary;
|
|
234
|
+
},
|
|
235
|
+
get ansi16m() {
|
|
236
|
+
return colors.ansi16m.theme.text.banner.title.secondary;
|
|
237
|
+
}
|
|
238
|
+
})},
|
|
239
|
+
tertiary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
240
|
+
get ansi16() {
|
|
241
|
+
return colors.ansi16.theme.text.banner.title.tertiary;
|
|
242
|
+
},
|
|
243
|
+
get ansi256() {
|
|
244
|
+
return colors.ansi256.theme.text.banner.title.tertiary;
|
|
245
|
+
},
|
|
246
|
+
get ansi16m() {
|
|
247
|
+
return colors.ansi16m.theme.text.banner.title.tertiary;
|
|
248
|
+
}
|
|
249
|
+
})},
|
|
250
|
+
},
|
|
251
|
+
link: {
|
|
252
|
+
primary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
253
|
+
get ansi16() {
|
|
254
|
+
return colors.ansi16.theme.text.banner.link.primary;
|
|
255
|
+
},
|
|
256
|
+
get ansi256() {
|
|
257
|
+
return colors.ansi256.theme.text.banner.link.primary;
|
|
258
|
+
},
|
|
259
|
+
get ansi16m() {
|
|
260
|
+
return colors.ansi16m.theme.text.banner.link.primary;
|
|
261
|
+
}
|
|
262
|
+
})},
|
|
263
|
+
secondary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
264
|
+
get ansi16() {
|
|
265
|
+
return colors.ansi16.theme.text.banner.link.secondary;
|
|
266
|
+
},
|
|
267
|
+
get ansi256() {
|
|
268
|
+
return colors.ansi256.theme.text.banner.link.secondary;
|
|
269
|
+
},
|
|
270
|
+
get ansi16m() {
|
|
271
|
+
return colors.ansi16m.theme.text.banner.link.secondary;
|
|
272
|
+
}
|
|
273
|
+
})},
|
|
274
|
+
tertiary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
275
|
+
get ansi16() {
|
|
276
|
+
return colors.ansi16.theme.text.banner.link.tertiary;
|
|
277
|
+
},
|
|
278
|
+
get ansi256() {
|
|
279
|
+
return colors.ansi256.theme.text.banner.link.tertiary;
|
|
280
|
+
},
|
|
281
|
+
get ansi16m() {
|
|
282
|
+
return colors.ansi16m.theme.text.banner.link.tertiary;
|
|
283
|
+
}
|
|
284
|
+
})},
|
|
285
|
+
},
|
|
286
|
+
description: {
|
|
287
|
+
primary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
288
|
+
get ansi16() {
|
|
289
|
+
return colors.ansi16.theme.text.banner.description.primary;
|
|
290
|
+
},
|
|
291
|
+
get ansi256() {
|
|
292
|
+
return colors.ansi256.theme.text.banner.description.primary;
|
|
293
|
+
},
|
|
294
|
+
get ansi16m() {
|
|
295
|
+
return colors.ansi16m.theme.text.banner.description.primary;
|
|
296
|
+
}
|
|
297
|
+
})},
|
|
298
|
+
secondary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
299
|
+
get ansi16() {
|
|
300
|
+
return colors.ansi16.theme.text.banner.description.secondary;
|
|
301
|
+
},
|
|
302
|
+
get ansi256() {
|
|
303
|
+
return colors.ansi256.theme.text.banner.description.secondary;
|
|
304
|
+
},
|
|
305
|
+
get ansi16m() {
|
|
306
|
+
return colors.ansi16m.theme.text.banner.description.secondary;
|
|
307
|
+
}
|
|
308
|
+
})},
|
|
309
|
+
tertiary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
310
|
+
get ansi16() {
|
|
311
|
+
return colors.ansi16.theme.text.banner.description.tertiary;
|
|
312
|
+
},
|
|
313
|
+
get ansi256() {
|
|
314
|
+
return colors.ansi256.theme.text.banner.description.tertiary;
|
|
315
|
+
},
|
|
316
|
+
get ansi16m() {
|
|
317
|
+
return colors.ansi16m.theme.text.banner.description.tertiary;
|
|
318
|
+
}
|
|
319
|
+
})},
|
|
320
|
+
}
|
|
162
321
|
},
|
|
163
322
|
heading: {
|
|
164
323
|
primary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
@@ -193,7 +352,7 @@ function ColorsDeclaration() {
|
|
|
193
352
|
get ansi16m() {
|
|
194
353
|
return colors.ansi16m.theme.text.heading.tertiary;
|
|
195
354
|
}
|
|
196
|
-
})}
|
|
355
|
+
})},
|
|
197
356
|
},
|
|
198
357
|
body: {
|
|
199
358
|
primary: ${(0, __alloy_js_core_jsx_runtime.createComponent)(ColorFunction, {
|
|
@@ -1115,17 +1274,11 @@ consoleFn(\`\${" ".repeat(Math.max(options.padding ?? ${theme.padding.app}, 0))}
|
|
|
1115
1274
|
* A component to generate the message functions in the `shell-shock:console` builtin module.
|
|
1116
1275
|
*/
|
|
1117
1276
|
function MessageFunctionDeclaration(props) {
|
|
1118
|
-
const { type, variant, consoleFnName, description, prefix, parameters } = props;
|
|
1277
|
+
const { type, variant, consoleFnName, description, prefix, parameters, timestamp } = props;
|
|
1119
1278
|
const theme = require_contexts_theme.useTheme();
|
|
1120
1279
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
1121
1280
|
get heading() {
|
|
1122
|
-
return `Write ${
|
|
1123
|
-
"a",
|
|
1124
|
-
"e",
|
|
1125
|
-
"i",
|
|
1126
|
-
"o",
|
|
1127
|
-
"u"
|
|
1128
|
-
].includes(description.charAt(0)) ? "an" : "a"} ${description} message to the console.`;
|
|
1281
|
+
return `Write ${(0, __stryke_string_format_vowels.getIndefiniteArticle)(description)} ${description} message to the console.`;
|
|
1129
1282
|
},
|
|
1130
1283
|
get children() {
|
|
1131
1284
|
return [
|
|
@@ -1162,19 +1315,69 @@ function MessageFunctionDeclaration(props) {
|
|
|
1162
1315
|
return;
|
|
1163
1316
|
}
|
|
1164
1317
|
|
|
1165
|
-
|
|
1318
|
+
${!theme.labels.message.footer[variant] && timestamp ? `const timestamp = \`\${colors.text.message.footer.${variant}(new Date().toLocaleDateString())} \${colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}")} \${colors.text.message.footer.${variant}(new Date().toLocaleTimeString())}\`; ` : ""}
|
|
1319
|
+
writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].topLeft}") + ${theme.labels.message.header[variant] || theme.icons.message.header[variant] ? `colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].top}".repeat(4)) + " " + ${theme.icons.message.header[variant] ? `colors.border.message.outline.${variant}("${theme.icons.message.header[variant]}") + " " +` : ""} colors.text.message.header.${variant}("${theme.labels.message.header[variant]}") + " " + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + 4 + (theme.icons.message.header[variant] ? theme.icons.message.header[variant].length + 1 + (theme.labels.message.header[variant] ? 0 : 1) : 0) + (theme.labels.message.header[variant] ? theme.labels.message.header[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0)))` : `colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].topLeft.length + theme.borderStyles.message.outline[variant].topRight.length}, 0)))`} + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
|
|
1166
1320
|
splitText(
|
|
1167
1321
|
message,
|
|
1168
1322
|
Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.message, 0)) * 2 + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}, 0)
|
|
1169
1323
|
).forEach((line) => {
|
|
1170
|
-
writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") +
|
|
1324
|
+
writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].left + " ".repeat(Math.max(theme.padding.message, 0))}") + colors.text.message.description.${variant}(line) + " ".repeat(Math.max(process.stdout.columns - (stripAnsi(line).length + ${Math.max(theme.padding.app, 0) * 2 + Math.max(theme.padding.message, 0) + theme.borderStyles.message.outline[variant].left.length + theme.borderStyles.message.outline[variant].right.length}), 0)) + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
1171
1325
|
});
|
|
1172
|
-
writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottomLeft}") + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${
|
|
1326
|
+
writeLine(colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottomLeft}") + ${theme.labels.message.footer[variant] || timestamp ? `colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + 4 + (theme.labels.message.footer[variant] ? theme.labels.message.footer[variant].length + 2 : 0) + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}${!theme.labels.message.footer[variant] && timestamp ? " - (stripAnsi(timestamp).length + 2)" : ""}, 0))) + " " + ${theme.labels.message.footer[variant] ? `colors.text.message.footer.${variant}("${theme.labels.message.footer[variant]}")` : timestamp && "timestamp"} + " " + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}".repeat(4))` : `colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.message.outline[variant].bottomLeft.length + theme.borderStyles.message.outline[variant].bottomRight.length}, 0)))`} + colors.border.message.outline.${variant}("${theme.borderStyles.message.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
|
|
1173
1327
|
`)];
|
|
1174
1328
|
}
|
|
1175
1329
|
})];
|
|
1176
1330
|
}
|
|
1177
1331
|
/**
|
|
1332
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
1333
|
+
*/
|
|
1334
|
+
function BannerFunctionDeclaration(props) {
|
|
1335
|
+
const { consoleFnName = "log", variant = "primary", title: titleProp } = props;
|
|
1336
|
+
const theme = require_contexts_theme.useTheme();
|
|
1337
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
1338
|
+
const command = (0, __shell_shock_core_contexts_command.useCommand)();
|
|
1339
|
+
const header = (0, __alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} v${context.packageJson.version || "1.0.0"}`);
|
|
1340
|
+
const description = (0, __alloy_js_core.computed)(() => command?.description || (0, __shell_shock_core_plugin_utils_context_helpers.getAppDescription)(context));
|
|
1341
|
+
const footer = (0, __alloy_js_core.computed)(() => theme.labels.banner.footer[variant]);
|
|
1342
|
+
const title = (0, __alloy_js_core.computed)(() => titleProp || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
|
|
1343
|
+
const bannerPadding = (0, __alloy_js_core.computed)(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);
|
|
1344
|
+
const totalPadding = (0, __alloy_js_core.computed)(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
|
|
1345
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
1346
|
+
"export": true,
|
|
1347
|
+
name: "banner",
|
|
1348
|
+
doc: "Write the application banner to the console.",
|
|
1349
|
+
get children() {
|
|
1350
|
+
return __alloy_js_core.code`
|
|
1351
|
+
if (hasFlag("no-banner") || hasFlag("hide-banner") || isCI || isMinimal) {
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topLeft}") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(4)) + " " + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}("${theme.icons.banner.header[variant]}") + " " + colors.text.banner.header.${variant}("${theme.borderStyles.banner.outline[variant].top}") + " " +` : ""} colors.text.banner.header.${variant}("${header.value}") + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${4 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header.value ? header.value.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
|
|
1356
|
+
|
|
1357
|
+
splitText(
|
|
1358
|
+
colors.text.banner.title.${variant}("${title.value}"),
|
|
1359
|
+
Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
1360
|
+
).forEach((line) => {
|
|
1361
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
1362
|
+
});
|
|
1363
|
+
|
|
1364
|
+
${command?.title ? `writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomLeft}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
|
|
1365
|
+
|
|
1366
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.command.${variant}("${command.title}") + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); ` : ""}
|
|
1367
|
+
|
|
1368
|
+
splitText(
|
|
1369
|
+
${command?.title ? "colors.text.banner.description" : "colors.text.banner.command"}.${variant}("${description.value.replace(/"/g, "\\\"")}"),
|
|
1370
|
+
Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
1371
|
+
).forEach((line) => {
|
|
1372
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
1373
|
+
});
|
|
1374
|
+
|
|
1375
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomLeft}") + ${footer.value ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${4 + (footer.value ? footer.value.length : 0) + bannerPadding.value}, 0))) + " " + ${footer.value ? `colors.text.banner.footer.${variant}("${footer.value}")` : ""} + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(4))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
|
|
1376
|
+
`;
|
|
1377
|
+
}
|
|
1378
|
+
})];
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1178
1381
|
* A component to generate the `wrapAnsi` function in the `shell-shock:console` builtin module.
|
|
1179
1382
|
*/
|
|
1180
1383
|
function WrapAnsiFunction() {
|
|
@@ -1884,7 +2087,7 @@ do {
|
|
|
1884
2087
|
|
|
1885
2088
|
const lines = splitText(
|
|
1886
2089
|
cell.value,
|
|
1887
|
-
Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2
|
|
2090
|
+
Math.max(process.stdout.columns - ${Math.max(theme.padding.app, 0) * 2} - (colWidths.filter((_, i) => i !== colIndex).reduce((a, b) => a + b, 0)) - cell.padding * 2, 0)
|
|
1888
2091
|
);
|
|
1889
2092
|
|
|
1890
2093
|
cell.value = lines.join("\\n");
|
|
@@ -1953,6 +2156,7 @@ function ConsoleBuiltin() {
|
|
|
1953
2156
|
builtinImports: {
|
|
1954
2157
|
utils: [
|
|
1955
2158
|
"hasFlag",
|
|
2159
|
+
"isMinimal",
|
|
1956
2160
|
"isColorSupported",
|
|
1957
2161
|
"colorSupportLevels",
|
|
1958
2162
|
"isHyperlinkSupported"
|
|
@@ -1960,7 +2164,8 @@ function ConsoleBuiltin() {
|
|
|
1960
2164
|
env: [
|
|
1961
2165
|
"env",
|
|
1962
2166
|
"isDevelopment",
|
|
1963
|
-
"isDebug"
|
|
2167
|
+
"isDebug",
|
|
2168
|
+
"isCI"
|
|
1964
2169
|
]
|
|
1965
2170
|
},
|
|
1966
2171
|
get children() {
|
|
@@ -1983,6 +2188,9 @@ function ConsoleBuiltin() {
|
|
|
1983
2188
|
(0, __alloy_js_core_jsx_runtime.createComponent)(DividerFunctionDeclaration, {}),
|
|
1984
2189
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1985
2190
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2191
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(BannerFunctionDeclaration, {}),
|
|
2192
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
2193
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
1986
2194
|
(0, __alloy_js_core_jsx_runtime.createComponent)(MessageFunctionDeclaration, {
|
|
1987
2195
|
type: "help",
|
|
1988
2196
|
variant: "help",
|
|
@@ -2012,6 +2220,7 @@ function ConsoleBuiltin() {
|
|
|
2012
2220
|
variant: "debug",
|
|
2013
2221
|
consoleFnName: "debug",
|
|
2014
2222
|
description: "debug",
|
|
2223
|
+
timestamp: true,
|
|
2015
2224
|
get prefix() {
|
|
2016
2225
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
2017
2226
|
condition: __alloy_js_core.code`!isDevelopment && !isDebug && env.LOG_LEVEL !== "debug"`,
|
|
@@ -2026,6 +2235,7 @@ function ConsoleBuiltin() {
|
|
|
2026
2235
|
variant: "debug",
|
|
2027
2236
|
consoleFnName: "debug",
|
|
2028
2237
|
description: "verbose",
|
|
2238
|
+
timestamp: true,
|
|
2029
2239
|
get prefix() {
|
|
2030
2240
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
2031
2241
|
condition: __alloy_js_core.code`!(isDevelopment || isDebug || env.LOG_LEVEL === "debug" || hasFlag(["verbose", "verbose=true", "verbose=always"]))`,
|
|
@@ -2056,6 +2266,7 @@ function ConsoleBuiltin() {
|
|
|
2056
2266
|
variant: "error",
|
|
2057
2267
|
consoleFnName: "error",
|
|
2058
2268
|
description: "error",
|
|
2269
|
+
timestamp: true,
|
|
2059
2270
|
parameters: [{
|
|
2060
2271
|
name: "err",
|
|
2061
2272
|
type: "string | Error",
|
|
@@ -2094,6 +2305,7 @@ function ConsoleBuiltin() {
|
|
|
2094
2305
|
}
|
|
2095
2306
|
|
|
2096
2307
|
//#endregion
|
|
2308
|
+
exports.BannerFunctionDeclaration = BannerFunctionDeclaration;
|
|
2097
2309
|
exports.ColorsDeclaration = ColorsDeclaration;
|
|
2098
2310
|
exports.ConsoleBuiltin = ConsoleBuiltin;
|
|
2099
2311
|
exports.DividerFunctionDeclaration = DividerFunctionDeclaration;
|