@requence/task 1.0.0-alpha.1 → 1.0.0-alpha.2
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/build/cli.js +14 -497
- package/build/cli.js.map +4 -8
- package/build/index.js +11 -4
- package/build/index.js.map +4 -4
- package/build/types/task/src/index.d.ts +20 -0
- package/build/types/task/src/index.d.ts.map +1 -1
- package/build/types/task/src/types.d.ts +104 -0
- package/build/types/task/src/types.d.ts.map +1 -1
- package/package.json +2 -1
package/build/cli.js
CHANGED
|
@@ -7,490 +7,7 @@ import {
|
|
|
7
7
|
// src/cli.ts
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
|
-
|
|
11
|
-
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
12
|
-
var ANSI_BACKGROUND_OFFSET = 10;
|
|
13
|
-
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
14
|
-
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
15
|
-
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
16
|
-
var styles = {
|
|
17
|
-
modifier: {
|
|
18
|
-
reset: [0, 0],
|
|
19
|
-
bold: [1, 22],
|
|
20
|
-
dim: [2, 22],
|
|
21
|
-
italic: [3, 23],
|
|
22
|
-
underline: [4, 24],
|
|
23
|
-
overline: [53, 55],
|
|
24
|
-
inverse: [7, 27],
|
|
25
|
-
hidden: [8, 28],
|
|
26
|
-
strikethrough: [9, 29]
|
|
27
|
-
},
|
|
28
|
-
color: {
|
|
29
|
-
black: [30, 39],
|
|
30
|
-
red: [31, 39],
|
|
31
|
-
green: [32, 39],
|
|
32
|
-
yellow: [33, 39],
|
|
33
|
-
blue: [34, 39],
|
|
34
|
-
magenta: [35, 39],
|
|
35
|
-
cyan: [36, 39],
|
|
36
|
-
white: [37, 39],
|
|
37
|
-
blackBright: [90, 39],
|
|
38
|
-
gray: [90, 39],
|
|
39
|
-
grey: [90, 39],
|
|
40
|
-
redBright: [91, 39],
|
|
41
|
-
greenBright: [92, 39],
|
|
42
|
-
yellowBright: [93, 39],
|
|
43
|
-
blueBright: [94, 39],
|
|
44
|
-
magentaBright: [95, 39],
|
|
45
|
-
cyanBright: [96, 39],
|
|
46
|
-
whiteBright: [97, 39]
|
|
47
|
-
},
|
|
48
|
-
bgColor: {
|
|
49
|
-
bgBlack: [40, 49],
|
|
50
|
-
bgRed: [41, 49],
|
|
51
|
-
bgGreen: [42, 49],
|
|
52
|
-
bgYellow: [43, 49],
|
|
53
|
-
bgBlue: [44, 49],
|
|
54
|
-
bgMagenta: [45, 49],
|
|
55
|
-
bgCyan: [46, 49],
|
|
56
|
-
bgWhite: [47, 49],
|
|
57
|
-
bgBlackBright: [100, 49],
|
|
58
|
-
bgGray: [100, 49],
|
|
59
|
-
bgGrey: [100, 49],
|
|
60
|
-
bgRedBright: [101, 49],
|
|
61
|
-
bgGreenBright: [102, 49],
|
|
62
|
-
bgYellowBright: [103, 49],
|
|
63
|
-
bgBlueBright: [104, 49],
|
|
64
|
-
bgMagentaBright: [105, 49],
|
|
65
|
-
bgCyanBright: [106, 49],
|
|
66
|
-
bgWhiteBright: [107, 49]
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
var modifierNames = Object.keys(styles.modifier);
|
|
70
|
-
var foregroundColorNames = Object.keys(styles.color);
|
|
71
|
-
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
72
|
-
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
73
|
-
function assembleStyles() {
|
|
74
|
-
const codes = new Map;
|
|
75
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
76
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
77
|
-
styles[styleName] = {
|
|
78
|
-
open: `\x1B[${style[0]}m`,
|
|
79
|
-
close: `\x1B[${style[1]}m`
|
|
80
|
-
};
|
|
81
|
-
group[styleName] = styles[styleName];
|
|
82
|
-
codes.set(style[0], style[1]);
|
|
83
|
-
}
|
|
84
|
-
Object.defineProperty(styles, groupName, {
|
|
85
|
-
value: group,
|
|
86
|
-
enumerable: false
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
Object.defineProperty(styles, "codes", {
|
|
90
|
-
value: codes,
|
|
91
|
-
enumerable: false
|
|
92
|
-
});
|
|
93
|
-
styles.color.close = "\x1B[39m";
|
|
94
|
-
styles.bgColor.close = "\x1B[49m";
|
|
95
|
-
styles.color.ansi = wrapAnsi16();
|
|
96
|
-
styles.color.ansi256 = wrapAnsi256();
|
|
97
|
-
styles.color.ansi16m = wrapAnsi16m();
|
|
98
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
99
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
100
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
101
|
-
Object.defineProperties(styles, {
|
|
102
|
-
rgbToAnsi256: {
|
|
103
|
-
value(red, green, blue) {
|
|
104
|
-
if (red === green && green === blue) {
|
|
105
|
-
if (red < 8) {
|
|
106
|
-
return 16;
|
|
107
|
-
}
|
|
108
|
-
if (red > 248) {
|
|
109
|
-
return 231;
|
|
110
|
-
}
|
|
111
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
112
|
-
}
|
|
113
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
114
|
-
},
|
|
115
|
-
enumerable: false
|
|
116
|
-
},
|
|
117
|
-
hexToRgb: {
|
|
118
|
-
value(hex) {
|
|
119
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
120
|
-
if (!matches) {
|
|
121
|
-
return [0, 0, 0];
|
|
122
|
-
}
|
|
123
|
-
let [colorString] = matches;
|
|
124
|
-
if (colorString.length === 3) {
|
|
125
|
-
colorString = [...colorString].map((character) => character + character).join("");
|
|
126
|
-
}
|
|
127
|
-
const integer = Number.parseInt(colorString, 16);
|
|
128
|
-
return [
|
|
129
|
-
integer >> 16 & 255,
|
|
130
|
-
integer >> 8 & 255,
|
|
131
|
-
integer & 255
|
|
132
|
-
];
|
|
133
|
-
},
|
|
134
|
-
enumerable: false
|
|
135
|
-
},
|
|
136
|
-
hexToAnsi256: {
|
|
137
|
-
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
138
|
-
enumerable: false
|
|
139
|
-
},
|
|
140
|
-
ansi256ToAnsi: {
|
|
141
|
-
value(code) {
|
|
142
|
-
if (code < 8) {
|
|
143
|
-
return 30 + code;
|
|
144
|
-
}
|
|
145
|
-
if (code < 16) {
|
|
146
|
-
return 90 + (code - 8);
|
|
147
|
-
}
|
|
148
|
-
let red;
|
|
149
|
-
let green;
|
|
150
|
-
let blue;
|
|
151
|
-
if (code >= 232) {
|
|
152
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
153
|
-
green = red;
|
|
154
|
-
blue = red;
|
|
155
|
-
} else {
|
|
156
|
-
code -= 16;
|
|
157
|
-
const remainder = code % 36;
|
|
158
|
-
red = Math.floor(code / 36) / 5;
|
|
159
|
-
green = Math.floor(remainder / 6) / 5;
|
|
160
|
-
blue = remainder % 6 / 5;
|
|
161
|
-
}
|
|
162
|
-
const value = Math.max(red, green, blue) * 2;
|
|
163
|
-
if (value === 0) {
|
|
164
|
-
return 30;
|
|
165
|
-
}
|
|
166
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
167
|
-
if (value === 2) {
|
|
168
|
-
result += 60;
|
|
169
|
-
}
|
|
170
|
-
return result;
|
|
171
|
-
},
|
|
172
|
-
enumerable: false
|
|
173
|
-
},
|
|
174
|
-
rgbToAnsi: {
|
|
175
|
-
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
176
|
-
enumerable: false
|
|
177
|
-
},
|
|
178
|
-
hexToAnsi: {
|
|
179
|
-
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
180
|
-
enumerable: false
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
return styles;
|
|
184
|
-
}
|
|
185
|
-
var ansiStyles = assembleStyles();
|
|
186
|
-
var ansi_styles_default = ansiStyles;
|
|
187
|
-
|
|
188
|
-
// ../../node_modules/chalk/source/vendor/supports-color/index.js
|
|
189
|
-
import process2 from "node:process";
|
|
190
|
-
import os from "node:os";
|
|
191
|
-
import tty from "node:tty";
|
|
192
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
193
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
194
|
-
const position = argv.indexOf(prefix + flag);
|
|
195
|
-
const terminatorPosition = argv.indexOf("--");
|
|
196
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
197
|
-
}
|
|
198
|
-
var { env } = process2;
|
|
199
|
-
var flagForceColor;
|
|
200
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
201
|
-
flagForceColor = 0;
|
|
202
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
203
|
-
flagForceColor = 1;
|
|
204
|
-
}
|
|
205
|
-
function envForceColor() {
|
|
206
|
-
if ("FORCE_COLOR" in env) {
|
|
207
|
-
if (env.FORCE_COLOR === "true") {
|
|
208
|
-
return 1;
|
|
209
|
-
}
|
|
210
|
-
if (env.FORCE_COLOR === "false") {
|
|
211
|
-
return 0;
|
|
212
|
-
}
|
|
213
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
function translateLevel(level) {
|
|
217
|
-
if (level === 0) {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
return {
|
|
221
|
-
level,
|
|
222
|
-
hasBasic: true,
|
|
223
|
-
has256: level >= 2,
|
|
224
|
-
has16m: level >= 3
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
228
|
-
const noFlagForceColor = envForceColor();
|
|
229
|
-
if (noFlagForceColor !== undefined) {
|
|
230
|
-
flagForceColor = noFlagForceColor;
|
|
231
|
-
}
|
|
232
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
233
|
-
if (forceColor === 0) {
|
|
234
|
-
return 0;
|
|
235
|
-
}
|
|
236
|
-
if (sniffFlags) {
|
|
237
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
238
|
-
return 3;
|
|
239
|
-
}
|
|
240
|
-
if (hasFlag("color=256")) {
|
|
241
|
-
return 2;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
245
|
-
return 1;
|
|
246
|
-
}
|
|
247
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
248
|
-
return 0;
|
|
249
|
-
}
|
|
250
|
-
const min = forceColor || 0;
|
|
251
|
-
if (env.TERM === "dumb") {
|
|
252
|
-
return min;
|
|
253
|
-
}
|
|
254
|
-
if (process2.platform === "win32") {
|
|
255
|
-
const osRelease = os.release().split(".");
|
|
256
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
257
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
258
|
-
}
|
|
259
|
-
return 1;
|
|
260
|
-
}
|
|
261
|
-
if ("CI" in env) {
|
|
262
|
-
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
|
263
|
-
return 3;
|
|
264
|
-
}
|
|
265
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
266
|
-
return 1;
|
|
267
|
-
}
|
|
268
|
-
return min;
|
|
269
|
-
}
|
|
270
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
271
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
272
|
-
}
|
|
273
|
-
if (env.COLORTERM === "truecolor") {
|
|
274
|
-
return 3;
|
|
275
|
-
}
|
|
276
|
-
if (env.TERM === "xterm-kitty") {
|
|
277
|
-
return 3;
|
|
278
|
-
}
|
|
279
|
-
if ("TERM_PROGRAM" in env) {
|
|
280
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
281
|
-
switch (env.TERM_PROGRAM) {
|
|
282
|
-
case "iTerm.app": {
|
|
283
|
-
return version >= 3 ? 3 : 2;
|
|
284
|
-
}
|
|
285
|
-
case "Apple_Terminal": {
|
|
286
|
-
return 2;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
291
|
-
return 2;
|
|
292
|
-
}
|
|
293
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
294
|
-
return 1;
|
|
295
|
-
}
|
|
296
|
-
if ("COLORTERM" in env) {
|
|
297
|
-
return 1;
|
|
298
|
-
}
|
|
299
|
-
return min;
|
|
300
|
-
}
|
|
301
|
-
function createSupportsColor(stream, options = {}) {
|
|
302
|
-
const level = _supportsColor(stream, {
|
|
303
|
-
streamIsTTY: stream && stream.isTTY,
|
|
304
|
-
...options
|
|
305
|
-
});
|
|
306
|
-
return translateLevel(level);
|
|
307
|
-
}
|
|
308
|
-
var supportsColor = {
|
|
309
|
-
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
310
|
-
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
311
|
-
};
|
|
312
|
-
var supports_color_default = supportsColor;
|
|
313
|
-
|
|
314
|
-
// ../../node_modules/chalk/source/utilities.js
|
|
315
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
316
|
-
let index = string.indexOf(substring);
|
|
317
|
-
if (index === -1) {
|
|
318
|
-
return string;
|
|
319
|
-
}
|
|
320
|
-
const substringLength = substring.length;
|
|
321
|
-
let endIndex = 0;
|
|
322
|
-
let returnValue = "";
|
|
323
|
-
do {
|
|
324
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
325
|
-
endIndex = index + substringLength;
|
|
326
|
-
index = string.indexOf(substring, endIndex);
|
|
327
|
-
} while (index !== -1);
|
|
328
|
-
returnValue += string.slice(endIndex);
|
|
329
|
-
return returnValue;
|
|
330
|
-
}
|
|
331
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
332
|
-
let endIndex = 0;
|
|
333
|
-
let returnValue = "";
|
|
334
|
-
do {
|
|
335
|
-
const gotCR = string[index - 1] === "\r";
|
|
336
|
-
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
337
|
-
` : `
|
|
338
|
-
`) + postfix;
|
|
339
|
-
endIndex = index + 1;
|
|
340
|
-
index = string.indexOf(`
|
|
341
|
-
`, endIndex);
|
|
342
|
-
} while (index !== -1);
|
|
343
|
-
returnValue += string.slice(endIndex);
|
|
344
|
-
return returnValue;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// ../../node_modules/chalk/source/index.js
|
|
348
|
-
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
349
|
-
var GENERATOR = Symbol("GENERATOR");
|
|
350
|
-
var STYLER = Symbol("STYLER");
|
|
351
|
-
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
352
|
-
var levelMapping = [
|
|
353
|
-
"ansi",
|
|
354
|
-
"ansi",
|
|
355
|
-
"ansi256",
|
|
356
|
-
"ansi16m"
|
|
357
|
-
];
|
|
358
|
-
var styles2 = Object.create(null);
|
|
359
|
-
var applyOptions = (object, options = {}) => {
|
|
360
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
361
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
362
|
-
}
|
|
363
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
364
|
-
object.level = options.level === undefined ? colorLevel : options.level;
|
|
365
|
-
};
|
|
366
|
-
var chalkFactory = (options) => {
|
|
367
|
-
const chalk = (...strings) => strings.join(" ");
|
|
368
|
-
applyOptions(chalk, options);
|
|
369
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
370
|
-
return chalk;
|
|
371
|
-
};
|
|
372
|
-
function createChalk(options) {
|
|
373
|
-
return chalkFactory(options);
|
|
374
|
-
}
|
|
375
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
376
|
-
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
377
|
-
styles2[styleName] = {
|
|
378
|
-
get() {
|
|
379
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
380
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
381
|
-
return builder;
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
styles2.visible = {
|
|
386
|
-
get() {
|
|
387
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
388
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
389
|
-
return builder;
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
393
|
-
if (model === "rgb") {
|
|
394
|
-
if (level === "ansi16m") {
|
|
395
|
-
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
396
|
-
}
|
|
397
|
-
if (level === "ansi256") {
|
|
398
|
-
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
399
|
-
}
|
|
400
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
401
|
-
}
|
|
402
|
-
if (model === "hex") {
|
|
403
|
-
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
404
|
-
}
|
|
405
|
-
return ansi_styles_default[type][model](...arguments_);
|
|
406
|
-
};
|
|
407
|
-
var usedModels = ["rgb", "hex", "ansi256"];
|
|
408
|
-
for (const model of usedModels) {
|
|
409
|
-
styles2[model] = {
|
|
410
|
-
get() {
|
|
411
|
-
const { level } = this;
|
|
412
|
-
return function(...arguments_) {
|
|
413
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
414
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
419
|
-
styles2[bgModel] = {
|
|
420
|
-
get() {
|
|
421
|
-
const { level } = this;
|
|
422
|
-
return function(...arguments_) {
|
|
423
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
424
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
var proto = Object.defineProperties(() => {
|
|
430
|
-
}, {
|
|
431
|
-
...styles2,
|
|
432
|
-
level: {
|
|
433
|
-
enumerable: true,
|
|
434
|
-
get() {
|
|
435
|
-
return this[GENERATOR].level;
|
|
436
|
-
},
|
|
437
|
-
set(level) {
|
|
438
|
-
this[GENERATOR].level = level;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
var createStyler = (open, close, parent) => {
|
|
443
|
-
let openAll;
|
|
444
|
-
let closeAll;
|
|
445
|
-
if (parent === undefined) {
|
|
446
|
-
openAll = open;
|
|
447
|
-
closeAll = close;
|
|
448
|
-
} else {
|
|
449
|
-
openAll = parent.openAll + open;
|
|
450
|
-
closeAll = close + parent.closeAll;
|
|
451
|
-
}
|
|
452
|
-
return {
|
|
453
|
-
open,
|
|
454
|
-
close,
|
|
455
|
-
openAll,
|
|
456
|
-
closeAll,
|
|
457
|
-
parent
|
|
458
|
-
};
|
|
459
|
-
};
|
|
460
|
-
var createBuilder = (self, _styler, _isEmpty) => {
|
|
461
|
-
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
462
|
-
Object.setPrototypeOf(builder, proto);
|
|
463
|
-
builder[GENERATOR] = self;
|
|
464
|
-
builder[STYLER] = _styler;
|
|
465
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
466
|
-
return builder;
|
|
467
|
-
};
|
|
468
|
-
var applyStyle = (self, string) => {
|
|
469
|
-
if (self.level <= 0 || !string) {
|
|
470
|
-
return self[IS_EMPTY] ? "" : string;
|
|
471
|
-
}
|
|
472
|
-
let styler = self[STYLER];
|
|
473
|
-
if (styler === undefined) {
|
|
474
|
-
return string;
|
|
475
|
-
}
|
|
476
|
-
const { openAll, closeAll } = styler;
|
|
477
|
-
if (string.includes("\x1B")) {
|
|
478
|
-
while (styler !== undefined) {
|
|
479
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
480
|
-
styler = styler.parent;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
const lfIndex = string.indexOf(`
|
|
484
|
-
`);
|
|
485
|
-
if (lfIndex !== -1) {
|
|
486
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
487
|
-
}
|
|
488
|
-
return openAll + string + closeAll;
|
|
489
|
-
};
|
|
490
|
-
Object.defineProperties(createChalk.prototype, styles2);
|
|
491
|
-
var chalk = createChalk();
|
|
492
|
-
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
493
|
-
var source_default = chalk;
|
|
10
|
+
import chalk from "chalk";
|
|
494
11
|
|
|
495
12
|
// ../../node_modules/yargs/lib/platform-shims/esm.mjs
|
|
496
13
|
import { notStrictEqual, strictEqual } from "assert";
|
|
@@ -1441,8 +958,8 @@ class YargsParser {
|
|
|
1441
958
|
if (typeof envPrefix === "undefined")
|
|
1442
959
|
return;
|
|
1443
960
|
const prefix = typeof envPrefix === "string" ? envPrefix : "";
|
|
1444
|
-
const
|
|
1445
|
-
Object.keys(
|
|
961
|
+
const env = mixin2.env();
|
|
962
|
+
Object.keys(env).forEach(function(envVar) {
|
|
1446
963
|
if (prefix === "" || envVar.lastIndexOf(prefix, 0) === 0) {
|
|
1447
964
|
const keys = envVar.split("__").map(function(key, i) {
|
|
1448
965
|
if (i === 0) {
|
|
@@ -1451,7 +968,7 @@ class YargsParser {
|
|
|
1451
968
|
return camelCase(key);
|
|
1452
969
|
});
|
|
1453
970
|
if ((configOnly && flags.configs[keys.join(".")] || !configOnly) && !hasKey(argv2, keys)) {
|
|
1454
|
-
setArg(keys.join("."),
|
|
971
|
+
setArg(keys.join("."), env[envVar]);
|
|
1455
972
|
}
|
|
1456
973
|
}
|
|
1457
974
|
});
|
|
@@ -1760,11 +1277,11 @@ if (nodeVersion) {
|
|
|
1760
1277
|
throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
|
|
1761
1278
|
}
|
|
1762
1279
|
}
|
|
1763
|
-
var
|
|
1280
|
+
var env = process ? process.env : {};
|
|
1764
1281
|
var parser = new YargsParser({
|
|
1765
1282
|
cwd: process.cwd,
|
|
1766
1283
|
env: () => {
|
|
1767
|
-
return
|
|
1284
|
+
return env;
|
|
1768
1285
|
},
|
|
1769
1286
|
format,
|
|
1770
1287
|
normalize,
|
|
@@ -5355,10 +4872,10 @@ var yargs_default = Yargs;
|
|
|
5355
4872
|
// src/cli.ts
|
|
5356
4873
|
var y = yargs_default(hideBin(process.argv));
|
|
5357
4874
|
function errorExit(title, text) {
|
|
5358
|
-
console.error(
|
|
4875
|
+
console.error(chalk.red.bold(title + `
|
|
5359
4876
|
`));
|
|
5360
4877
|
if (text) {
|
|
5361
|
-
console.error(
|
|
4878
|
+
console.error(chalk.red(text) + `
|
|
5362
4879
|
`);
|
|
5363
4880
|
}
|
|
5364
4881
|
process.exit(1);
|
|
@@ -5373,16 +4890,16 @@ y.command("generate-types", "generates typescript types", (yargs) => yargs.optio
|
|
|
5373
4890
|
const token = argv.accessToken ?? process.env.REQUENCE_ACCESS_TOKEN ?? JSON.parse(fs.readFileSync("package.json", "utf-8")).requence?.accessToken;
|
|
5374
4891
|
console.info();
|
|
5375
4892
|
if (!token) {
|
|
5376
|
-
errorExit("No access token found", `You can provide the access token as argument to ${
|
|
5377
|
-
as environment variable ${
|
|
5378
|
-
in your ${
|
|
4893
|
+
errorExit("No access token found", `You can provide the access token as argument to ${chalk.bold("createTask")},
|
|
4894
|
+
as environment variable ${chalk.bold("REQUENCE_ACCESS_TOKEN")} or
|
|
4895
|
+
in your ${chalk.bold("package.json")} in ${chalk.bold("requence.accessToken")}`);
|
|
5379
4896
|
}
|
|
5380
4897
|
const parts = deobfuscate(token);
|
|
5381
4898
|
if (parts.length !== 3 || parts[0] !== "api") {
|
|
5382
4899
|
errorExit("Invalid access token");
|
|
5383
4900
|
}
|
|
5384
4901
|
const [, accessToken, serverUrl] = parts;
|
|
5385
|
-
console.info(
|
|
4902
|
+
console.info(chalk.gray(`generating typescript definitions…`));
|
|
5386
4903
|
const response = await fetch(serverUrl + "/task/types/typescript", {
|
|
5387
4904
|
method: "GET",
|
|
5388
4905
|
headers: {
|
|
@@ -5400,8 +4917,8 @@ in your ${source_default.bold("package.json")} in ${source_default.bold("requenc
|
|
|
5400
4917
|
${text}`;
|
|
5401
4918
|
const file = path.join(argv.outdir || process.cwd(), argv.outfile);
|
|
5402
4919
|
fs.writeFileSync(file, data);
|
|
5403
|
-
console.info(
|
|
4920
|
+
console.info(chalk.green("types saved to", chalk.bold(path.relative(process.cwd(), file))));
|
|
5404
4921
|
}).scriptName("requence-task").help("h").demandCommand(1, 1).strict().parse();
|
|
5405
4922
|
|
|
5406
|
-
//# debugId=
|
|
4923
|
+
//# debugId=B7E3681F48E5677864756E2164756E21
|
|
5407
4924
|
//# sourceMappingURL=cli.js.map
|