@osdk/maker-experimental 0.1.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 +3 -0
- package/build/browser/api/importObjectType.js +53 -0
- package/build/browser/api/importObjectType.js.map +1 -0
- package/build/browser/api/overall.test.js +597 -0
- package/build/browser/api/overall.test.js.map +1 -0
- package/build/browser/api/types.js +2 -0
- package/build/browser/api/types.js.map +1 -0
- package/build/browser/index.js +18 -0
- package/build/browser/index.js.map +1 -0
- package/build/cjs/chunk-HKURHHWY.cjs +17 -0
- package/build/cjs/chunk-HKURHHWY.cjs.map +1 -0
- package/build/cjs/index.cjs +2425 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +19 -0
- package/build/cjs/prompt-CVWBIE7L.cjs +955 -0
- package/build/cjs/prompt-CVWBIE7L.cjs.map +1 -0
- package/build/esm/api/importObjectType.js +53 -0
- package/build/esm/api/importObjectType.js.map +1 -0
- package/build/esm/api/overall.test.js +597 -0
- package/build/esm/api/overall.test.js.map +1 -0
- package/build/esm/api/types.js +2 -0
- package/build/esm/api/types.js.map +1 -0
- package/build/esm/index.js +18 -0
- package/build/esm/index.js.map +1 -0
- package/build/types/api/importObjectType.d.ts +3 -0
- package/build/types/api/importObjectType.d.ts.map +1 -0
- package/build/types/api/overall.test.d.ts +1 -0
- package/build/types/api/overall.test.d.ts.map +1 -0
- package/build/types/api/types.d.ts +13 -0
- package/build/types/api/types.d.ts.map +1 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,2425 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkHKURHHWY_cjs = require('./chunk-HKURHHWY.cjs');
|
|
4
|
+
var util = require('util');
|
|
5
|
+
var path = require('path');
|
|
6
|
+
var g$1 = require('process');
|
|
7
|
+
var tty = require('tty');
|
|
8
|
+
require('fs/promises');
|
|
9
|
+
require('tiny-invariant');
|
|
10
|
+
require('assert');
|
|
11
|
+
var fs = require('fs');
|
|
12
|
+
var url = require('url');
|
|
13
|
+
require('crypto');
|
|
14
|
+
|
|
15
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
|
|
17
|
+
function _interopNamespace(e) {
|
|
18
|
+
if (e && e.__esModule) return e;
|
|
19
|
+
var n = Object.create(null);
|
|
20
|
+
if (e) {
|
|
21
|
+
Object.keys(e).forEach(function (k) {
|
|
22
|
+
if (k !== 'default') {
|
|
23
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return e[k]; }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
n.default = e;
|
|
32
|
+
return Object.freeze(n);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var g$1__default = /*#__PURE__*/_interopDefault(g$1);
|
|
36
|
+
var tty__namespace = /*#__PURE__*/_interopNamespace(tty);
|
|
37
|
+
|
|
38
|
+
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
|
|
39
|
+
var LogLevels = {
|
|
40
|
+
fatal: 0,
|
|
41
|
+
error: 0,
|
|
42
|
+
warn: 1,
|
|
43
|
+
log: 2,
|
|
44
|
+
info: 3,
|
|
45
|
+
success: 3,
|
|
46
|
+
fail: 3,
|
|
47
|
+
debug: 4,
|
|
48
|
+
trace: 5,
|
|
49
|
+
verbose: Number.POSITIVE_INFINITY
|
|
50
|
+
};
|
|
51
|
+
var LogTypes = {
|
|
52
|
+
// Silent
|
|
53
|
+
silent: {
|
|
54
|
+
level: -1
|
|
55
|
+
},
|
|
56
|
+
// Level 0
|
|
57
|
+
fatal: {
|
|
58
|
+
level: LogLevels.fatal
|
|
59
|
+
},
|
|
60
|
+
error: {
|
|
61
|
+
level: LogLevels.error
|
|
62
|
+
},
|
|
63
|
+
// Level 1
|
|
64
|
+
warn: {
|
|
65
|
+
level: LogLevels.warn
|
|
66
|
+
},
|
|
67
|
+
// Level 2
|
|
68
|
+
log: {
|
|
69
|
+
level: LogLevels.log
|
|
70
|
+
},
|
|
71
|
+
// Level 3
|
|
72
|
+
info: {
|
|
73
|
+
level: LogLevels.info
|
|
74
|
+
},
|
|
75
|
+
success: {
|
|
76
|
+
level: LogLevels.success
|
|
77
|
+
},
|
|
78
|
+
fail: {
|
|
79
|
+
level: LogLevels.fail
|
|
80
|
+
},
|
|
81
|
+
ready: {
|
|
82
|
+
level: LogLevels.info
|
|
83
|
+
},
|
|
84
|
+
start: {
|
|
85
|
+
level: LogLevels.info
|
|
86
|
+
},
|
|
87
|
+
box: {
|
|
88
|
+
level: LogLevels.info
|
|
89
|
+
},
|
|
90
|
+
// Level 4
|
|
91
|
+
debug: {
|
|
92
|
+
level: LogLevels.debug
|
|
93
|
+
},
|
|
94
|
+
// Level 5
|
|
95
|
+
trace: {
|
|
96
|
+
level: LogLevels.trace
|
|
97
|
+
},
|
|
98
|
+
// Verbose
|
|
99
|
+
verbose: {
|
|
100
|
+
level: LogLevels.verbose
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
function isPlainObject$1(value) {
|
|
104
|
+
if (value === null || typeof value !== "object") {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
const prototype = Object.getPrototypeOf(value);
|
|
108
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
if (Symbol.iterator in value) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
if (Symbol.toStringTag in value) {
|
|
115
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
function _defu(baseObject, defaults, namespace2 = ".", merger) {
|
|
120
|
+
if (!isPlainObject$1(defaults)) {
|
|
121
|
+
return _defu(baseObject, {}, namespace2);
|
|
122
|
+
}
|
|
123
|
+
const object = Object.assign({}, defaults);
|
|
124
|
+
for (const key in baseObject) {
|
|
125
|
+
if (key === "__proto__" || key === "constructor") {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const value = baseObject[key];
|
|
129
|
+
if (value === null || value === void 0) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
133
|
+
object[key] = [...value, ...object[key]];
|
|
134
|
+
} else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
|
|
135
|
+
object[key] = _defu(value, object[key], (namespace2 ? `${namespace2}.` : "") + key.toString());
|
|
136
|
+
} else {
|
|
137
|
+
object[key] = value;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return object;
|
|
141
|
+
}
|
|
142
|
+
function createDefu(merger) {
|
|
143
|
+
return (...arguments_) => (
|
|
144
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
145
|
+
arguments_.reduce((p, c2) => _defu(p, c2, ""), {})
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
var defu = createDefu();
|
|
149
|
+
function isPlainObject(obj) {
|
|
150
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
151
|
+
}
|
|
152
|
+
function isLogObj(arg) {
|
|
153
|
+
if (!isPlainObject(arg)) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
if (!arg.message && !arg.args) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
if (arg.stack) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
var paused = false;
|
|
165
|
+
var queue = [];
|
|
166
|
+
var Consola = class _Consola {
|
|
167
|
+
options;
|
|
168
|
+
_lastLog;
|
|
169
|
+
_mockFn;
|
|
170
|
+
/**
|
|
171
|
+
* Creates an instance of Consola with specified options or defaults.
|
|
172
|
+
*
|
|
173
|
+
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
174
|
+
*/
|
|
175
|
+
constructor(options = {}) {
|
|
176
|
+
const types = options.types || LogTypes;
|
|
177
|
+
this.options = defu({
|
|
178
|
+
...options,
|
|
179
|
+
defaults: {
|
|
180
|
+
...options.defaults
|
|
181
|
+
},
|
|
182
|
+
level: _normalizeLogLevel(options.level, types),
|
|
183
|
+
reporters: [...options.reporters || []]
|
|
184
|
+
}, {
|
|
185
|
+
types: LogTypes,
|
|
186
|
+
throttle: 1e3,
|
|
187
|
+
throttleMin: 5,
|
|
188
|
+
formatOptions: {
|
|
189
|
+
date: true,
|
|
190
|
+
colors: false,
|
|
191
|
+
compact: true
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
for (const type in types) {
|
|
195
|
+
const defaults = {
|
|
196
|
+
type,
|
|
197
|
+
...this.options.defaults,
|
|
198
|
+
...types[type]
|
|
199
|
+
};
|
|
200
|
+
this[type] = this._wrapLogFn(defaults);
|
|
201
|
+
this[type].raw = this._wrapLogFn(defaults, true);
|
|
202
|
+
}
|
|
203
|
+
if (this.options.mockFn) {
|
|
204
|
+
this.mockTypes();
|
|
205
|
+
}
|
|
206
|
+
this._lastLog = {};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Gets the current log level of the Consola instance.
|
|
210
|
+
*
|
|
211
|
+
* @returns {number} The current log level.
|
|
212
|
+
*/
|
|
213
|
+
get level() {
|
|
214
|
+
return this.options.level;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Sets the minimum log level that will be output by the instance.
|
|
218
|
+
*
|
|
219
|
+
* @param {number} level - The new log level to set.
|
|
220
|
+
*/
|
|
221
|
+
set level(level) {
|
|
222
|
+
this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Displays a prompt to the user and returns the response.
|
|
226
|
+
* Throw an error if `prompt` is not supported by the current configuration.
|
|
227
|
+
*
|
|
228
|
+
* @template T
|
|
229
|
+
* @param {string} message - The message to display in the prompt.
|
|
230
|
+
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
231
|
+
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
232
|
+
*/
|
|
233
|
+
prompt(message, opts) {
|
|
234
|
+
if (!this.options.prompt) {
|
|
235
|
+
throw new Error("prompt is not supported!");
|
|
236
|
+
}
|
|
237
|
+
return this.options.prompt(message, opts);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
241
|
+
*
|
|
242
|
+
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
243
|
+
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
244
|
+
*/
|
|
245
|
+
create(options) {
|
|
246
|
+
const instance = new _Consola({
|
|
247
|
+
...this.options,
|
|
248
|
+
...options
|
|
249
|
+
});
|
|
250
|
+
if (this._mockFn) {
|
|
251
|
+
instance.mockTypes(this._mockFn);
|
|
252
|
+
}
|
|
253
|
+
return instance;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Creates a new Consola instance with the specified default log object properties.
|
|
257
|
+
*
|
|
258
|
+
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
259
|
+
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
260
|
+
*/
|
|
261
|
+
withDefaults(defaults) {
|
|
262
|
+
return this.create({
|
|
263
|
+
...this.options,
|
|
264
|
+
defaults: {
|
|
265
|
+
...this.options.defaults,
|
|
266
|
+
...defaults
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
272
|
+
*
|
|
273
|
+
* @param {string} tag - The tag to include in each log of the new instance.
|
|
274
|
+
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
275
|
+
*/
|
|
276
|
+
withTag(tag) {
|
|
277
|
+
return this.withDefaults({
|
|
278
|
+
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Adds a custom reporter to the Consola instance.
|
|
283
|
+
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
284
|
+
*
|
|
285
|
+
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
286
|
+
* @returns {Consola} The current Consola instance.
|
|
287
|
+
*/
|
|
288
|
+
addReporter(reporter) {
|
|
289
|
+
this.options.reporters.push(reporter);
|
|
290
|
+
return this;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Removes a custom reporter from the Consola instance.
|
|
294
|
+
* If no reporter is specified, all reporters will be removed.
|
|
295
|
+
*
|
|
296
|
+
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
297
|
+
* @returns {Consola} The current Consola instance.
|
|
298
|
+
*/
|
|
299
|
+
removeReporter(reporter) {
|
|
300
|
+
if (reporter) {
|
|
301
|
+
const i2 = this.options.reporters.indexOf(reporter);
|
|
302
|
+
if (i2 !== -1) {
|
|
303
|
+
return this.options.reporters.splice(i2, 1);
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
this.options.reporters.splice(0);
|
|
307
|
+
}
|
|
308
|
+
return this;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
312
|
+
*
|
|
313
|
+
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
314
|
+
* @returns {Consola} The current Consola instance.
|
|
315
|
+
*/
|
|
316
|
+
setReporters(reporters) {
|
|
317
|
+
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
318
|
+
return this;
|
|
319
|
+
}
|
|
320
|
+
wrapAll() {
|
|
321
|
+
this.wrapConsole();
|
|
322
|
+
this.wrapStd();
|
|
323
|
+
}
|
|
324
|
+
restoreAll() {
|
|
325
|
+
this.restoreConsole();
|
|
326
|
+
this.restoreStd();
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Overrides console methods with Consola logging methods for consistent logging.
|
|
330
|
+
*/
|
|
331
|
+
wrapConsole() {
|
|
332
|
+
for (const type in this.options.types) {
|
|
333
|
+
if (!console["__" + type]) {
|
|
334
|
+
console["__" + type] = console[type];
|
|
335
|
+
}
|
|
336
|
+
console[type] = this[type].raw;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Restores the original console methods, removing Consola overrides.
|
|
341
|
+
*/
|
|
342
|
+
restoreConsole() {
|
|
343
|
+
for (const type in this.options.types) {
|
|
344
|
+
if (console["__" + type]) {
|
|
345
|
+
console[type] = console["__" + type];
|
|
346
|
+
delete console["__" + type];
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Overrides standard output and error streams to redirect them through Consola.
|
|
352
|
+
*/
|
|
353
|
+
wrapStd() {
|
|
354
|
+
this._wrapStream(this.options.stdout, "log");
|
|
355
|
+
this._wrapStream(this.options.stderr, "log");
|
|
356
|
+
}
|
|
357
|
+
_wrapStream(stream, type) {
|
|
358
|
+
if (!stream) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (!stream.__write) {
|
|
362
|
+
stream.__write = stream.write;
|
|
363
|
+
}
|
|
364
|
+
stream.write = (data) => {
|
|
365
|
+
this[type].raw(String(data).trim());
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
370
|
+
*/
|
|
371
|
+
restoreStd() {
|
|
372
|
+
this._restoreStream(this.options.stdout);
|
|
373
|
+
this._restoreStream(this.options.stderr);
|
|
374
|
+
}
|
|
375
|
+
_restoreStream(stream) {
|
|
376
|
+
if (!stream) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
if (stream.__write) {
|
|
380
|
+
stream.write = stream.__write;
|
|
381
|
+
delete stream.__write;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Pauses logging, queues incoming logs until resumed.
|
|
386
|
+
*/
|
|
387
|
+
pauseLogs() {
|
|
388
|
+
paused = true;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Resumes logging, processing any queued logs.
|
|
392
|
+
*/
|
|
393
|
+
resumeLogs() {
|
|
394
|
+
paused = false;
|
|
395
|
+
const _queue = queue.splice(0);
|
|
396
|
+
for (const item of _queue) {
|
|
397
|
+
item[0]._logFn(item[1], item[2]);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Replaces logging methods with mocks if a mock function is provided.
|
|
402
|
+
*
|
|
403
|
+
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
404
|
+
*/
|
|
405
|
+
mockTypes(mockFn) {
|
|
406
|
+
const _mockFn = mockFn || this.options.mockFn;
|
|
407
|
+
this._mockFn = _mockFn;
|
|
408
|
+
if (typeof _mockFn !== "function") {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
for (const type in this.options.types) {
|
|
412
|
+
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
413
|
+
this[type].raw = this[type];
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
_wrapLogFn(defaults, isRaw) {
|
|
417
|
+
return (...args) => {
|
|
418
|
+
if (paused) {
|
|
419
|
+
queue.push([this, defaults, args, isRaw]);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
return this._logFn(defaults, args, isRaw);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
_logFn(defaults, args, isRaw) {
|
|
426
|
+
if ((defaults.level || 0) > this.level) {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
const logObj = {
|
|
430
|
+
date: /* @__PURE__ */ new Date(),
|
|
431
|
+
args: [],
|
|
432
|
+
...defaults,
|
|
433
|
+
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
434
|
+
};
|
|
435
|
+
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
436
|
+
Object.assign(logObj, args[0]);
|
|
437
|
+
} else {
|
|
438
|
+
logObj.args = [...args];
|
|
439
|
+
}
|
|
440
|
+
if (logObj.message) {
|
|
441
|
+
logObj.args.unshift(logObj.message);
|
|
442
|
+
delete logObj.message;
|
|
443
|
+
}
|
|
444
|
+
if (logObj.additional) {
|
|
445
|
+
if (!Array.isArray(logObj.additional)) {
|
|
446
|
+
logObj.additional = logObj.additional.split("\n");
|
|
447
|
+
}
|
|
448
|
+
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
449
|
+
delete logObj.additional;
|
|
450
|
+
}
|
|
451
|
+
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
452
|
+
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
453
|
+
const resolveLog = (newLog = false) => {
|
|
454
|
+
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
455
|
+
if (this._lastLog.object && repeated > 0) {
|
|
456
|
+
const args2 = [...this._lastLog.object.args];
|
|
457
|
+
if (repeated > 1) {
|
|
458
|
+
args2.push(`(repeated ${repeated} times)`);
|
|
459
|
+
}
|
|
460
|
+
this._log({
|
|
461
|
+
...this._lastLog.object,
|
|
462
|
+
args: args2
|
|
463
|
+
});
|
|
464
|
+
this._lastLog.count = 1;
|
|
465
|
+
}
|
|
466
|
+
if (newLog) {
|
|
467
|
+
this._lastLog.object = logObj;
|
|
468
|
+
this._log(logObj);
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
clearTimeout(this._lastLog.timeout);
|
|
472
|
+
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
473
|
+
this._lastLog.time = logObj.date;
|
|
474
|
+
if (diffTime < this.options.throttle) {
|
|
475
|
+
try {
|
|
476
|
+
const serializedLog = JSON.stringify([logObj.type, logObj.tag, logObj.args]);
|
|
477
|
+
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
478
|
+
this._lastLog.serialized = serializedLog;
|
|
479
|
+
if (isSameLog) {
|
|
480
|
+
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
481
|
+
if (this._lastLog.count > this.options.throttleMin) {
|
|
482
|
+
this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
} catch {
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
resolveLog(true);
|
|
490
|
+
}
|
|
491
|
+
_log(logObj) {
|
|
492
|
+
for (const reporter of this.options.reporters) {
|
|
493
|
+
reporter.log(logObj, {
|
|
494
|
+
options: this.options
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
500
|
+
if (input === void 0) {
|
|
501
|
+
return defaultLevel;
|
|
502
|
+
}
|
|
503
|
+
if (typeof input === "number") {
|
|
504
|
+
return input;
|
|
505
|
+
}
|
|
506
|
+
if (types[input] && types[input].level !== void 0) {
|
|
507
|
+
return types[input].level;
|
|
508
|
+
}
|
|
509
|
+
return defaultLevel;
|
|
510
|
+
}
|
|
511
|
+
Consola.prototype.add = Consola.prototype.addReporter;
|
|
512
|
+
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
513
|
+
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
514
|
+
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
515
|
+
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
516
|
+
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
517
|
+
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
518
|
+
function createConsola(options = {}) {
|
|
519
|
+
return new Consola(options);
|
|
520
|
+
}
|
|
521
|
+
function parseStack(stack, message) {
|
|
522
|
+
const cwd = process.cwd() + path.sep;
|
|
523
|
+
const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
524
|
+
return lines;
|
|
525
|
+
}
|
|
526
|
+
function writeStream(data, stream) {
|
|
527
|
+
const write = stream.__write || stream.write;
|
|
528
|
+
return write.call(stream, data);
|
|
529
|
+
}
|
|
530
|
+
var bracket = (x) => x ? `[${x}]` : "";
|
|
531
|
+
var BasicReporter = class {
|
|
532
|
+
formatStack(stack, message, opts) {
|
|
533
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
534
|
+
return indent + parseStack(stack, message).join(`
|
|
535
|
+
${indent}`);
|
|
536
|
+
}
|
|
537
|
+
formatError(err, opts) {
|
|
538
|
+
const message = err.message ?? util.formatWithOptions(opts, err);
|
|
539
|
+
const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
|
|
540
|
+
const level = opts?.errorLevel || 0;
|
|
541
|
+
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
|
|
542
|
+
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
|
|
543
|
+
...opts,
|
|
544
|
+
errorLevel: level + 1
|
|
545
|
+
}) : "";
|
|
546
|
+
return causedPrefix + message + "\n" + stack + causedError;
|
|
547
|
+
}
|
|
548
|
+
formatArgs(args, opts) {
|
|
549
|
+
const _args = args.map((arg) => {
|
|
550
|
+
if (arg && typeof arg.stack === "string") {
|
|
551
|
+
return this.formatError(arg, opts);
|
|
552
|
+
}
|
|
553
|
+
return arg;
|
|
554
|
+
});
|
|
555
|
+
return util.formatWithOptions(opts, ..._args);
|
|
556
|
+
}
|
|
557
|
+
formatDate(date, opts) {
|
|
558
|
+
return opts.date ? date.toLocaleTimeString() : "";
|
|
559
|
+
}
|
|
560
|
+
filterAndJoin(arr) {
|
|
561
|
+
return arr.filter(Boolean).join(" ");
|
|
562
|
+
}
|
|
563
|
+
formatLogObj(logObj, opts) {
|
|
564
|
+
const message = this.formatArgs(logObj.args, opts);
|
|
565
|
+
if (logObj.type === "box") {
|
|
566
|
+
return "\n" + [bracket(logObj.tag), logObj.title && logObj.title, ...message.split("\n")].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
|
|
567
|
+
}
|
|
568
|
+
return this.filterAndJoin([bracket(logObj.type), bracket(logObj.tag), message]);
|
|
569
|
+
}
|
|
570
|
+
log(logObj, ctx) {
|
|
571
|
+
const line = this.formatLogObj(logObj, {
|
|
572
|
+
columns: ctx.options.stdout.columns || 0,
|
|
573
|
+
...ctx.options.formatOptions
|
|
574
|
+
});
|
|
575
|
+
return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
var {
|
|
579
|
+
env = {},
|
|
580
|
+
argv = [],
|
|
581
|
+
platform = ""
|
|
582
|
+
} = typeof process === "undefined" ? {} : process;
|
|
583
|
+
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
584
|
+
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
585
|
+
var isWindows = platform === "win32";
|
|
586
|
+
var isDumbTerminal = env.TERM === "dumb";
|
|
587
|
+
var isCompatibleTerminal = tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
|
|
588
|
+
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
589
|
+
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
590
|
+
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
591
|
+
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
592
|
+
}
|
|
593
|
+
function clearBleed(index, string, open, close, replace) {
|
|
594
|
+
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
595
|
+
}
|
|
596
|
+
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
597
|
+
return (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
598
|
+
}
|
|
599
|
+
function init(open, close, replace) {
|
|
600
|
+
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
601
|
+
}
|
|
602
|
+
var colorDefs = {
|
|
603
|
+
reset: init(0, 0),
|
|
604
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
605
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
606
|
+
italic: init(3, 23),
|
|
607
|
+
underline: init(4, 24),
|
|
608
|
+
inverse: init(7, 27),
|
|
609
|
+
hidden: init(8, 28),
|
|
610
|
+
strikethrough: init(9, 29),
|
|
611
|
+
black: init(30, 39),
|
|
612
|
+
red: init(31, 39),
|
|
613
|
+
green: init(32, 39),
|
|
614
|
+
yellow: init(33, 39),
|
|
615
|
+
blue: init(34, 39),
|
|
616
|
+
magenta: init(35, 39),
|
|
617
|
+
cyan: init(36, 39),
|
|
618
|
+
white: init(37, 39),
|
|
619
|
+
gray: init(90, 39),
|
|
620
|
+
bgBlack: init(40, 49),
|
|
621
|
+
bgRed: init(41, 49),
|
|
622
|
+
bgGreen: init(42, 49),
|
|
623
|
+
bgYellow: init(43, 49),
|
|
624
|
+
bgBlue: init(44, 49),
|
|
625
|
+
bgMagenta: init(45, 49),
|
|
626
|
+
bgCyan: init(46, 49),
|
|
627
|
+
bgWhite: init(47, 49),
|
|
628
|
+
blackBright: init(90, 39),
|
|
629
|
+
redBright: init(91, 39),
|
|
630
|
+
greenBright: init(92, 39),
|
|
631
|
+
yellowBright: init(93, 39),
|
|
632
|
+
blueBright: init(94, 39),
|
|
633
|
+
magentaBright: init(95, 39),
|
|
634
|
+
cyanBright: init(96, 39),
|
|
635
|
+
whiteBright: init(97, 39),
|
|
636
|
+
bgBlackBright: init(100, 49),
|
|
637
|
+
bgRedBright: init(101, 49),
|
|
638
|
+
bgGreenBright: init(102, 49),
|
|
639
|
+
bgYellowBright: init(103, 49),
|
|
640
|
+
bgBlueBright: init(104, 49),
|
|
641
|
+
bgMagentaBright: init(105, 49),
|
|
642
|
+
bgCyanBright: init(106, 49),
|
|
643
|
+
bgWhiteBright: init(107, 49)
|
|
644
|
+
};
|
|
645
|
+
function createColors(useColor = isColorSupported) {
|
|
646
|
+
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
647
|
+
}
|
|
648
|
+
var colors = createColors();
|
|
649
|
+
function getColor(color, fallback = "reset") {
|
|
650
|
+
return colors[color] || colors[fallback];
|
|
651
|
+
}
|
|
652
|
+
var ansiRegex = [String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`, String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");
|
|
653
|
+
function stripAnsi(text) {
|
|
654
|
+
return text.replace(new RegExp(ansiRegex, "g"), "");
|
|
655
|
+
}
|
|
656
|
+
var boxStylePresets = {
|
|
657
|
+
solid: {
|
|
658
|
+
tl: "\u250C",
|
|
659
|
+
tr: "\u2510",
|
|
660
|
+
bl: "\u2514",
|
|
661
|
+
br: "\u2518",
|
|
662
|
+
h: "\u2500",
|
|
663
|
+
v: "\u2502"
|
|
664
|
+
},
|
|
665
|
+
double: {
|
|
666
|
+
tl: "\u2554",
|
|
667
|
+
tr: "\u2557",
|
|
668
|
+
bl: "\u255A",
|
|
669
|
+
br: "\u255D",
|
|
670
|
+
h: "\u2550",
|
|
671
|
+
v: "\u2551"
|
|
672
|
+
},
|
|
673
|
+
doubleSingle: {
|
|
674
|
+
tl: "\u2553",
|
|
675
|
+
tr: "\u2556",
|
|
676
|
+
bl: "\u2559",
|
|
677
|
+
br: "\u255C",
|
|
678
|
+
h: "\u2500",
|
|
679
|
+
v: "\u2551"
|
|
680
|
+
},
|
|
681
|
+
doubleSingleRounded: {
|
|
682
|
+
tl: "\u256D",
|
|
683
|
+
tr: "\u256E",
|
|
684
|
+
bl: "\u2570",
|
|
685
|
+
br: "\u256F",
|
|
686
|
+
h: "\u2500",
|
|
687
|
+
v: "\u2551"
|
|
688
|
+
},
|
|
689
|
+
singleThick: {
|
|
690
|
+
tl: "\u250F",
|
|
691
|
+
tr: "\u2513",
|
|
692
|
+
bl: "\u2517",
|
|
693
|
+
br: "\u251B",
|
|
694
|
+
h: "\u2501",
|
|
695
|
+
v: "\u2503"
|
|
696
|
+
},
|
|
697
|
+
singleDouble: {
|
|
698
|
+
tl: "\u2552",
|
|
699
|
+
tr: "\u2555",
|
|
700
|
+
bl: "\u2558",
|
|
701
|
+
br: "\u255B",
|
|
702
|
+
h: "\u2550",
|
|
703
|
+
v: "\u2502"
|
|
704
|
+
},
|
|
705
|
+
singleDoubleRounded: {
|
|
706
|
+
tl: "\u256D",
|
|
707
|
+
tr: "\u256E",
|
|
708
|
+
bl: "\u2570",
|
|
709
|
+
br: "\u256F",
|
|
710
|
+
h: "\u2550",
|
|
711
|
+
v: "\u2502"
|
|
712
|
+
},
|
|
713
|
+
rounded: {
|
|
714
|
+
tl: "\u256D",
|
|
715
|
+
tr: "\u256E",
|
|
716
|
+
bl: "\u2570",
|
|
717
|
+
br: "\u256F",
|
|
718
|
+
h: "\u2500",
|
|
719
|
+
v: "\u2502"
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
var defaultStyle = {
|
|
723
|
+
borderColor: "white",
|
|
724
|
+
borderStyle: "rounded",
|
|
725
|
+
valign: "center",
|
|
726
|
+
padding: 2,
|
|
727
|
+
marginLeft: 1,
|
|
728
|
+
marginTop: 1,
|
|
729
|
+
marginBottom: 1
|
|
730
|
+
};
|
|
731
|
+
function box(text, _opts = {}) {
|
|
732
|
+
const opts = {
|
|
733
|
+
..._opts,
|
|
734
|
+
style: {
|
|
735
|
+
...defaultStyle,
|
|
736
|
+
..._opts.style
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
const textLines = text.split("\n");
|
|
740
|
+
const boxLines = [];
|
|
741
|
+
const _color = getColor(opts.style.borderColor);
|
|
742
|
+
const borderStyle = {
|
|
743
|
+
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
744
|
+
};
|
|
745
|
+
if (_color) {
|
|
746
|
+
for (const key in borderStyle) {
|
|
747
|
+
borderStyle[key] = _color(borderStyle[key]);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
751
|
+
const height = textLines.length + paddingOffset;
|
|
752
|
+
const width = Math.max(...textLines.map((line) => stripAnsi(line).length), opts.title ? stripAnsi(opts.title).length : 0) + paddingOffset;
|
|
753
|
+
const widthOffset = width + paddingOffset;
|
|
754
|
+
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
755
|
+
if (opts.style.marginTop > 0) {
|
|
756
|
+
boxLines.push("".repeat(opts.style.marginTop));
|
|
757
|
+
}
|
|
758
|
+
if (opts.title) {
|
|
759
|
+
const title = _color ? _color(opts.title) : opts.title;
|
|
760
|
+
const left2 = borderStyle.h.repeat(Math.floor((width - stripAnsi(opts.title).length) / 2));
|
|
761
|
+
const right2 = borderStyle.h.repeat(width - stripAnsi(opts.title).length - stripAnsi(left2).length + paddingOffset);
|
|
762
|
+
boxLines.push(`${leftSpace}${borderStyle.tl}${left2}${title}${right2}${borderStyle.tr}`);
|
|
763
|
+
} else {
|
|
764
|
+
boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
|
|
765
|
+
}
|
|
766
|
+
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
767
|
+
for (let i2 = 0; i2 < height; i2++) {
|
|
768
|
+
if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
|
|
769
|
+
boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
|
|
770
|
+
} else {
|
|
771
|
+
const line = textLines[i2 - valignOffset];
|
|
772
|
+
const left2 = " ".repeat(paddingOffset);
|
|
773
|
+
const right2 = " ".repeat(width - stripAnsi(line).length);
|
|
774
|
+
boxLines.push(`${leftSpace}${borderStyle.v}${left2}${line}${right2}${borderStyle.v}`);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
|
|
778
|
+
if (opts.style.marginBottom > 0) {
|
|
779
|
+
boxLines.push("".repeat(opts.style.marginBottom));
|
|
780
|
+
}
|
|
781
|
+
return boxLines.join("\n");
|
|
782
|
+
}
|
|
783
|
+
var r = /* @__PURE__ */ Object.create(null);
|
|
784
|
+
var i = (e) => globalThis.process?.env || undefined || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
|
|
785
|
+
var o = new Proxy(r, {
|
|
786
|
+
get(e, s2) {
|
|
787
|
+
return i()[s2] ?? r[s2];
|
|
788
|
+
},
|
|
789
|
+
has(e, s2) {
|
|
790
|
+
const E = i();
|
|
791
|
+
return s2 in E || s2 in r;
|
|
792
|
+
},
|
|
793
|
+
set(e, s2, E) {
|
|
794
|
+
const B = i(true);
|
|
795
|
+
return B[s2] = E, true;
|
|
796
|
+
},
|
|
797
|
+
deleteProperty(e, s2) {
|
|
798
|
+
if (!s2) return false;
|
|
799
|
+
const E = i(true);
|
|
800
|
+
return delete E[s2], true;
|
|
801
|
+
},
|
|
802
|
+
ownKeys() {
|
|
803
|
+
const e = i(true);
|
|
804
|
+
return Object.keys(e);
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
|
|
808
|
+
var f = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", {
|
|
809
|
+
ci: true
|
|
810
|
+
}], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", {
|
|
811
|
+
ci: true
|
|
812
|
+
}], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", {
|
|
813
|
+
ci: false
|
|
814
|
+
}], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", {
|
|
815
|
+
ci: false
|
|
816
|
+
}], ["VERCEL", "VERCEL_ENV", {
|
|
817
|
+
ci: false
|
|
818
|
+
}], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", {
|
|
819
|
+
ci: false
|
|
820
|
+
}], ["CODESANDBOX", "CODESANDBOX_HOST", {
|
|
821
|
+
ci: false
|
|
822
|
+
}], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", {
|
|
823
|
+
ci: true
|
|
824
|
+
}], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", {
|
|
825
|
+
ci: true
|
|
826
|
+
}]];
|
|
827
|
+
function b() {
|
|
828
|
+
if (globalThis.process?.env) for (const e of f) {
|
|
829
|
+
const s2 = e[1] || e[0];
|
|
830
|
+
if (globalThis.process?.env[s2]) return {
|
|
831
|
+
name: e[0].toLowerCase(),
|
|
832
|
+
...e[2]
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
|
|
836
|
+
name: "stackblitz",
|
|
837
|
+
ci: false
|
|
838
|
+
} : {
|
|
839
|
+
name: "",
|
|
840
|
+
ci: false
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
var l = b();
|
|
844
|
+
l.name;
|
|
845
|
+
function n(e) {
|
|
846
|
+
return e ? e !== "false" : false;
|
|
847
|
+
}
|
|
848
|
+
var I = globalThis.process?.platform || "";
|
|
849
|
+
var T = n(o.CI) || l.ci !== false;
|
|
850
|
+
var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
|
|
851
|
+
var g = n(o.DEBUG);
|
|
852
|
+
var R = t === "test" || n(o.TEST);
|
|
853
|
+
n(o.MINIMAL) || T || R || !a;
|
|
854
|
+
var A = /^win/i.test(I);
|
|
855
|
+
!n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM !== "dumb" || T);
|
|
856
|
+
var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
857
|
+
Number(C?.split(".")[0]) || null;
|
|
858
|
+
var y = globalThis.process || /* @__PURE__ */ Object.create(null);
|
|
859
|
+
var _ = {
|
|
860
|
+
versions: {}
|
|
861
|
+
};
|
|
862
|
+
new Proxy(y, {
|
|
863
|
+
get(e, s2) {
|
|
864
|
+
if (s2 === "env") return o;
|
|
865
|
+
if (s2 in e) return e[s2];
|
|
866
|
+
if (s2 in _) return _[s2];
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
var c = globalThis.process?.release?.name === "node";
|
|
870
|
+
var O = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
|
|
871
|
+
var D = !!globalThis.Deno;
|
|
872
|
+
var L = !!globalThis.fastly;
|
|
873
|
+
var S = !!globalThis.Netlify;
|
|
874
|
+
var u = !!globalThis.EdgeRuntime;
|
|
875
|
+
var N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
|
|
876
|
+
var F = [[S, "netlify"], [u, "edge-light"], [N, "workerd"], [L, "fastly"], [D, "deno"], [O, "bun"], [c, "node"]];
|
|
877
|
+
function G() {
|
|
878
|
+
const e = F.find((s2) => s2[0]);
|
|
879
|
+
if (e) return {
|
|
880
|
+
name: e[1]
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
var P = G();
|
|
884
|
+
P?.name || "";
|
|
885
|
+
function ansiRegex2({
|
|
886
|
+
onlyFirst = false
|
|
887
|
+
} = {}) {
|
|
888
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
889
|
+
const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
890
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
891
|
+
}
|
|
892
|
+
var regex = ansiRegex2();
|
|
893
|
+
function stripAnsi2(string) {
|
|
894
|
+
if (typeof string !== "string") {
|
|
895
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
896
|
+
}
|
|
897
|
+
return string.replace(regex, "");
|
|
898
|
+
}
|
|
899
|
+
function isAmbiguous(x) {
|
|
900
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
901
|
+
}
|
|
902
|
+
function isFullWidth(x) {
|
|
903
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
904
|
+
}
|
|
905
|
+
function isWide(x) {
|
|
906
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
907
|
+
}
|
|
908
|
+
function validate(codePoint) {
|
|
909
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
910
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
function eastAsianWidth(codePoint, {
|
|
914
|
+
ambiguousAsWide = false
|
|
915
|
+
} = {}) {
|
|
916
|
+
validate(codePoint);
|
|
917
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
918
|
+
return 2;
|
|
919
|
+
}
|
|
920
|
+
return 1;
|
|
921
|
+
}
|
|
922
|
+
var emojiRegex = () => {
|
|
923
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
924
|
+
};
|
|
925
|
+
var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : {
|
|
926
|
+
segment: (str) => str.split("")
|
|
927
|
+
};
|
|
928
|
+
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
929
|
+
function stringWidth$1(string, options = {}) {
|
|
930
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
931
|
+
return 0;
|
|
932
|
+
}
|
|
933
|
+
const {
|
|
934
|
+
ambiguousIsNarrow = true,
|
|
935
|
+
countAnsiEscapeCodes = false
|
|
936
|
+
} = options;
|
|
937
|
+
if (!countAnsiEscapeCodes) {
|
|
938
|
+
string = stripAnsi2(string);
|
|
939
|
+
}
|
|
940
|
+
if (string.length === 0) {
|
|
941
|
+
return 0;
|
|
942
|
+
}
|
|
943
|
+
let width = 0;
|
|
944
|
+
const eastAsianWidthOptions = {
|
|
945
|
+
ambiguousAsWide: !ambiguousIsNarrow
|
|
946
|
+
};
|
|
947
|
+
for (const {
|
|
948
|
+
segment: character
|
|
949
|
+
} of segmenter.segment(string)) {
|
|
950
|
+
const codePoint = character.codePointAt(0);
|
|
951
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
955
|
+
continue;
|
|
956
|
+
}
|
|
957
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
963
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
964
|
+
continue;
|
|
965
|
+
}
|
|
966
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
if (emojiRegex().test(character)) {
|
|
970
|
+
width += 2;
|
|
971
|
+
continue;
|
|
972
|
+
}
|
|
973
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
974
|
+
}
|
|
975
|
+
return width;
|
|
976
|
+
}
|
|
977
|
+
function isUnicodeSupported() {
|
|
978
|
+
const {
|
|
979
|
+
env: env3
|
|
980
|
+
} = g$1__default.default;
|
|
981
|
+
const {
|
|
982
|
+
TERM,
|
|
983
|
+
TERM_PROGRAM
|
|
984
|
+
} = env3;
|
|
985
|
+
if (g$1__default.default.platform !== "win32") {
|
|
986
|
+
return TERM !== "linux";
|
|
987
|
+
}
|
|
988
|
+
return Boolean(env3.WT_SESSION) || Boolean(env3.TERMINUS_SUBLIME) || env3.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env3.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
989
|
+
}
|
|
990
|
+
var TYPE_COLOR_MAP = {
|
|
991
|
+
info: "cyan",
|
|
992
|
+
fail: "red",
|
|
993
|
+
success: "green",
|
|
994
|
+
ready: "green",
|
|
995
|
+
start: "magenta"
|
|
996
|
+
};
|
|
997
|
+
var LEVEL_COLOR_MAP = {
|
|
998
|
+
0: "red",
|
|
999
|
+
1: "yellow"
|
|
1000
|
+
};
|
|
1001
|
+
var unicode = isUnicodeSupported();
|
|
1002
|
+
var s = (c2, fallback) => unicode ? c2 : fallback;
|
|
1003
|
+
var TYPE_ICONS = {
|
|
1004
|
+
error: s("\u2716", "\xD7"),
|
|
1005
|
+
fatal: s("\u2716", "\xD7"),
|
|
1006
|
+
ready: s("\u2714", "\u221A"),
|
|
1007
|
+
warn: s("\u26A0", "\u203C"),
|
|
1008
|
+
info: s("\u2139", "i"),
|
|
1009
|
+
success: s("\u2714", "\u221A"),
|
|
1010
|
+
debug: s("\u2699", "D"),
|
|
1011
|
+
trace: s("\u2192", "\u2192"),
|
|
1012
|
+
fail: s("\u2716", "\xD7"),
|
|
1013
|
+
start: s("\u25D0", "o"),
|
|
1014
|
+
log: ""
|
|
1015
|
+
};
|
|
1016
|
+
function stringWidth(str) {
|
|
1017
|
+
const hasICU = typeof Intl === "object";
|
|
1018
|
+
if (!hasICU || !Intl.Segmenter) {
|
|
1019
|
+
return stripAnsi(str).length;
|
|
1020
|
+
}
|
|
1021
|
+
return stringWidth$1(str);
|
|
1022
|
+
}
|
|
1023
|
+
var FancyReporter = class extends BasicReporter {
|
|
1024
|
+
formatStack(stack, message, opts) {
|
|
1025
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
1026
|
+
return `
|
|
1027
|
+
${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)).join(`
|
|
1028
|
+
${indent}`);
|
|
1029
|
+
}
|
|
1030
|
+
formatType(logObj, isBadge, opts) {
|
|
1031
|
+
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
1032
|
+
if (isBadge) {
|
|
1033
|
+
return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
|
|
1034
|
+
}
|
|
1035
|
+
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
1036
|
+
return _type ? getColor2(typeColor)(_type) : "";
|
|
1037
|
+
}
|
|
1038
|
+
formatLogObj(logObj, opts) {
|
|
1039
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
|
|
1040
|
+
if (logObj.type === "box") {
|
|
1041
|
+
return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
|
|
1042
|
+
title: logObj.title ? characterFormat(logObj.title) : void 0,
|
|
1043
|
+
style: logObj.style
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
const date = this.formatDate(logObj.date, opts);
|
|
1047
|
+
const coloredDate = date && colors.gray(date);
|
|
1048
|
+
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
1049
|
+
const type = this.formatType(logObj, isBadge, opts);
|
|
1050
|
+
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
1051
|
+
let line;
|
|
1052
|
+
const left2 = this.filterAndJoin([type, characterFormat(message)]);
|
|
1053
|
+
const right2 = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1054
|
+
const space = (opts.columns || 0) - stringWidth(left2) - stringWidth(right2) - 2;
|
|
1055
|
+
line = space > 0 && (opts.columns || 0) >= 80 ? left2 + " ".repeat(space) + right2 : (right2 ? `${colors.gray(`[${right2}]`)} ` : "") + left2;
|
|
1056
|
+
line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
|
|
1057
|
+
if (logObj.type === "trace") {
|
|
1058
|
+
const _err = new Error("Trace: " + logObj.message);
|
|
1059
|
+
line += this.formatStack(_err.stack || "", _err.message);
|
|
1060
|
+
}
|
|
1061
|
+
return isBadge ? "\n" + line + "\n" : line;
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
function characterFormat(str) {
|
|
1065
|
+
return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
|
|
1066
|
+
}
|
|
1067
|
+
function getColor2(color = "white") {
|
|
1068
|
+
return colors[color] || colors.white;
|
|
1069
|
+
}
|
|
1070
|
+
function getBgColor(color = "bgWhite") {
|
|
1071
|
+
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
1072
|
+
}
|
|
1073
|
+
function createConsola2(options = {}) {
|
|
1074
|
+
let level = _getDefaultLogLevel();
|
|
1075
|
+
if (process.env.CONSOLA_LEVEL) {
|
|
1076
|
+
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1077
|
+
}
|
|
1078
|
+
const consola2 = createConsola({
|
|
1079
|
+
level,
|
|
1080
|
+
defaults: {
|
|
1081
|
+
level
|
|
1082
|
+
},
|
|
1083
|
+
stdout: process.stdout,
|
|
1084
|
+
stderr: process.stderr,
|
|
1085
|
+
prompt: (...args) => import('./prompt-CVWBIE7L.cjs').then((m) => m.prompt(...args)),
|
|
1086
|
+
reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
1087
|
+
...options
|
|
1088
|
+
});
|
|
1089
|
+
return consola2;
|
|
1090
|
+
}
|
|
1091
|
+
function _getDefaultLogLevel() {
|
|
1092
|
+
if (g) {
|
|
1093
|
+
return LogLevels.debug;
|
|
1094
|
+
}
|
|
1095
|
+
if (R) {
|
|
1096
|
+
return LogLevels.warn;
|
|
1097
|
+
}
|
|
1098
|
+
return LogLevels.info;
|
|
1099
|
+
}
|
|
1100
|
+
createConsola2();
|
|
1101
|
+
|
|
1102
|
+
// ../../node_modules/.pnpm/yargs-parser@21.1.1/node_modules/yargs-parser/build/lib/string-utils.js
|
|
1103
|
+
function camelCase(str) {
|
|
1104
|
+
const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
|
|
1105
|
+
if (!isCamelCase) {
|
|
1106
|
+
str = str.toLowerCase();
|
|
1107
|
+
}
|
|
1108
|
+
if (str.indexOf("-") === -1 && str.indexOf("_") === -1) {
|
|
1109
|
+
return str;
|
|
1110
|
+
} else {
|
|
1111
|
+
let camelcase = "";
|
|
1112
|
+
let nextChrUpper = false;
|
|
1113
|
+
const leadingHyphens = str.match(/^-+/);
|
|
1114
|
+
for (let i2 = leadingHyphens ? leadingHyphens[0].length : 0; i2 < str.length; i2++) {
|
|
1115
|
+
let chr = str.charAt(i2);
|
|
1116
|
+
if (nextChrUpper) {
|
|
1117
|
+
nextChrUpper = false;
|
|
1118
|
+
chr = chr.toUpperCase();
|
|
1119
|
+
}
|
|
1120
|
+
if (i2 !== 0 && (chr === "-" || chr === "_")) {
|
|
1121
|
+
nextChrUpper = true;
|
|
1122
|
+
} else if (chr !== "-" && chr !== "_") {
|
|
1123
|
+
camelcase += chr;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
return camelcase;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
function decamelize(str, joinString) {
|
|
1130
|
+
const lowercase = str.toLowerCase();
|
|
1131
|
+
joinString = joinString || "-";
|
|
1132
|
+
let notCamelcase = "";
|
|
1133
|
+
for (let i2 = 0; i2 < str.length; i2++) {
|
|
1134
|
+
const chrLower = lowercase.charAt(i2);
|
|
1135
|
+
const chrString = str.charAt(i2);
|
|
1136
|
+
if (chrLower !== chrString && i2 > 0) {
|
|
1137
|
+
notCamelcase += `${joinString}${lowercase.charAt(i2)}`;
|
|
1138
|
+
} else {
|
|
1139
|
+
notCamelcase += chrString;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
return notCamelcase;
|
|
1143
|
+
}
|
|
1144
|
+
function looksLikeNumber(x) {
|
|
1145
|
+
if (x === null || x === void 0) return false;
|
|
1146
|
+
if (typeof x === "number") return true;
|
|
1147
|
+
if (/^0x[0-9a-f]+$/i.test(x)) return true;
|
|
1148
|
+
if (/^0[^.]/.test(x)) return false;
|
|
1149
|
+
return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
// ../../node_modules/.pnpm/yargs-parser@21.1.1/node_modules/yargs-parser/build/lib/tokenize-arg-string.js
|
|
1153
|
+
function tokenizeArgString(argString) {
|
|
1154
|
+
if (Array.isArray(argString)) {
|
|
1155
|
+
return argString.map((e) => typeof e !== "string" ? e + "" : e);
|
|
1156
|
+
}
|
|
1157
|
+
argString = argString.trim();
|
|
1158
|
+
let i2 = 0;
|
|
1159
|
+
let prevC = null;
|
|
1160
|
+
let c2 = null;
|
|
1161
|
+
let opening = null;
|
|
1162
|
+
const args = [];
|
|
1163
|
+
for (let ii = 0; ii < argString.length; ii++) {
|
|
1164
|
+
prevC = c2;
|
|
1165
|
+
c2 = argString.charAt(ii);
|
|
1166
|
+
if (c2 === " " && !opening) {
|
|
1167
|
+
if (!(prevC === " ")) {
|
|
1168
|
+
i2++;
|
|
1169
|
+
}
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
if (c2 === opening) {
|
|
1173
|
+
opening = null;
|
|
1174
|
+
} else if ((c2 === "'" || c2 === '"') && !opening) {
|
|
1175
|
+
opening = c2;
|
|
1176
|
+
}
|
|
1177
|
+
if (!args[i2]) args[i2] = "";
|
|
1178
|
+
args[i2] += c2;
|
|
1179
|
+
}
|
|
1180
|
+
return args;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
// ../../node_modules/.pnpm/yargs-parser@21.1.1/node_modules/yargs-parser/build/lib/yargs-parser-types.js
|
|
1184
|
+
var DefaultValuesForTypeKey;
|
|
1185
|
+
(function(DefaultValuesForTypeKey2) {
|
|
1186
|
+
DefaultValuesForTypeKey2["BOOLEAN"] = "boolean";
|
|
1187
|
+
DefaultValuesForTypeKey2["STRING"] = "string";
|
|
1188
|
+
DefaultValuesForTypeKey2["NUMBER"] = "number";
|
|
1189
|
+
DefaultValuesForTypeKey2["ARRAY"] = "array";
|
|
1190
|
+
})(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
|
|
1191
|
+
|
|
1192
|
+
// ../../node_modules/.pnpm/yargs-parser@21.1.1/node_modules/yargs-parser/build/lib/yargs-parser.js
|
|
1193
|
+
var mixin2;
|
|
1194
|
+
var YargsParser = class {
|
|
1195
|
+
constructor(_mixin) {
|
|
1196
|
+
mixin2 = _mixin;
|
|
1197
|
+
}
|
|
1198
|
+
parse(argsInput, options) {
|
|
1199
|
+
const opts = Object.assign({
|
|
1200
|
+
alias: void 0,
|
|
1201
|
+
array: void 0,
|
|
1202
|
+
boolean: void 0,
|
|
1203
|
+
config: void 0,
|
|
1204
|
+
configObjects: void 0,
|
|
1205
|
+
configuration: void 0,
|
|
1206
|
+
coerce: void 0,
|
|
1207
|
+
count: void 0,
|
|
1208
|
+
default: void 0,
|
|
1209
|
+
envPrefix: void 0,
|
|
1210
|
+
narg: void 0,
|
|
1211
|
+
normalize: void 0,
|
|
1212
|
+
string: void 0,
|
|
1213
|
+
number: void 0,
|
|
1214
|
+
__: void 0,
|
|
1215
|
+
key: void 0
|
|
1216
|
+
}, options);
|
|
1217
|
+
const args = tokenizeArgString(argsInput);
|
|
1218
|
+
const inputIsString = typeof argsInput === "string";
|
|
1219
|
+
const aliases = combineAliases(Object.assign(/* @__PURE__ */ Object.create(null), opts.alias));
|
|
1220
|
+
const configuration = Object.assign({
|
|
1221
|
+
"boolean-negation": true,
|
|
1222
|
+
"camel-case-expansion": true,
|
|
1223
|
+
"combine-arrays": false,
|
|
1224
|
+
"dot-notation": true,
|
|
1225
|
+
"duplicate-arguments-array": true,
|
|
1226
|
+
"flatten-duplicate-arrays": true,
|
|
1227
|
+
"greedy-arrays": true,
|
|
1228
|
+
"halt-at-non-option": false,
|
|
1229
|
+
"nargs-eats-options": false,
|
|
1230
|
+
"negation-prefix": "no-",
|
|
1231
|
+
"parse-numbers": true,
|
|
1232
|
+
"parse-positional-numbers": true,
|
|
1233
|
+
"populate--": false,
|
|
1234
|
+
"set-placeholder-key": false,
|
|
1235
|
+
"short-option-groups": true,
|
|
1236
|
+
"strip-aliased": false,
|
|
1237
|
+
"strip-dashed": false,
|
|
1238
|
+
"unknown-options-as-args": false
|
|
1239
|
+
}, opts.configuration);
|
|
1240
|
+
const defaults = Object.assign(/* @__PURE__ */ Object.create(null), opts.default);
|
|
1241
|
+
const configObjects = opts.configObjects || [];
|
|
1242
|
+
const envPrefix = opts.envPrefix;
|
|
1243
|
+
const notFlagsOption = configuration["populate--"];
|
|
1244
|
+
const notFlagsArgv = notFlagsOption ? "--" : "_";
|
|
1245
|
+
const newAliases = /* @__PURE__ */ Object.create(null);
|
|
1246
|
+
const defaulted = /* @__PURE__ */ Object.create(null);
|
|
1247
|
+
const __ = opts.__ || mixin2.format;
|
|
1248
|
+
const flags = {
|
|
1249
|
+
aliases: /* @__PURE__ */ Object.create(null),
|
|
1250
|
+
arrays: /* @__PURE__ */ Object.create(null),
|
|
1251
|
+
bools: /* @__PURE__ */ Object.create(null),
|
|
1252
|
+
strings: /* @__PURE__ */ Object.create(null),
|
|
1253
|
+
numbers: /* @__PURE__ */ Object.create(null),
|
|
1254
|
+
counts: /* @__PURE__ */ Object.create(null),
|
|
1255
|
+
normalize: /* @__PURE__ */ Object.create(null),
|
|
1256
|
+
configs: /* @__PURE__ */ Object.create(null),
|
|
1257
|
+
nargs: /* @__PURE__ */ Object.create(null),
|
|
1258
|
+
coercions: /* @__PURE__ */ Object.create(null),
|
|
1259
|
+
keys: []
|
|
1260
|
+
};
|
|
1261
|
+
const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
|
|
1262
|
+
const negatedBoolean = new RegExp("^--" + configuration["negation-prefix"] + "(.+)");
|
|
1263
|
+
[].concat(opts.array || []).filter(Boolean).forEach(function(opt) {
|
|
1264
|
+
const key = typeof opt === "object" ? opt.key : opt;
|
|
1265
|
+
const assignment = Object.keys(opt).map(function(key2) {
|
|
1266
|
+
const arrayFlagKeys = {
|
|
1267
|
+
boolean: "bools",
|
|
1268
|
+
string: "strings",
|
|
1269
|
+
number: "numbers"
|
|
1270
|
+
};
|
|
1271
|
+
return arrayFlagKeys[key2];
|
|
1272
|
+
}).filter(Boolean).pop();
|
|
1273
|
+
if (assignment) {
|
|
1274
|
+
flags[assignment][key] = true;
|
|
1275
|
+
}
|
|
1276
|
+
flags.arrays[key] = true;
|
|
1277
|
+
flags.keys.push(key);
|
|
1278
|
+
});
|
|
1279
|
+
[].concat(opts.boolean || []).filter(Boolean).forEach(function(key) {
|
|
1280
|
+
flags.bools[key] = true;
|
|
1281
|
+
flags.keys.push(key);
|
|
1282
|
+
});
|
|
1283
|
+
[].concat(opts.string || []).filter(Boolean).forEach(function(key) {
|
|
1284
|
+
flags.strings[key] = true;
|
|
1285
|
+
flags.keys.push(key);
|
|
1286
|
+
});
|
|
1287
|
+
[].concat(opts.number || []).filter(Boolean).forEach(function(key) {
|
|
1288
|
+
flags.numbers[key] = true;
|
|
1289
|
+
flags.keys.push(key);
|
|
1290
|
+
});
|
|
1291
|
+
[].concat(opts.count || []).filter(Boolean).forEach(function(key) {
|
|
1292
|
+
flags.counts[key] = true;
|
|
1293
|
+
flags.keys.push(key);
|
|
1294
|
+
});
|
|
1295
|
+
[].concat(opts.normalize || []).filter(Boolean).forEach(function(key) {
|
|
1296
|
+
flags.normalize[key] = true;
|
|
1297
|
+
flags.keys.push(key);
|
|
1298
|
+
});
|
|
1299
|
+
if (typeof opts.narg === "object") {
|
|
1300
|
+
Object.entries(opts.narg).forEach(([key, value]) => {
|
|
1301
|
+
if (typeof value === "number") {
|
|
1302
|
+
flags.nargs[key] = value;
|
|
1303
|
+
flags.keys.push(key);
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
if (typeof opts.coerce === "object") {
|
|
1308
|
+
Object.entries(opts.coerce).forEach(([key, value]) => {
|
|
1309
|
+
if (typeof value === "function") {
|
|
1310
|
+
flags.coercions[key] = value;
|
|
1311
|
+
flags.keys.push(key);
|
|
1312
|
+
}
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
if (typeof opts.config !== "undefined") {
|
|
1316
|
+
if (Array.isArray(opts.config) || typeof opts.config === "string") {
|
|
1317
|
+
[].concat(opts.config).filter(Boolean).forEach(function(key) {
|
|
1318
|
+
flags.configs[key] = true;
|
|
1319
|
+
});
|
|
1320
|
+
} else if (typeof opts.config === "object") {
|
|
1321
|
+
Object.entries(opts.config).forEach(([key, value]) => {
|
|
1322
|
+
if (typeof value === "boolean" || typeof value === "function") {
|
|
1323
|
+
flags.configs[key] = value;
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
extendAliases(opts.key, aliases, opts.default, flags.arrays);
|
|
1329
|
+
Object.keys(defaults).forEach(function(key) {
|
|
1330
|
+
(flags.aliases[key] || []).forEach(function(alias) {
|
|
1331
|
+
defaults[alias] = defaults[key];
|
|
1332
|
+
});
|
|
1333
|
+
});
|
|
1334
|
+
let error = null;
|
|
1335
|
+
checkConfiguration();
|
|
1336
|
+
let notFlags = [];
|
|
1337
|
+
const argv2 = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1338
|
+
_: []
|
|
1339
|
+
});
|
|
1340
|
+
const argvReturn = {};
|
|
1341
|
+
for (let i2 = 0; i2 < args.length; i2++) {
|
|
1342
|
+
const arg = args[i2];
|
|
1343
|
+
const truncatedArg = arg.replace(/^-{3,}/, "---");
|
|
1344
|
+
let broken;
|
|
1345
|
+
let key;
|
|
1346
|
+
let letters;
|
|
1347
|
+
let m;
|
|
1348
|
+
let next;
|
|
1349
|
+
let value;
|
|
1350
|
+
if (arg !== "--" && /^-/.test(arg) && isUnknownOptionAsArg(arg)) {
|
|
1351
|
+
pushPositional(arg);
|
|
1352
|
+
} else if (truncatedArg.match(/^---+(=|$)/)) {
|
|
1353
|
+
pushPositional(arg);
|
|
1354
|
+
continue;
|
|
1355
|
+
} else if (arg.match(/^--.+=/) || !configuration["short-option-groups"] && arg.match(/^-.+=/)) {
|
|
1356
|
+
m = arg.match(/^--?([^=]+)=([\s\S]*)$/);
|
|
1357
|
+
if (m !== null && Array.isArray(m) && m.length >= 3) {
|
|
1358
|
+
if (checkAllAliases(m[1], flags.arrays)) {
|
|
1359
|
+
i2 = eatArray(i2, m[1], args, m[2]);
|
|
1360
|
+
} else if (checkAllAliases(m[1], flags.nargs) !== false) {
|
|
1361
|
+
i2 = eatNargs(i2, m[1], args, m[2]);
|
|
1362
|
+
} else {
|
|
1363
|
+
setArg(m[1], m[2], true);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
} else if (arg.match(negatedBoolean) && configuration["boolean-negation"]) {
|
|
1367
|
+
m = arg.match(negatedBoolean);
|
|
1368
|
+
if (m !== null && Array.isArray(m) && m.length >= 2) {
|
|
1369
|
+
key = m[1];
|
|
1370
|
+
setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false);
|
|
1371
|
+
}
|
|
1372
|
+
} else if (arg.match(/^--.+/) || !configuration["short-option-groups"] && arg.match(/^-[^-]+/)) {
|
|
1373
|
+
m = arg.match(/^--?(.+)/);
|
|
1374
|
+
if (m !== null && Array.isArray(m) && m.length >= 2) {
|
|
1375
|
+
key = m[1];
|
|
1376
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
1377
|
+
i2 = eatArray(i2, key, args);
|
|
1378
|
+
} else if (checkAllAliases(key, flags.nargs) !== false) {
|
|
1379
|
+
i2 = eatNargs(i2, key, args);
|
|
1380
|
+
} else {
|
|
1381
|
+
next = args[i2 + 1];
|
|
1382
|
+
if (next !== void 0 && (!next.match(/^-/) || next.match(negative)) && !checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts)) {
|
|
1383
|
+
setArg(key, next);
|
|
1384
|
+
i2++;
|
|
1385
|
+
} else if (/^(true|false)$/.test(next)) {
|
|
1386
|
+
setArg(key, next);
|
|
1387
|
+
i2++;
|
|
1388
|
+
} else {
|
|
1389
|
+
setArg(key, defaultValue(key));
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
} else if (arg.match(/^-.\..+=/)) {
|
|
1394
|
+
m = arg.match(/^-([^=]+)=([\s\S]*)$/);
|
|
1395
|
+
if (m !== null && Array.isArray(m) && m.length >= 3) {
|
|
1396
|
+
setArg(m[1], m[2]);
|
|
1397
|
+
}
|
|
1398
|
+
} else if (arg.match(/^-.\..+/) && !arg.match(negative)) {
|
|
1399
|
+
next = args[i2 + 1];
|
|
1400
|
+
m = arg.match(/^-(.\..+)/);
|
|
1401
|
+
if (m !== null && Array.isArray(m) && m.length >= 2) {
|
|
1402
|
+
key = m[1];
|
|
1403
|
+
if (next !== void 0 && !next.match(/^-/) && !checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts)) {
|
|
1404
|
+
setArg(key, next);
|
|
1405
|
+
i2++;
|
|
1406
|
+
} else {
|
|
1407
|
+
setArg(key, defaultValue(key));
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
} else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
|
|
1411
|
+
letters = arg.slice(1, -1).split("");
|
|
1412
|
+
broken = false;
|
|
1413
|
+
for (let j = 0; j < letters.length; j++) {
|
|
1414
|
+
next = arg.slice(j + 2);
|
|
1415
|
+
if (letters[j + 1] && letters[j + 1] === "=") {
|
|
1416
|
+
value = arg.slice(j + 3);
|
|
1417
|
+
key = letters[j];
|
|
1418
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
1419
|
+
i2 = eatArray(i2, key, args, value);
|
|
1420
|
+
} else if (checkAllAliases(key, flags.nargs) !== false) {
|
|
1421
|
+
i2 = eatNargs(i2, key, args, value);
|
|
1422
|
+
} else {
|
|
1423
|
+
setArg(key, value);
|
|
1424
|
+
}
|
|
1425
|
+
broken = true;
|
|
1426
|
+
break;
|
|
1427
|
+
}
|
|
1428
|
+
if (next === "-") {
|
|
1429
|
+
setArg(letters[j], next);
|
|
1430
|
+
continue;
|
|
1431
|
+
}
|
|
1432
|
+
if (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) && checkAllAliases(next, flags.bools) === false) {
|
|
1433
|
+
setArg(letters[j], next);
|
|
1434
|
+
broken = true;
|
|
1435
|
+
break;
|
|
1436
|
+
}
|
|
1437
|
+
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
1438
|
+
setArg(letters[j], next);
|
|
1439
|
+
broken = true;
|
|
1440
|
+
break;
|
|
1441
|
+
} else {
|
|
1442
|
+
setArg(letters[j], defaultValue(letters[j]));
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
key = arg.slice(-1)[0];
|
|
1446
|
+
if (!broken && key !== "-") {
|
|
1447
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
1448
|
+
i2 = eatArray(i2, key, args);
|
|
1449
|
+
} else if (checkAllAliases(key, flags.nargs) !== false) {
|
|
1450
|
+
i2 = eatNargs(i2, key, args);
|
|
1451
|
+
} else {
|
|
1452
|
+
next = args[i2 + 1];
|
|
1453
|
+
if (next !== void 0 && (!/^(-|--)[^-]/.test(next) || next.match(negative)) && !checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts)) {
|
|
1454
|
+
setArg(key, next);
|
|
1455
|
+
i2++;
|
|
1456
|
+
} else if (/^(true|false)$/.test(next)) {
|
|
1457
|
+
setArg(key, next);
|
|
1458
|
+
i2++;
|
|
1459
|
+
} else {
|
|
1460
|
+
setArg(key, defaultValue(key));
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
} else if (arg.match(/^-[0-9]$/) && arg.match(negative) && checkAllAliases(arg.slice(1), flags.bools)) {
|
|
1465
|
+
key = arg.slice(1);
|
|
1466
|
+
setArg(key, defaultValue(key));
|
|
1467
|
+
} else if (arg === "--") {
|
|
1468
|
+
notFlags = args.slice(i2 + 1);
|
|
1469
|
+
break;
|
|
1470
|
+
} else if (configuration["halt-at-non-option"]) {
|
|
1471
|
+
notFlags = args.slice(i2);
|
|
1472
|
+
break;
|
|
1473
|
+
} else {
|
|
1474
|
+
pushPositional(arg);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
applyEnvVars(argv2, true);
|
|
1478
|
+
applyEnvVars(argv2, false);
|
|
1479
|
+
setConfig(argv2);
|
|
1480
|
+
setConfigObjects();
|
|
1481
|
+
applyDefaultsAndAliases(argv2, flags.aliases, defaults, true);
|
|
1482
|
+
applyCoercions(argv2);
|
|
1483
|
+
if (configuration["set-placeholder-key"]) setPlaceholderKeys(argv2);
|
|
1484
|
+
Object.keys(flags.counts).forEach(function(key) {
|
|
1485
|
+
if (!hasKey(argv2, key.split("."))) setArg(key, 0);
|
|
1486
|
+
});
|
|
1487
|
+
if (notFlagsOption && notFlags.length) argv2[notFlagsArgv] = [];
|
|
1488
|
+
notFlags.forEach(function(key) {
|
|
1489
|
+
argv2[notFlagsArgv].push(key);
|
|
1490
|
+
});
|
|
1491
|
+
if (configuration["camel-case-expansion"] && configuration["strip-dashed"]) {
|
|
1492
|
+
Object.keys(argv2).filter((key) => key !== "--" && key.includes("-")).forEach((key) => {
|
|
1493
|
+
delete argv2[key];
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
if (configuration["strip-aliased"]) {
|
|
1497
|
+
[].concat(...Object.keys(aliases).map((k) => aliases[k])).forEach((alias) => {
|
|
1498
|
+
if (configuration["camel-case-expansion"] && alias.includes("-")) {
|
|
1499
|
+
delete argv2[alias.split(".").map((prop) => camelCase(prop)).join(".")];
|
|
1500
|
+
}
|
|
1501
|
+
delete argv2[alias];
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
function pushPositional(arg) {
|
|
1505
|
+
const maybeCoercedNumber = maybeCoerceNumber("_", arg);
|
|
1506
|
+
if (typeof maybeCoercedNumber === "string" || typeof maybeCoercedNumber === "number") {
|
|
1507
|
+
argv2._.push(maybeCoercedNumber);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
function eatNargs(i2, key, args2, argAfterEqualSign) {
|
|
1511
|
+
let ii;
|
|
1512
|
+
let toEat = checkAllAliases(key, flags.nargs);
|
|
1513
|
+
toEat = typeof toEat !== "number" || isNaN(toEat) ? 1 : toEat;
|
|
1514
|
+
if (toEat === 0) {
|
|
1515
|
+
if (!isUndefined(argAfterEqualSign)) {
|
|
1516
|
+
error = Error(__("Argument unexpected for: %s", key));
|
|
1517
|
+
}
|
|
1518
|
+
setArg(key, defaultValue(key));
|
|
1519
|
+
return i2;
|
|
1520
|
+
}
|
|
1521
|
+
let available = isUndefined(argAfterEqualSign) ? 0 : 1;
|
|
1522
|
+
if (configuration["nargs-eats-options"]) {
|
|
1523
|
+
if (args2.length - (i2 + 1) + available < toEat) {
|
|
1524
|
+
error = Error(__("Not enough arguments following: %s", key));
|
|
1525
|
+
}
|
|
1526
|
+
available = toEat;
|
|
1527
|
+
} else {
|
|
1528
|
+
for (ii = i2 + 1; ii < args2.length; ii++) {
|
|
1529
|
+
if (!args2[ii].match(/^-[^0-9]/) || args2[ii].match(negative) || isUnknownOptionAsArg(args2[ii])) available++;
|
|
1530
|
+
else break;
|
|
1531
|
+
}
|
|
1532
|
+
if (available < toEat) error = Error(__("Not enough arguments following: %s", key));
|
|
1533
|
+
}
|
|
1534
|
+
let consumed = Math.min(available, toEat);
|
|
1535
|
+
if (!isUndefined(argAfterEqualSign) && consumed > 0) {
|
|
1536
|
+
setArg(key, argAfterEqualSign);
|
|
1537
|
+
consumed--;
|
|
1538
|
+
}
|
|
1539
|
+
for (ii = i2 + 1; ii < consumed + i2 + 1; ii++) {
|
|
1540
|
+
setArg(key, args2[ii]);
|
|
1541
|
+
}
|
|
1542
|
+
return i2 + consumed;
|
|
1543
|
+
}
|
|
1544
|
+
function eatArray(i2, key, args2, argAfterEqualSign) {
|
|
1545
|
+
let argsToSet = [];
|
|
1546
|
+
let next = argAfterEqualSign || args2[i2 + 1];
|
|
1547
|
+
const nargsCount = checkAllAliases(key, flags.nargs);
|
|
1548
|
+
if (checkAllAliases(key, flags.bools) && !/^(true|false)$/.test(next)) {
|
|
1549
|
+
argsToSet.push(true);
|
|
1550
|
+
} else if (isUndefined(next) || isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next)) {
|
|
1551
|
+
if (defaults[key] !== void 0) {
|
|
1552
|
+
const defVal = defaults[key];
|
|
1553
|
+
argsToSet = Array.isArray(defVal) ? defVal : [defVal];
|
|
1554
|
+
}
|
|
1555
|
+
} else {
|
|
1556
|
+
if (!isUndefined(argAfterEqualSign)) {
|
|
1557
|
+
argsToSet.push(processValue(key, argAfterEqualSign, true));
|
|
1558
|
+
}
|
|
1559
|
+
for (let ii = i2 + 1; ii < args2.length; ii++) {
|
|
1560
|
+
if (!configuration["greedy-arrays"] && argsToSet.length > 0 || nargsCount && typeof nargsCount === "number" && argsToSet.length >= nargsCount) break;
|
|
1561
|
+
next = args2[ii];
|
|
1562
|
+
if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next)) break;
|
|
1563
|
+
i2 = ii;
|
|
1564
|
+
argsToSet.push(processValue(key, next, inputIsString));
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
if (typeof nargsCount === "number" && (nargsCount && argsToSet.length < nargsCount || isNaN(nargsCount) && argsToSet.length === 0)) {
|
|
1568
|
+
error = Error(__("Not enough arguments following: %s", key));
|
|
1569
|
+
}
|
|
1570
|
+
setArg(key, argsToSet);
|
|
1571
|
+
return i2;
|
|
1572
|
+
}
|
|
1573
|
+
function setArg(key, val, shouldStripQuotes = inputIsString) {
|
|
1574
|
+
if (/-/.test(key) && configuration["camel-case-expansion"]) {
|
|
1575
|
+
const alias = key.split(".").map(function(prop) {
|
|
1576
|
+
return camelCase(prop);
|
|
1577
|
+
}).join(".");
|
|
1578
|
+
addNewAlias(key, alias);
|
|
1579
|
+
}
|
|
1580
|
+
const value = processValue(key, val, shouldStripQuotes);
|
|
1581
|
+
const splitKey = key.split(".");
|
|
1582
|
+
setKey(argv2, splitKey, value);
|
|
1583
|
+
if (flags.aliases[key]) {
|
|
1584
|
+
flags.aliases[key].forEach(function(x) {
|
|
1585
|
+
const keyProperties = x.split(".");
|
|
1586
|
+
setKey(argv2, keyProperties, value);
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
if (splitKey.length > 1 && configuration["dot-notation"]) {
|
|
1590
|
+
(flags.aliases[splitKey[0]] || []).forEach(function(x) {
|
|
1591
|
+
let keyProperties = x.split(".");
|
|
1592
|
+
const a2 = [].concat(splitKey);
|
|
1593
|
+
a2.shift();
|
|
1594
|
+
keyProperties = keyProperties.concat(a2);
|
|
1595
|
+
if (!(flags.aliases[key] || []).includes(keyProperties.join("."))) {
|
|
1596
|
+
setKey(argv2, keyProperties, value);
|
|
1597
|
+
}
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) {
|
|
1601
|
+
const keys = [key].concat(flags.aliases[key] || []);
|
|
1602
|
+
keys.forEach(function(key2) {
|
|
1603
|
+
Object.defineProperty(argvReturn, key2, {
|
|
1604
|
+
enumerable: true,
|
|
1605
|
+
get() {
|
|
1606
|
+
return val;
|
|
1607
|
+
},
|
|
1608
|
+
set(value2) {
|
|
1609
|
+
val = typeof value2 === "string" ? mixin2.normalize(value2) : value2;
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
function addNewAlias(key, alias) {
|
|
1616
|
+
if (!(flags.aliases[key] && flags.aliases[key].length)) {
|
|
1617
|
+
flags.aliases[key] = [alias];
|
|
1618
|
+
newAliases[alias] = true;
|
|
1619
|
+
}
|
|
1620
|
+
if (!(flags.aliases[alias] && flags.aliases[alias].length)) {
|
|
1621
|
+
addNewAlias(alias, key);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
function processValue(key, val, shouldStripQuotes) {
|
|
1625
|
+
if (shouldStripQuotes) {
|
|
1626
|
+
val = stripQuotes(val);
|
|
1627
|
+
}
|
|
1628
|
+
if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
|
|
1629
|
+
if (typeof val === "string") val = val === "true";
|
|
1630
|
+
}
|
|
1631
|
+
let value = Array.isArray(val) ? val.map(function(v) {
|
|
1632
|
+
return maybeCoerceNumber(key, v);
|
|
1633
|
+
}) : maybeCoerceNumber(key, val);
|
|
1634
|
+
if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === "boolean")) {
|
|
1635
|
+
value = increment();
|
|
1636
|
+
}
|
|
1637
|
+
if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
|
|
1638
|
+
if (Array.isArray(val)) value = val.map((val2) => {
|
|
1639
|
+
return mixin2.normalize(val2);
|
|
1640
|
+
});
|
|
1641
|
+
else value = mixin2.normalize(val);
|
|
1642
|
+
}
|
|
1643
|
+
return value;
|
|
1644
|
+
}
|
|
1645
|
+
function maybeCoerceNumber(key, value) {
|
|
1646
|
+
if (!configuration["parse-positional-numbers"] && key === "_") return value;
|
|
1647
|
+
if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) {
|
|
1648
|
+
const shouldCoerceNumber = looksLikeNumber(value) && configuration["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${value}`)));
|
|
1649
|
+
if (shouldCoerceNumber || !isUndefined(value) && checkAllAliases(key, flags.numbers)) {
|
|
1650
|
+
value = Number(value);
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
return value;
|
|
1654
|
+
}
|
|
1655
|
+
function setConfig(argv3) {
|
|
1656
|
+
const configLookup = /* @__PURE__ */ Object.create(null);
|
|
1657
|
+
applyDefaultsAndAliases(configLookup, flags.aliases, defaults);
|
|
1658
|
+
Object.keys(flags.configs).forEach(function(configKey) {
|
|
1659
|
+
const configPath = argv3[configKey] || configLookup[configKey];
|
|
1660
|
+
if (configPath) {
|
|
1661
|
+
try {
|
|
1662
|
+
let config = null;
|
|
1663
|
+
const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
|
|
1664
|
+
const resolveConfig = flags.configs[configKey];
|
|
1665
|
+
if (typeof resolveConfig === "function") {
|
|
1666
|
+
try {
|
|
1667
|
+
config = resolveConfig(resolvedConfigPath);
|
|
1668
|
+
} catch (e) {
|
|
1669
|
+
config = e;
|
|
1670
|
+
}
|
|
1671
|
+
if (config instanceof Error) {
|
|
1672
|
+
error = config;
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
} else {
|
|
1676
|
+
config = mixin2.require(resolvedConfigPath);
|
|
1677
|
+
}
|
|
1678
|
+
setConfigObject(config);
|
|
1679
|
+
} catch (ex) {
|
|
1680
|
+
if (ex.name === "PermissionDenied") error = ex;
|
|
1681
|
+
else if (argv3[configKey]) error = Error(__("Invalid JSON config file: %s", configPath));
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
function setConfigObject(config, prev) {
|
|
1687
|
+
Object.keys(config).forEach(function(key) {
|
|
1688
|
+
const value = config[key];
|
|
1689
|
+
const fullKey = prev ? prev + "." + key : key;
|
|
1690
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
1691
|
+
setConfigObject(value, fullKey);
|
|
1692
|
+
} else {
|
|
1693
|
+
if (!hasKey(argv2, fullKey.split(".")) || checkAllAliases(fullKey, flags.arrays) && configuration["combine-arrays"]) {
|
|
1694
|
+
setArg(fullKey, value);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
function setConfigObjects() {
|
|
1700
|
+
if (typeof configObjects !== "undefined") {
|
|
1701
|
+
configObjects.forEach(function(configObject) {
|
|
1702
|
+
setConfigObject(configObject);
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
function applyEnvVars(argv3, configOnly) {
|
|
1707
|
+
if (typeof envPrefix === "undefined") return;
|
|
1708
|
+
const prefix = typeof envPrefix === "string" ? envPrefix : "";
|
|
1709
|
+
const env3 = mixin2.env();
|
|
1710
|
+
Object.keys(env3).forEach(function(envVar) {
|
|
1711
|
+
if (prefix === "" || envVar.lastIndexOf(prefix, 0) === 0) {
|
|
1712
|
+
const keys = envVar.split("__").map(function(key, i2) {
|
|
1713
|
+
if (i2 === 0) {
|
|
1714
|
+
key = key.substring(prefix.length);
|
|
1715
|
+
}
|
|
1716
|
+
return camelCase(key);
|
|
1717
|
+
});
|
|
1718
|
+
if ((configOnly && flags.configs[keys.join(".")] || !configOnly) && !hasKey(argv3, keys)) {
|
|
1719
|
+
setArg(keys.join("."), env3[envVar]);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
function applyCoercions(argv3) {
|
|
1725
|
+
let coerce;
|
|
1726
|
+
const applied = /* @__PURE__ */ new Set();
|
|
1727
|
+
Object.keys(argv3).forEach(function(key) {
|
|
1728
|
+
if (!applied.has(key)) {
|
|
1729
|
+
coerce = checkAllAliases(key, flags.coercions);
|
|
1730
|
+
if (typeof coerce === "function") {
|
|
1731
|
+
try {
|
|
1732
|
+
const value = maybeCoerceNumber(key, coerce(argv3[key]));
|
|
1733
|
+
[].concat(flags.aliases[key] || [], key).forEach((ali) => {
|
|
1734
|
+
applied.add(ali);
|
|
1735
|
+
argv3[ali] = value;
|
|
1736
|
+
});
|
|
1737
|
+
} catch (err) {
|
|
1738
|
+
error = err;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
function setPlaceholderKeys(argv3) {
|
|
1745
|
+
flags.keys.forEach((key) => {
|
|
1746
|
+
if (~key.indexOf(".")) return;
|
|
1747
|
+
if (typeof argv3[key] === "undefined") argv3[key] = void 0;
|
|
1748
|
+
});
|
|
1749
|
+
return argv3;
|
|
1750
|
+
}
|
|
1751
|
+
function applyDefaultsAndAliases(obj, aliases2, defaults2, canLog = false) {
|
|
1752
|
+
Object.keys(defaults2).forEach(function(key) {
|
|
1753
|
+
if (!hasKey(obj, key.split("."))) {
|
|
1754
|
+
setKey(obj, key.split("."), defaults2[key]);
|
|
1755
|
+
if (canLog) defaulted[key] = true;
|
|
1756
|
+
(aliases2[key] || []).forEach(function(x) {
|
|
1757
|
+
if (hasKey(obj, x.split("."))) return;
|
|
1758
|
+
setKey(obj, x.split("."), defaults2[key]);
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1762
|
+
}
|
|
1763
|
+
function hasKey(obj, keys) {
|
|
1764
|
+
let o2 = obj;
|
|
1765
|
+
if (!configuration["dot-notation"]) keys = [keys.join(".")];
|
|
1766
|
+
keys.slice(0, -1).forEach(function(key2) {
|
|
1767
|
+
o2 = o2[key2] || {};
|
|
1768
|
+
});
|
|
1769
|
+
const key = keys[keys.length - 1];
|
|
1770
|
+
if (typeof o2 !== "object") return false;
|
|
1771
|
+
else return key in o2;
|
|
1772
|
+
}
|
|
1773
|
+
function setKey(obj, keys, value) {
|
|
1774
|
+
let o2 = obj;
|
|
1775
|
+
if (!configuration["dot-notation"]) keys = [keys.join(".")];
|
|
1776
|
+
keys.slice(0, -1).forEach(function(key2) {
|
|
1777
|
+
key2 = sanitizeKey(key2);
|
|
1778
|
+
if (typeof o2 === "object" && o2[key2] === void 0) {
|
|
1779
|
+
o2[key2] = {};
|
|
1780
|
+
}
|
|
1781
|
+
if (typeof o2[key2] !== "object" || Array.isArray(o2[key2])) {
|
|
1782
|
+
if (Array.isArray(o2[key2])) {
|
|
1783
|
+
o2[key2].push({});
|
|
1784
|
+
} else {
|
|
1785
|
+
o2[key2] = [o2[key2], {}];
|
|
1786
|
+
}
|
|
1787
|
+
o2 = o2[key2][o2[key2].length - 1];
|
|
1788
|
+
} else {
|
|
1789
|
+
o2 = o2[key2];
|
|
1790
|
+
}
|
|
1791
|
+
});
|
|
1792
|
+
const key = sanitizeKey(keys[keys.length - 1]);
|
|
1793
|
+
const isTypeArray = checkAllAliases(keys.join("."), flags.arrays);
|
|
1794
|
+
const isValueArray = Array.isArray(value);
|
|
1795
|
+
let duplicate = configuration["duplicate-arguments-array"];
|
|
1796
|
+
if (!duplicate && checkAllAliases(key, flags.nargs)) {
|
|
1797
|
+
duplicate = true;
|
|
1798
|
+
if (!isUndefined(o2[key]) && flags.nargs[key] === 1 || Array.isArray(o2[key]) && o2[key].length === flags.nargs[key]) {
|
|
1799
|
+
o2[key] = void 0;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
if (value === increment()) {
|
|
1803
|
+
o2[key] = increment(o2[key]);
|
|
1804
|
+
} else if (Array.isArray(o2[key])) {
|
|
1805
|
+
if (duplicate && isTypeArray && isValueArray) {
|
|
1806
|
+
o2[key] = configuration["flatten-duplicate-arrays"] ? o2[key].concat(value) : (Array.isArray(o2[key][0]) ? o2[key] : [o2[key]]).concat([value]);
|
|
1807
|
+
} else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) {
|
|
1808
|
+
o2[key] = value;
|
|
1809
|
+
} else {
|
|
1810
|
+
o2[key] = o2[key].concat([value]);
|
|
1811
|
+
}
|
|
1812
|
+
} else if (o2[key] === void 0 && isTypeArray) {
|
|
1813
|
+
o2[key] = isValueArray ? value : [value];
|
|
1814
|
+
} else if (duplicate && !(o2[key] === void 0 || checkAllAliases(key, flags.counts) || checkAllAliases(key, flags.bools))) {
|
|
1815
|
+
o2[key] = [o2[key], value];
|
|
1816
|
+
} else {
|
|
1817
|
+
o2[key] = value;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
function extendAliases(...args2) {
|
|
1821
|
+
args2.forEach(function(obj) {
|
|
1822
|
+
Object.keys(obj || {}).forEach(function(key) {
|
|
1823
|
+
if (flags.aliases[key]) return;
|
|
1824
|
+
flags.aliases[key] = [].concat(aliases[key] || []);
|
|
1825
|
+
flags.aliases[key].concat(key).forEach(function(x) {
|
|
1826
|
+
if (/-/.test(x) && configuration["camel-case-expansion"]) {
|
|
1827
|
+
const c2 = camelCase(x);
|
|
1828
|
+
if (c2 !== key && flags.aliases[key].indexOf(c2) === -1) {
|
|
1829
|
+
flags.aliases[key].push(c2);
|
|
1830
|
+
newAliases[c2] = true;
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
});
|
|
1834
|
+
flags.aliases[key].concat(key).forEach(function(x) {
|
|
1835
|
+
if (x.length > 1 && /[A-Z]/.test(x) && configuration["camel-case-expansion"]) {
|
|
1836
|
+
const c2 = decamelize(x, "-");
|
|
1837
|
+
if (c2 !== key && flags.aliases[key].indexOf(c2) === -1) {
|
|
1838
|
+
flags.aliases[key].push(c2);
|
|
1839
|
+
newAliases[c2] = true;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
});
|
|
1843
|
+
flags.aliases[key].forEach(function(x) {
|
|
1844
|
+
flags.aliases[x] = [key].concat(flags.aliases[key].filter(function(y2) {
|
|
1845
|
+
return x !== y2;
|
|
1846
|
+
}));
|
|
1847
|
+
});
|
|
1848
|
+
});
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
function checkAllAliases(key, flag) {
|
|
1852
|
+
const toCheck = [].concat(flags.aliases[key] || [], key);
|
|
1853
|
+
const keys = Object.keys(flag);
|
|
1854
|
+
const setAlias = toCheck.find((key2) => keys.includes(key2));
|
|
1855
|
+
return setAlias ? flag[setAlias] : false;
|
|
1856
|
+
}
|
|
1857
|
+
function hasAnyFlag(key) {
|
|
1858
|
+
const flagsKeys = Object.keys(flags);
|
|
1859
|
+
const toCheck = [].concat(flagsKeys.map((k) => flags[k]));
|
|
1860
|
+
return toCheck.some(function(flag) {
|
|
1861
|
+
return Array.isArray(flag) ? flag.includes(key) : flag[key];
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
function hasFlagsMatching(arg, ...patterns) {
|
|
1865
|
+
const toCheck = [].concat(...patterns);
|
|
1866
|
+
return toCheck.some(function(pattern) {
|
|
1867
|
+
const match = arg.match(pattern);
|
|
1868
|
+
return match && hasAnyFlag(match[1]);
|
|
1869
|
+
});
|
|
1870
|
+
}
|
|
1871
|
+
function hasAllShortFlags(arg) {
|
|
1872
|
+
if (arg.match(negative) || !arg.match(/^-[^-]+/)) {
|
|
1873
|
+
return false;
|
|
1874
|
+
}
|
|
1875
|
+
let hasAllFlags = true;
|
|
1876
|
+
let next;
|
|
1877
|
+
const letters = arg.slice(1).split("");
|
|
1878
|
+
for (let j = 0; j < letters.length; j++) {
|
|
1879
|
+
next = arg.slice(j + 2);
|
|
1880
|
+
if (!hasAnyFlag(letters[j])) {
|
|
1881
|
+
hasAllFlags = false;
|
|
1882
|
+
break;
|
|
1883
|
+
}
|
|
1884
|
+
if (letters[j + 1] && letters[j + 1] === "=" || next === "-" || /[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) || letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
1885
|
+
break;
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
return hasAllFlags;
|
|
1889
|
+
}
|
|
1890
|
+
function isUnknownOptionAsArg(arg) {
|
|
1891
|
+
return configuration["unknown-options-as-args"] && isUnknownOption(arg);
|
|
1892
|
+
}
|
|
1893
|
+
function isUnknownOption(arg) {
|
|
1894
|
+
arg = arg.replace(/^-{3,}/, "--");
|
|
1895
|
+
if (arg.match(negative)) {
|
|
1896
|
+
return false;
|
|
1897
|
+
}
|
|
1898
|
+
if (hasAllShortFlags(arg)) {
|
|
1899
|
+
return false;
|
|
1900
|
+
}
|
|
1901
|
+
const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/;
|
|
1902
|
+
const normalFlag = /^-+([^=]+?)$/;
|
|
1903
|
+
const flagEndingInHyphen = /^-+([^=]+?)-$/;
|
|
1904
|
+
const flagEndingInDigits = /^-+([^=]+?\d+)$/;
|
|
1905
|
+
const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/;
|
|
1906
|
+
return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters);
|
|
1907
|
+
}
|
|
1908
|
+
function defaultValue(key) {
|
|
1909
|
+
if (!checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts) && `${key}` in defaults) {
|
|
1910
|
+
return defaults[key];
|
|
1911
|
+
} else {
|
|
1912
|
+
return defaultForType(guessType2(key));
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
function defaultForType(type) {
|
|
1916
|
+
const def = {
|
|
1917
|
+
[DefaultValuesForTypeKey.BOOLEAN]: true,
|
|
1918
|
+
[DefaultValuesForTypeKey.STRING]: "",
|
|
1919
|
+
[DefaultValuesForTypeKey.NUMBER]: void 0,
|
|
1920
|
+
[DefaultValuesForTypeKey.ARRAY]: []
|
|
1921
|
+
};
|
|
1922
|
+
return def[type];
|
|
1923
|
+
}
|
|
1924
|
+
function guessType2(key) {
|
|
1925
|
+
let type = DefaultValuesForTypeKey.BOOLEAN;
|
|
1926
|
+
if (checkAllAliases(key, flags.strings)) type = DefaultValuesForTypeKey.STRING;
|
|
1927
|
+
else if (checkAllAliases(key, flags.numbers)) type = DefaultValuesForTypeKey.NUMBER;
|
|
1928
|
+
else if (checkAllAliases(key, flags.bools)) type = DefaultValuesForTypeKey.BOOLEAN;
|
|
1929
|
+
else if (checkAllAliases(key, flags.arrays)) type = DefaultValuesForTypeKey.ARRAY;
|
|
1930
|
+
return type;
|
|
1931
|
+
}
|
|
1932
|
+
function isUndefined(num) {
|
|
1933
|
+
return num === void 0;
|
|
1934
|
+
}
|
|
1935
|
+
function checkConfiguration() {
|
|
1936
|
+
Object.keys(flags.counts).find((key) => {
|
|
1937
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
1938
|
+
error = Error(__("Invalid configuration: %s, opts.count excludes opts.array.", key));
|
|
1939
|
+
return true;
|
|
1940
|
+
} else if (checkAllAliases(key, flags.nargs)) {
|
|
1941
|
+
error = Error(__("Invalid configuration: %s, opts.count excludes opts.narg.", key));
|
|
1942
|
+
return true;
|
|
1943
|
+
}
|
|
1944
|
+
return false;
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
return {
|
|
1948
|
+
aliases: Object.assign({}, flags.aliases),
|
|
1949
|
+
argv: Object.assign(argvReturn, argv2),
|
|
1950
|
+
configuration,
|
|
1951
|
+
defaulted: Object.assign({}, defaulted),
|
|
1952
|
+
error,
|
|
1953
|
+
newAliases: Object.assign({}, newAliases)
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
function combineAliases(aliases) {
|
|
1958
|
+
const aliasArrays = [];
|
|
1959
|
+
const combined = /* @__PURE__ */ Object.create(null);
|
|
1960
|
+
let change = true;
|
|
1961
|
+
Object.keys(aliases).forEach(function(key) {
|
|
1962
|
+
aliasArrays.push([].concat(aliases[key], key));
|
|
1963
|
+
});
|
|
1964
|
+
while (change) {
|
|
1965
|
+
change = false;
|
|
1966
|
+
for (let i2 = 0; i2 < aliasArrays.length; i2++) {
|
|
1967
|
+
for (let ii = i2 + 1; ii < aliasArrays.length; ii++) {
|
|
1968
|
+
const intersect = aliasArrays[i2].filter(function(v) {
|
|
1969
|
+
return aliasArrays[ii].indexOf(v) !== -1;
|
|
1970
|
+
});
|
|
1971
|
+
if (intersect.length) {
|
|
1972
|
+
aliasArrays[i2] = aliasArrays[i2].concat(aliasArrays[ii]);
|
|
1973
|
+
aliasArrays.splice(ii, 1);
|
|
1974
|
+
change = true;
|
|
1975
|
+
break;
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
aliasArrays.forEach(function(aliasArray) {
|
|
1981
|
+
aliasArray = aliasArray.filter(function(v, i2, self) {
|
|
1982
|
+
return self.indexOf(v) === i2;
|
|
1983
|
+
});
|
|
1984
|
+
const lastAlias = aliasArray.pop();
|
|
1985
|
+
if (lastAlias !== void 0 && typeof lastAlias === "string") {
|
|
1986
|
+
combined[lastAlias] = aliasArray;
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
return combined;
|
|
1990
|
+
}
|
|
1991
|
+
function increment(orig) {
|
|
1992
|
+
return orig !== void 0 ? orig + 1 : 1;
|
|
1993
|
+
}
|
|
1994
|
+
function sanitizeKey(key) {
|
|
1995
|
+
if (key === "__proto__") return "___proto___";
|
|
1996
|
+
return key;
|
|
1997
|
+
}
|
|
1998
|
+
function stripQuotes(val) {
|
|
1999
|
+
return typeof val === "string" && (val[0] === "'" || val[0] === '"') && val[val.length - 1] === val[0] ? val.substring(1, val.length - 1) : val;
|
|
2000
|
+
}
|
|
2001
|
+
var _a;
|
|
2002
|
+
var _b;
|
|
2003
|
+
var _c;
|
|
2004
|
+
var minNodeVersion = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12;
|
|
2005
|
+
var nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
|
|
2006
|
+
if (nodeVersion) {
|
|
2007
|
+
const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
|
|
2008
|
+
if (major < minNodeVersion) {
|
|
2009
|
+
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`);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
var env2 = process ? process.env : {};
|
|
2013
|
+
new YargsParser({
|
|
2014
|
+
cwd: process.cwd,
|
|
2015
|
+
env: () => {
|
|
2016
|
+
return env2;
|
|
2017
|
+
},
|
|
2018
|
+
format: util.format,
|
|
2019
|
+
normalize: path.normalize,
|
|
2020
|
+
resolve: path.resolve,
|
|
2021
|
+
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
2022
|
+
// we can exercise all the lines below:
|
|
2023
|
+
require: (path2) => {
|
|
2024
|
+
if (typeof chunkHKURHHWY_cjs.__require !== "undefined") {
|
|
2025
|
+
return chunkHKURHHWY_cjs.__require(path2);
|
|
2026
|
+
} else if (path2.match(/\.json$/)) {
|
|
2027
|
+
return JSON.parse(fs.readFileSync(path2, "utf8"));
|
|
2028
|
+
} else {
|
|
2029
|
+
throw Error("only .json config files are supported in ESM");
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
});
|
|
2033
|
+
var node_default = {
|
|
2034
|
+
fs: {
|
|
2035
|
+
readFileSync: fs.readFileSync,
|
|
2036
|
+
writeFile: fs.writeFile
|
|
2037
|
+
},
|
|
2038
|
+
format: util.format,
|
|
2039
|
+
resolve: path.resolve,
|
|
2040
|
+
exists: (file) => {
|
|
2041
|
+
try {
|
|
2042
|
+
return fs.statSync(file).isFile();
|
|
2043
|
+
} catch (err) {
|
|
2044
|
+
return false;
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
};
|
|
2048
|
+
|
|
2049
|
+
// ../../node_modules/.pnpm/y18n@5.0.8/node_modules/y18n/build/lib/index.js
|
|
2050
|
+
var shim;
|
|
2051
|
+
var Y18N = class {
|
|
2052
|
+
constructor(opts) {
|
|
2053
|
+
opts = opts || {};
|
|
2054
|
+
this.directory = opts.directory || "./locales";
|
|
2055
|
+
this.updateFiles = typeof opts.updateFiles === "boolean" ? opts.updateFiles : true;
|
|
2056
|
+
this.locale = opts.locale || "en";
|
|
2057
|
+
this.fallbackToLanguage = typeof opts.fallbackToLanguage === "boolean" ? opts.fallbackToLanguage : true;
|
|
2058
|
+
this.cache = /* @__PURE__ */ Object.create(null);
|
|
2059
|
+
this.writeQueue = [];
|
|
2060
|
+
}
|
|
2061
|
+
__(...args) {
|
|
2062
|
+
if (typeof arguments[0] !== "string") {
|
|
2063
|
+
return this._taggedLiteral(arguments[0], ...arguments);
|
|
2064
|
+
}
|
|
2065
|
+
const str = args.shift();
|
|
2066
|
+
let cb = function() {
|
|
2067
|
+
};
|
|
2068
|
+
if (typeof args[args.length - 1] === "function") cb = args.pop();
|
|
2069
|
+
cb = cb || function() {
|
|
2070
|
+
};
|
|
2071
|
+
if (!this.cache[this.locale]) this._readLocaleFile();
|
|
2072
|
+
if (!this.cache[this.locale][str] && this.updateFiles) {
|
|
2073
|
+
this.cache[this.locale][str] = str;
|
|
2074
|
+
this._enqueueWrite({
|
|
2075
|
+
directory: this.directory,
|
|
2076
|
+
locale: this.locale,
|
|
2077
|
+
cb
|
|
2078
|
+
});
|
|
2079
|
+
} else {
|
|
2080
|
+
cb();
|
|
2081
|
+
}
|
|
2082
|
+
return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args));
|
|
2083
|
+
}
|
|
2084
|
+
__n() {
|
|
2085
|
+
const args = Array.prototype.slice.call(arguments);
|
|
2086
|
+
const singular = args.shift();
|
|
2087
|
+
const plural = args.shift();
|
|
2088
|
+
const quantity = args.shift();
|
|
2089
|
+
let cb = function() {
|
|
2090
|
+
};
|
|
2091
|
+
if (typeof args[args.length - 1] === "function") cb = args.pop();
|
|
2092
|
+
if (!this.cache[this.locale]) this._readLocaleFile();
|
|
2093
|
+
let str = quantity === 1 ? singular : plural;
|
|
2094
|
+
if (this.cache[this.locale][singular]) {
|
|
2095
|
+
const entry = this.cache[this.locale][singular];
|
|
2096
|
+
str = entry[quantity === 1 ? "one" : "other"];
|
|
2097
|
+
}
|
|
2098
|
+
if (!this.cache[this.locale][singular] && this.updateFiles) {
|
|
2099
|
+
this.cache[this.locale][singular] = {
|
|
2100
|
+
one: singular,
|
|
2101
|
+
other: plural
|
|
2102
|
+
};
|
|
2103
|
+
this._enqueueWrite({
|
|
2104
|
+
directory: this.directory,
|
|
2105
|
+
locale: this.locale,
|
|
2106
|
+
cb
|
|
2107
|
+
});
|
|
2108
|
+
} else {
|
|
2109
|
+
cb();
|
|
2110
|
+
}
|
|
2111
|
+
const values = [str];
|
|
2112
|
+
if (~str.indexOf("%d")) values.push(quantity);
|
|
2113
|
+
return shim.format.apply(shim.format, values.concat(args));
|
|
2114
|
+
}
|
|
2115
|
+
setLocale(locale) {
|
|
2116
|
+
this.locale = locale;
|
|
2117
|
+
}
|
|
2118
|
+
getLocale() {
|
|
2119
|
+
return this.locale;
|
|
2120
|
+
}
|
|
2121
|
+
updateLocale(obj) {
|
|
2122
|
+
if (!this.cache[this.locale]) this._readLocaleFile();
|
|
2123
|
+
for (const key in obj) {
|
|
2124
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
2125
|
+
this.cache[this.locale][key] = obj[key];
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
_taggedLiteral(parts, ...args) {
|
|
2130
|
+
let str = "";
|
|
2131
|
+
parts.forEach(function(part, i2) {
|
|
2132
|
+
const arg = args[i2 + 1];
|
|
2133
|
+
str += part;
|
|
2134
|
+
if (typeof arg !== "undefined") {
|
|
2135
|
+
str += "%s";
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
2138
|
+
return this.__.apply(this, [str].concat([].slice.call(args, 1)));
|
|
2139
|
+
}
|
|
2140
|
+
_enqueueWrite(work) {
|
|
2141
|
+
this.writeQueue.push(work);
|
|
2142
|
+
if (this.writeQueue.length === 1) this._processWriteQueue();
|
|
2143
|
+
}
|
|
2144
|
+
_processWriteQueue() {
|
|
2145
|
+
const _this = this;
|
|
2146
|
+
const work = this.writeQueue[0];
|
|
2147
|
+
const directory = work.directory;
|
|
2148
|
+
const locale = work.locale;
|
|
2149
|
+
const cb = work.cb;
|
|
2150
|
+
const languageFile = this._resolveLocaleFile(directory, locale);
|
|
2151
|
+
const serializedLocale = JSON.stringify(this.cache[locale], null, 2);
|
|
2152
|
+
shim.fs.writeFile(languageFile, serializedLocale, "utf-8", function(err) {
|
|
2153
|
+
_this.writeQueue.shift();
|
|
2154
|
+
if (_this.writeQueue.length > 0) _this._processWriteQueue();
|
|
2155
|
+
cb(err);
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
_readLocaleFile() {
|
|
2159
|
+
let localeLookup = {};
|
|
2160
|
+
const languageFile = this._resolveLocaleFile(this.directory, this.locale);
|
|
2161
|
+
try {
|
|
2162
|
+
if (shim.fs.readFileSync) {
|
|
2163
|
+
localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, "utf-8"));
|
|
2164
|
+
}
|
|
2165
|
+
} catch (err) {
|
|
2166
|
+
if (err instanceof SyntaxError) {
|
|
2167
|
+
err.message = "syntax error in " + languageFile;
|
|
2168
|
+
}
|
|
2169
|
+
if (err.code === "ENOENT") localeLookup = {};
|
|
2170
|
+
else throw err;
|
|
2171
|
+
}
|
|
2172
|
+
this.cache[this.locale] = localeLookup;
|
|
2173
|
+
}
|
|
2174
|
+
_resolveLocaleFile(directory, locale) {
|
|
2175
|
+
let file = shim.resolve(directory, "./", locale + ".json");
|
|
2176
|
+
if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf("_")) {
|
|
2177
|
+
const languageFile = shim.resolve(directory, "./", locale.split("_")[0] + ".json");
|
|
2178
|
+
if (this._fileExistsSync(languageFile)) file = languageFile;
|
|
2179
|
+
}
|
|
2180
|
+
return file;
|
|
2181
|
+
}
|
|
2182
|
+
_fileExistsSync(file) {
|
|
2183
|
+
return shim.exists(file);
|
|
2184
|
+
}
|
|
2185
|
+
};
|
|
2186
|
+
function y18n(opts, _shim) {
|
|
2187
|
+
shim = _shim;
|
|
2188
|
+
const y18n3 = new Y18N(opts);
|
|
2189
|
+
return {
|
|
2190
|
+
__: y18n3.__.bind(y18n3),
|
|
2191
|
+
__n: y18n3.__n.bind(y18n3),
|
|
2192
|
+
setLocale: y18n3.setLocale.bind(y18n3),
|
|
2193
|
+
getLocale: y18n3.getLocale.bind(y18n3),
|
|
2194
|
+
updateLocale: y18n3.updateLocale.bind(y18n3),
|
|
2195
|
+
locale: y18n3.locale
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
// ../../node_modules/.pnpm/y18n@5.0.8/node_modules/y18n/index.mjs
|
|
2200
|
+
var y18n2 = (opts) => {
|
|
2201
|
+
return y18n(opts, node_default);
|
|
2202
|
+
};
|
|
2203
|
+
var y18n_default = y18n2;
|
|
2204
|
+
var __dirname$1;
|
|
2205
|
+
try {
|
|
2206
|
+
__dirname$1 = url.fileURLToPath(chunkHKURHHWY_cjs.importMetaUrl);
|
|
2207
|
+
} catch (e) {
|
|
2208
|
+
__dirname$1 = process.cwd();
|
|
2209
|
+
}
|
|
2210
|
+
var mainFilename = __dirname$1.substring(0, __dirname$1.lastIndexOf("node_modules"));
|
|
2211
|
+
({
|
|
2212
|
+
mainFilename: mainFilename || process.cwd(),
|
|
2213
|
+
process: {
|
|
2214
|
+
cwd: process.cwd,
|
|
2215
|
+
exit: process.exit,
|
|
2216
|
+
nextTick: process.nextTick,
|
|
2217
|
+
stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
|
|
2218
|
+
},
|
|
2219
|
+
y18n: y18n_default({
|
|
2220
|
+
directory: path.resolve(__dirname$1, "../../../locales"),
|
|
2221
|
+
updateFiles: false
|
|
2222
|
+
})
|
|
2223
|
+
});
|
|
2224
|
+
|
|
2225
|
+
// ../maker/build/esm/api/types.js
|
|
2226
|
+
var OntologyEntityTypeEnum = /* @__PURE__ */ function(OntologyEntityTypeEnum2) {
|
|
2227
|
+
OntologyEntityTypeEnum2["OBJECT_TYPE"] = "OBJECT_TYPE";
|
|
2228
|
+
OntologyEntityTypeEnum2["LINK_TYPE"] = "LINK_TYPE";
|
|
2229
|
+
OntologyEntityTypeEnum2["INTERFACE_TYPE"] = "INTERFACE_TYPE";
|
|
2230
|
+
OntologyEntityTypeEnum2["SHARED_PROPERTY_TYPE"] = "SHARED_PROPERTY_TYPE";
|
|
2231
|
+
OntologyEntityTypeEnum2["ACTION_TYPE"] = "ACTION_TYPE";
|
|
2232
|
+
OntologyEntityTypeEnum2["VALUE_TYPE"] = "VALUE_TYPE";
|
|
2233
|
+
return OntologyEntityTypeEnum2;
|
|
2234
|
+
}({});
|
|
2235
|
+
|
|
2236
|
+
// ../maker/build/esm/api/defineObject.js
|
|
2237
|
+
function convertToDisplayName(s2) {
|
|
2238
|
+
return s2 === void 0 || s2 == null ? "" : s2.charAt(0).toUpperCase() + s2.slice(1);
|
|
2239
|
+
}
|
|
2240
|
+
function convertToPluralDisplayName(s2) {
|
|
2241
|
+
return s2 === void 0 || s2 == null ? "" : s2.endsWith("s") ? convertToDisplayName(s2) : convertToDisplayName(s2) + "s";
|
|
2242
|
+
}
|
|
2243
|
+
function convertType(type) {
|
|
2244
|
+
switch (true) {
|
|
2245
|
+
case (typeof type === "object" && "markingType" in type):
|
|
2246
|
+
return {
|
|
2247
|
+
"type": "marking",
|
|
2248
|
+
marking: {
|
|
2249
|
+
markingType: type.markingType
|
|
2250
|
+
}
|
|
2251
|
+
};
|
|
2252
|
+
case (typeof type === "object" && "structDefinition" in type):
|
|
2253
|
+
const structFields = new Array();
|
|
2254
|
+
for (const key in type.structDefinition) {
|
|
2255
|
+
const fieldTypeDefinition = type.structDefinition[key];
|
|
2256
|
+
let field;
|
|
2257
|
+
if (typeof fieldTypeDefinition === "string") {
|
|
2258
|
+
field = {
|
|
2259
|
+
apiName: key,
|
|
2260
|
+
displayMetadata: {
|
|
2261
|
+
displayName: key,
|
|
2262
|
+
description: void 0
|
|
2263
|
+
},
|
|
2264
|
+
typeClasses: [],
|
|
2265
|
+
aliases: [],
|
|
2266
|
+
fieldType: convertType(fieldTypeDefinition)
|
|
2267
|
+
};
|
|
2268
|
+
} else {
|
|
2269
|
+
if ("fieldType" in fieldTypeDefinition) {
|
|
2270
|
+
field = {
|
|
2271
|
+
...fieldTypeDefinition,
|
|
2272
|
+
apiName: key,
|
|
2273
|
+
fieldType: convertType(fieldTypeDefinition.fieldType),
|
|
2274
|
+
typeClasses: fieldTypeDefinition.typeClasses ?? [],
|
|
2275
|
+
aliases: fieldTypeDefinition.aliases ?? []
|
|
2276
|
+
};
|
|
2277
|
+
} else {
|
|
2278
|
+
field = {
|
|
2279
|
+
apiName: key,
|
|
2280
|
+
displayMetadata: {
|
|
2281
|
+
displayName: key,
|
|
2282
|
+
description: void 0
|
|
2283
|
+
},
|
|
2284
|
+
typeClasses: [],
|
|
2285
|
+
aliases: [],
|
|
2286
|
+
fieldType: convertType(fieldTypeDefinition)
|
|
2287
|
+
};
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
structFields.push(field);
|
|
2291
|
+
}
|
|
2292
|
+
return {
|
|
2293
|
+
type: "struct",
|
|
2294
|
+
struct: {
|
|
2295
|
+
structFields
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2298
|
+
case (typeof type === "object" && "isLongText" in type):
|
|
2299
|
+
return {
|
|
2300
|
+
"type": "string",
|
|
2301
|
+
"string": {
|
|
2302
|
+
analyzerOverride: void 0,
|
|
2303
|
+
enableAsciiFolding: void 0,
|
|
2304
|
+
isLongText: type.isLongText,
|
|
2305
|
+
supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard,
|
|
2306
|
+
supportsExactMatching: type.supportsExactMatching
|
|
2307
|
+
}
|
|
2308
|
+
};
|
|
2309
|
+
case type === "geopoint":
|
|
2310
|
+
return {
|
|
2311
|
+
type: "geohash",
|
|
2312
|
+
geohash: {}
|
|
2313
|
+
};
|
|
2314
|
+
case type === "decimal":
|
|
2315
|
+
return {
|
|
2316
|
+
type,
|
|
2317
|
+
[type]: {
|
|
2318
|
+
precision: void 0,
|
|
2319
|
+
scale: void 0
|
|
2320
|
+
}
|
|
2321
|
+
};
|
|
2322
|
+
case type === "string":
|
|
2323
|
+
return {
|
|
2324
|
+
type,
|
|
2325
|
+
[type]: {
|
|
2326
|
+
analyzerOverride: void 0,
|
|
2327
|
+
enableAsciiFolding: void 0,
|
|
2328
|
+
isLongText: false,
|
|
2329
|
+
supportsEfficientLeadingWildcard: false,
|
|
2330
|
+
supportsExactMatching: true
|
|
2331
|
+
}
|
|
2332
|
+
};
|
|
2333
|
+
case type === "mediaReference":
|
|
2334
|
+
return {
|
|
2335
|
+
type,
|
|
2336
|
+
mediaReference: {}
|
|
2337
|
+
};
|
|
2338
|
+
case type === "geotimeSeries":
|
|
2339
|
+
return {
|
|
2340
|
+
type: "geotimeSeriesReference",
|
|
2341
|
+
geotimeSeriesReference: {}
|
|
2342
|
+
};
|
|
2343
|
+
default:
|
|
2344
|
+
return distributeTypeHelper(type);
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
function distributeTypeHelper(type) {
|
|
2348
|
+
return {
|
|
2349
|
+
type,
|
|
2350
|
+
[type]: {}
|
|
2351
|
+
};
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
// ../maker/build/esm/api/defineOntology.js
|
|
2355
|
+
var importedTypes;
|
|
2356
|
+
|
|
2357
|
+
// ../maker/build/esm/api/importOntologyEntity.js
|
|
2358
|
+
function importOntologyEntity(e) {
|
|
2359
|
+
if (e.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {
|
|
2360
|
+
importedTypes[e.__type][e.apiName] = e;
|
|
2361
|
+
return;
|
|
2362
|
+
}
|
|
2363
|
+
if (importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] === void 0) {
|
|
2364
|
+
importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName] = [];
|
|
2365
|
+
}
|
|
2366
|
+
importedTypes[OntologyEntityTypeEnum.VALUE_TYPE][e.apiName].push(e);
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
// src/api/importObjectType.ts
|
|
2370
|
+
function defineImportObject(objectDef) {
|
|
2371
|
+
const properties = Object.entries(objectDef.properties ?? {}).map(([apiName, type]) => ({
|
|
2372
|
+
apiName,
|
|
2373
|
+
displayName: convertToDisplayName(apiName),
|
|
2374
|
+
type: type.type
|
|
2375
|
+
}));
|
|
2376
|
+
const finalObject = {
|
|
2377
|
+
apiName: objectDef.apiName,
|
|
2378
|
+
properties,
|
|
2379
|
+
__type: OntologyEntityTypeEnum.OBJECT_TYPE,
|
|
2380
|
+
// the rest don't matter for now
|
|
2381
|
+
displayName: objectDef.displayName ?? convertToDisplayName(objectDef.apiName),
|
|
2382
|
+
pluralDisplayName: convertToPluralDisplayName(objectDef.apiName),
|
|
2383
|
+
primaryKeyPropertyApiName: properties[0]?.apiName,
|
|
2384
|
+
titlePropertyApiName: properties[0]?.apiName
|
|
2385
|
+
};
|
|
2386
|
+
importOntologyEntity(finalObject);
|
|
2387
|
+
const importPropertyTypes = Object.entries(objectDef.properties).map(([apiName, importedPt]) => ({
|
|
2388
|
+
...importedPt,
|
|
2389
|
+
apiName,
|
|
2390
|
+
displayName: importedPt.displayName ?? convertToDisplayName(apiName),
|
|
2391
|
+
type: convertType(importedPt.type)
|
|
2392
|
+
}));
|
|
2393
|
+
const ontologyImportObject = {
|
|
2394
|
+
...objectDef,
|
|
2395
|
+
displayName: objectDef.displayName ?? convertToDisplayName(objectDef.apiName),
|
|
2396
|
+
propertyTypes: importPropertyTypes
|
|
2397
|
+
};
|
|
2398
|
+
return ontologyImportObject;
|
|
2399
|
+
}
|
|
2400
|
+
/*! Bundled license information:
|
|
2401
|
+
|
|
2402
|
+
yargs-parser/build/lib/string-utils.js:
|
|
2403
|
+
yargs-parser/build/lib/tokenize-arg-string.js:
|
|
2404
|
+
yargs-parser/build/lib/yargs-parser-types.js:
|
|
2405
|
+
yargs-parser/build/lib/yargs-parser.js:
|
|
2406
|
+
(**
|
|
2407
|
+
* @license
|
|
2408
|
+
* Copyright (c) 2016, Contributors
|
|
2409
|
+
* SPDX-License-Identifier: ISC
|
|
2410
|
+
*)
|
|
2411
|
+
|
|
2412
|
+
yargs-parser/build/lib/index.js:
|
|
2413
|
+
(**
|
|
2414
|
+
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
2415
|
+
* CJS and ESM environments.
|
|
2416
|
+
*
|
|
2417
|
+
* @license
|
|
2418
|
+
* Copyright (c) 2016, Contributors
|
|
2419
|
+
* SPDX-License-Identifier: ISC
|
|
2420
|
+
*)
|
|
2421
|
+
*/
|
|
2422
|
+
|
|
2423
|
+
exports.defineImportObject = defineImportObject;
|
|
2424
|
+
//# sourceMappingURL=index.cjs.map
|
|
2425
|
+
//# sourceMappingURL=index.cjs.map
|