@osdk/generator 2.2.0-beta.13 → 2.2.0-beta.15
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/CHANGELOG.md +24 -0
- package/build/browser/util/test/TodoWireOntology.js +2 -0
- package/build/browser/util/test/TodoWireOntology.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +2 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/cjs/index.cjs +40 -1109
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/util/test/TodoWireOntology.js +2 -0
- package/build/esm/util/test/TodoWireOntology.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +2 -0
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/package.json +5 -5
- package/build/cjs/prompt-IKRSF7JL.cjs +0 -954
- package/build/cjs/prompt-IKRSF7JL.cjs.map +0 -1
package/build/cjs/index.cjs
CHANGED
|
@@ -4,9 +4,7 @@ var fs = require('fs');
|
|
|
4
4
|
var path8 = require('path');
|
|
5
5
|
var generatorConverters = require('@osdk/generator-converters');
|
|
6
6
|
var prettier = require('prettier');
|
|
7
|
-
var
|
|
8
|
-
var p$1 = require('process');
|
|
9
|
-
var tty = require('tty');
|
|
7
|
+
var consola = require('consola');
|
|
10
8
|
var fastDeepEqual = require('fast-deep-equal');
|
|
11
9
|
var invariant = require('tiny-invariant');
|
|
12
10
|
|
|
@@ -32,8 +30,7 @@ function _interopNamespace(e) {
|
|
|
32
30
|
|
|
33
31
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
34
32
|
var path8__namespace = /*#__PURE__*/_interopNamespace(path8);
|
|
35
|
-
var
|
|
36
|
-
var tty__namespace = /*#__PURE__*/_interopNamespace(tty);
|
|
33
|
+
var consola__default = /*#__PURE__*/_interopDefault(consola);
|
|
37
34
|
var fastDeepEqual__default = /*#__PURE__*/_interopDefault(fastDeepEqual);
|
|
38
35
|
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
39
36
|
|
|
@@ -224,9 +221,9 @@ var EnhancedOntologyDefinition = class {
|
|
|
224
221
|
requireQueryType = this.#createRequireType("queryTypes");
|
|
225
222
|
requireSharedPropertyType = this.#createRequireType("sharedPropertyTypes");
|
|
226
223
|
};
|
|
227
|
-
function remap(
|
|
224
|
+
function remap(r, common, Constructor, externalMap) {
|
|
228
225
|
const entries = [];
|
|
229
|
-
for (const [fullApiName, v] of Object.entries(
|
|
226
|
+
for (const [fullApiName, v] of Object.entries(r ?? {})) {
|
|
230
227
|
if (externalMap?.has(fullApiName)) ; else {
|
|
231
228
|
entries.push([fullApiName, new Constructor(common, v)]);
|
|
232
229
|
}
|
|
@@ -237,7 +234,7 @@ function remap(r2, common, Constructor, externalMap) {
|
|
|
237
234
|
entries.push([fullApiName, new ForeignType(common, apiNamespace, shortApiName, destPackage)]);
|
|
238
235
|
}
|
|
239
236
|
}
|
|
240
|
-
return Object.fromEntries(entries.sort((
|
|
237
|
+
return Object.fromEntries(entries.sort((a, b) => a[0].localeCompare(b[0])));
|
|
241
238
|
}
|
|
242
239
|
|
|
243
240
|
// src/GenerateContext/enhanceOntology.ts
|
|
@@ -330,7 +327,7 @@ var defaultCustomizer = (value, defaultValueFormatter, key, defaultKeyFormatter)
|
|
|
330
327
|
function stringify(obj, customizer = {}, separator = ",\n") {
|
|
331
328
|
const defaultKeyFormatter = (key) => `${JSON.stringify(key)}`;
|
|
332
329
|
const entries = [];
|
|
333
|
-
const sortedKeys = Object.keys(obj).sort((
|
|
330
|
+
const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));
|
|
334
331
|
for (const key of sortedKeys) {
|
|
335
332
|
const value = obj[key];
|
|
336
333
|
const res = (customizer[key] ?? customizer["*"] ?? defaultCustomizer)(value, (value2) => JSON.stringify(value2, null, 2), key, defaultKeyFormatter);
|
|
@@ -385,7 +382,7 @@ async function generatePerActionDataFiles({
|
|
|
385
382
|
const fullActionDef = deleteUndefineds(generatorConverters.wireActionTypeV2ToSdkActionMetadata(action.raw));
|
|
386
383
|
function createParamsDef() {
|
|
387
384
|
const entries = Object.entries(fullActionDef.parameters ?? {});
|
|
388
|
-
entries.sort((
|
|
385
|
+
entries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
389
386
|
if (entries.length === 0) {
|
|
390
387
|
return `// Represents the definition of the parameters for the action
|
|
391
388
|
export type ParamsDefinition = Record<string, never>;`;
|
|
@@ -446,7 +443,7 @@ async function generatePerActionDataFiles({
|
|
|
446
443
|
${getDescriptionIfPresent(action.description)}
|
|
447
444
|
export interface Params {
|
|
448
445
|
${stringify(fullActionDef.parameters, {
|
|
449
|
-
"*": (ogValue,
|
|
446
|
+
"*": (ogValue, _, ogKey) => {
|
|
450
447
|
const key = `${getDescriptionIfPresent(ogValue.description)}
|
|
451
448
|
readonly "${ogKey}"${ogValue.nullable ? "?" : ""}`;
|
|
452
449
|
const value = ogValue.multiplicity ? `ReadonlyArray<${getActionParamType(ogValue.type)}>` : `${getActionParamType(ogValue.type)}`;
|
|
@@ -505,32 +502,32 @@ async function generatePerActionDataFiles({
|
|
|
505
502
|
`;
|
|
506
503
|
}
|
|
507
504
|
const referencedObjectDefs = /* @__PURE__ */ new Set();
|
|
508
|
-
for (const
|
|
509
|
-
if (
|
|
510
|
-
if (
|
|
511
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(
|
|
505
|
+
for (const p of Object.values(action.parameters)) {
|
|
506
|
+
if (p.dataType.type === "object" || p.dataType.type === "objectSet") {
|
|
507
|
+
if (p.dataType.objectApiName) {
|
|
508
|
+
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectApiName));
|
|
512
509
|
}
|
|
513
|
-
if (
|
|
514
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(
|
|
510
|
+
if (p.dataType.objectTypeApiName) {
|
|
511
|
+
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectTypeApiName));
|
|
515
512
|
}
|
|
516
513
|
}
|
|
517
|
-
if (
|
|
518
|
-
if (
|
|
519
|
-
referencedObjectDefs.add(enhancedOntology.requireInterfaceType(
|
|
514
|
+
if (p.dataType.type === "interfaceObject") {
|
|
515
|
+
if (p.dataType.interfaceTypeApiName) {
|
|
516
|
+
referencedObjectDefs.add(enhancedOntology.requireInterfaceType(p.dataType.interfaceTypeApiName));
|
|
520
517
|
}
|
|
521
518
|
}
|
|
522
|
-
if (
|
|
523
|
-
if (
|
|
524
|
-
if (
|
|
525
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(
|
|
519
|
+
if (p.dataType.type === "array") {
|
|
520
|
+
if (p.dataType.subType.type === "object" || p.dataType.subType.type === "objectSet") {
|
|
521
|
+
if (p.dataType.subType.objectApiName) {
|
|
522
|
+
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectApiName));
|
|
526
523
|
}
|
|
527
|
-
if (
|
|
528
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(
|
|
524
|
+
if (p.dataType.subType.objectTypeApiName) {
|
|
525
|
+
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectTypeApiName));
|
|
529
526
|
}
|
|
530
527
|
}
|
|
531
|
-
if (
|
|
532
|
-
if (
|
|
533
|
-
referencedObjectDefs.add(enhancedOntology.requireInterfaceType(
|
|
528
|
+
if (p.dataType.subType.type === "interfaceObject") {
|
|
529
|
+
if (p.dataType.subType.interfaceTypeApiName) {
|
|
530
|
+
referencedObjectDefs.add(enhancedOntology.requireInterfaceType(p.dataType.subType.interfaceTypeApiName));
|
|
534
531
|
}
|
|
535
532
|
}
|
|
536
533
|
}
|
|
@@ -604,1072 +601,6 @@ function extractReferencedObjectsFromActionParameter(actionParameter) {
|
|
|
604
601
|
}
|
|
605
602
|
}
|
|
606
603
|
|
|
607
|
-
// ../../node_modules/.pnpm/consola@3.4.0/node_modules/consola/dist/core.mjs
|
|
608
|
-
var LogLevels = {
|
|
609
|
-
silent: Number.NEGATIVE_INFINITY,
|
|
610
|
-
fatal: 0,
|
|
611
|
-
error: 0,
|
|
612
|
-
warn: 1,
|
|
613
|
-
log: 2,
|
|
614
|
-
info: 3,
|
|
615
|
-
success: 3,
|
|
616
|
-
fail: 3,
|
|
617
|
-
ready: 3,
|
|
618
|
-
start: 3,
|
|
619
|
-
box: 3,
|
|
620
|
-
debug: 4,
|
|
621
|
-
trace: 5,
|
|
622
|
-
verbose: Number.POSITIVE_INFINITY
|
|
623
|
-
};
|
|
624
|
-
var LogTypes = {
|
|
625
|
-
// Silent
|
|
626
|
-
silent: {
|
|
627
|
-
level: -1
|
|
628
|
-
},
|
|
629
|
-
// Level 0
|
|
630
|
-
fatal: {
|
|
631
|
-
level: LogLevels.fatal
|
|
632
|
-
},
|
|
633
|
-
error: {
|
|
634
|
-
level: LogLevels.error
|
|
635
|
-
},
|
|
636
|
-
// Level 1
|
|
637
|
-
warn: {
|
|
638
|
-
level: LogLevels.warn
|
|
639
|
-
},
|
|
640
|
-
// Level 2
|
|
641
|
-
log: {
|
|
642
|
-
level: LogLevels.log
|
|
643
|
-
},
|
|
644
|
-
// Level 3
|
|
645
|
-
info: {
|
|
646
|
-
level: LogLevels.info
|
|
647
|
-
},
|
|
648
|
-
success: {
|
|
649
|
-
level: LogLevels.success
|
|
650
|
-
},
|
|
651
|
-
fail: {
|
|
652
|
-
level: LogLevels.fail
|
|
653
|
-
},
|
|
654
|
-
ready: {
|
|
655
|
-
level: LogLevels.info
|
|
656
|
-
},
|
|
657
|
-
start: {
|
|
658
|
-
level: LogLevels.info
|
|
659
|
-
},
|
|
660
|
-
box: {
|
|
661
|
-
level: LogLevels.info
|
|
662
|
-
},
|
|
663
|
-
// Level 4
|
|
664
|
-
debug: {
|
|
665
|
-
level: LogLevels.debug
|
|
666
|
-
},
|
|
667
|
-
// Level 5
|
|
668
|
-
trace: {
|
|
669
|
-
level: LogLevels.trace
|
|
670
|
-
},
|
|
671
|
-
// Verbose
|
|
672
|
-
verbose: {
|
|
673
|
-
level: LogLevels.verbose
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
function isPlainObject$1(value) {
|
|
677
|
-
if (value === null || typeof value !== "object") {
|
|
678
|
-
return false;
|
|
679
|
-
}
|
|
680
|
-
const prototype = Object.getPrototypeOf(value);
|
|
681
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
682
|
-
return false;
|
|
683
|
-
}
|
|
684
|
-
if (Symbol.iterator in value) {
|
|
685
|
-
return false;
|
|
686
|
-
}
|
|
687
|
-
if (Symbol.toStringTag in value) {
|
|
688
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
689
|
-
}
|
|
690
|
-
return true;
|
|
691
|
-
}
|
|
692
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
693
|
-
if (!isPlainObject$1(defaults)) {
|
|
694
|
-
return _defu(baseObject, {}, namespace);
|
|
695
|
-
}
|
|
696
|
-
const object = Object.assign({}, defaults);
|
|
697
|
-
for (const key in baseObject) {
|
|
698
|
-
if (key === "__proto__" || key === "constructor") {
|
|
699
|
-
continue;
|
|
700
|
-
}
|
|
701
|
-
const value = baseObject[key];
|
|
702
|
-
if (value === null || value === undefined) {
|
|
703
|
-
continue;
|
|
704
|
-
}
|
|
705
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
706
|
-
object[key] = [...value, ...object[key]];
|
|
707
|
-
} else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
|
|
708
|
-
object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString());
|
|
709
|
-
} else {
|
|
710
|
-
object[key] = value;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
return object;
|
|
714
|
-
}
|
|
715
|
-
function createDefu(merger) {
|
|
716
|
-
return (...arguments_) => (
|
|
717
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
718
|
-
arguments_.reduce((p2, c2) => _defu(p2, c2, ""), {})
|
|
719
|
-
);
|
|
720
|
-
}
|
|
721
|
-
var defu = createDefu();
|
|
722
|
-
function isPlainObject(obj) {
|
|
723
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
724
|
-
}
|
|
725
|
-
function isLogObj(arg) {
|
|
726
|
-
if (!isPlainObject(arg)) {
|
|
727
|
-
return false;
|
|
728
|
-
}
|
|
729
|
-
if (!arg.message && !arg.args) {
|
|
730
|
-
return false;
|
|
731
|
-
}
|
|
732
|
-
if (arg.stack) {
|
|
733
|
-
return false;
|
|
734
|
-
}
|
|
735
|
-
return true;
|
|
736
|
-
}
|
|
737
|
-
var paused = false;
|
|
738
|
-
var queue = [];
|
|
739
|
-
var Consola = class _Consola {
|
|
740
|
-
options;
|
|
741
|
-
_lastLog;
|
|
742
|
-
_mockFn;
|
|
743
|
-
/**
|
|
744
|
-
* Creates an instance of Consola with specified options or defaults.
|
|
745
|
-
*
|
|
746
|
-
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
747
|
-
*/
|
|
748
|
-
constructor(options = {}) {
|
|
749
|
-
const types = options.types || LogTypes;
|
|
750
|
-
this.options = defu({
|
|
751
|
-
...options,
|
|
752
|
-
defaults: {
|
|
753
|
-
...options.defaults
|
|
754
|
-
},
|
|
755
|
-
level: _normalizeLogLevel(options.level, types),
|
|
756
|
-
reporters: [...options.reporters || []]
|
|
757
|
-
}, {
|
|
758
|
-
types: LogTypes,
|
|
759
|
-
throttle: 1e3,
|
|
760
|
-
throttleMin: 5,
|
|
761
|
-
formatOptions: {
|
|
762
|
-
date: true,
|
|
763
|
-
colors: false,
|
|
764
|
-
compact: true
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
for (const type in types) {
|
|
768
|
-
const defaults = {
|
|
769
|
-
type,
|
|
770
|
-
...this.options.defaults,
|
|
771
|
-
...types[type]
|
|
772
|
-
};
|
|
773
|
-
this[type] = this._wrapLogFn(defaults);
|
|
774
|
-
this[type].raw = this._wrapLogFn(defaults, true);
|
|
775
|
-
}
|
|
776
|
-
if (this.options.mockFn) {
|
|
777
|
-
this.mockTypes();
|
|
778
|
-
}
|
|
779
|
-
this._lastLog = {};
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Gets the current log level of the Consola instance.
|
|
783
|
-
*
|
|
784
|
-
* @returns {number} The current log level.
|
|
785
|
-
*/
|
|
786
|
-
get level() {
|
|
787
|
-
return this.options.level;
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* Sets the minimum log level that will be output by the instance.
|
|
791
|
-
*
|
|
792
|
-
* @param {number} level - The new log level to set.
|
|
793
|
-
*/
|
|
794
|
-
set level(level) {
|
|
795
|
-
this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* Displays a prompt to the user and returns the response.
|
|
799
|
-
* Throw an error if `prompt` is not supported by the current configuration.
|
|
800
|
-
*
|
|
801
|
-
* @template T
|
|
802
|
-
* @param {string} message - The message to display in the prompt.
|
|
803
|
-
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
804
|
-
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
805
|
-
*/
|
|
806
|
-
prompt(message, opts) {
|
|
807
|
-
if (!this.options.prompt) {
|
|
808
|
-
throw new Error("prompt is not supported!");
|
|
809
|
-
}
|
|
810
|
-
return this.options.prompt(message, opts);
|
|
811
|
-
}
|
|
812
|
-
/**
|
|
813
|
-
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
814
|
-
*
|
|
815
|
-
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
816
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
817
|
-
*/
|
|
818
|
-
create(options) {
|
|
819
|
-
const instance = new _Consola({
|
|
820
|
-
...this.options,
|
|
821
|
-
...options
|
|
822
|
-
});
|
|
823
|
-
if (this._mockFn) {
|
|
824
|
-
instance.mockTypes(this._mockFn);
|
|
825
|
-
}
|
|
826
|
-
return instance;
|
|
827
|
-
}
|
|
828
|
-
/**
|
|
829
|
-
* Creates a new Consola instance with the specified default log object properties.
|
|
830
|
-
*
|
|
831
|
-
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
832
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
833
|
-
*/
|
|
834
|
-
withDefaults(defaults) {
|
|
835
|
-
return this.create({
|
|
836
|
-
...this.options,
|
|
837
|
-
defaults: {
|
|
838
|
-
...this.options.defaults,
|
|
839
|
-
...defaults
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
/**
|
|
844
|
-
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
845
|
-
*
|
|
846
|
-
* @param {string} tag - The tag to include in each log of the new instance.
|
|
847
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
848
|
-
*/
|
|
849
|
-
withTag(tag) {
|
|
850
|
-
return this.withDefaults({
|
|
851
|
-
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* Adds a custom reporter to the Consola instance.
|
|
856
|
-
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
857
|
-
*
|
|
858
|
-
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
859
|
-
* @returns {Consola} The current Consola instance.
|
|
860
|
-
*/
|
|
861
|
-
addReporter(reporter) {
|
|
862
|
-
this.options.reporters.push(reporter);
|
|
863
|
-
return this;
|
|
864
|
-
}
|
|
865
|
-
/**
|
|
866
|
-
* Removes a custom reporter from the Consola instance.
|
|
867
|
-
* If no reporter is specified, all reporters will be removed.
|
|
868
|
-
*
|
|
869
|
-
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
870
|
-
* @returns {Consola} The current Consola instance.
|
|
871
|
-
*/
|
|
872
|
-
removeReporter(reporter) {
|
|
873
|
-
if (reporter) {
|
|
874
|
-
const i2 = this.options.reporters.indexOf(reporter);
|
|
875
|
-
if (i2 !== -1) {
|
|
876
|
-
return this.options.reporters.splice(i2, 1);
|
|
877
|
-
}
|
|
878
|
-
} else {
|
|
879
|
-
this.options.reporters.splice(0);
|
|
880
|
-
}
|
|
881
|
-
return this;
|
|
882
|
-
}
|
|
883
|
-
/**
|
|
884
|
-
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
885
|
-
*
|
|
886
|
-
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
887
|
-
* @returns {Consola} The current Consola instance.
|
|
888
|
-
*/
|
|
889
|
-
setReporters(reporters) {
|
|
890
|
-
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
891
|
-
return this;
|
|
892
|
-
}
|
|
893
|
-
wrapAll() {
|
|
894
|
-
this.wrapConsole();
|
|
895
|
-
this.wrapStd();
|
|
896
|
-
}
|
|
897
|
-
restoreAll() {
|
|
898
|
-
this.restoreConsole();
|
|
899
|
-
this.restoreStd();
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* Overrides console methods with Consola logging methods for consistent logging.
|
|
903
|
-
*/
|
|
904
|
-
wrapConsole() {
|
|
905
|
-
for (const type in this.options.types) {
|
|
906
|
-
if (!console["__" + type]) {
|
|
907
|
-
console["__" + type] = console[type];
|
|
908
|
-
}
|
|
909
|
-
console[type] = this[type].raw;
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
/**
|
|
913
|
-
* Restores the original console methods, removing Consola overrides.
|
|
914
|
-
*/
|
|
915
|
-
restoreConsole() {
|
|
916
|
-
for (const type in this.options.types) {
|
|
917
|
-
if (console["__" + type]) {
|
|
918
|
-
console[type] = console["__" + type];
|
|
919
|
-
delete console["__" + type];
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Overrides standard output and error streams to redirect them through Consola.
|
|
925
|
-
*/
|
|
926
|
-
wrapStd() {
|
|
927
|
-
this._wrapStream(this.options.stdout, "log");
|
|
928
|
-
this._wrapStream(this.options.stderr, "log");
|
|
929
|
-
}
|
|
930
|
-
_wrapStream(stream, type) {
|
|
931
|
-
if (!stream) {
|
|
932
|
-
return;
|
|
933
|
-
}
|
|
934
|
-
if (!stream.__write) {
|
|
935
|
-
stream.__write = stream.write;
|
|
936
|
-
}
|
|
937
|
-
stream.write = (data) => {
|
|
938
|
-
this[type].raw(String(data).trim());
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
/**
|
|
942
|
-
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
943
|
-
*/
|
|
944
|
-
restoreStd() {
|
|
945
|
-
this._restoreStream(this.options.stdout);
|
|
946
|
-
this._restoreStream(this.options.stderr);
|
|
947
|
-
}
|
|
948
|
-
_restoreStream(stream) {
|
|
949
|
-
if (!stream) {
|
|
950
|
-
return;
|
|
951
|
-
}
|
|
952
|
-
if (stream.__write) {
|
|
953
|
-
stream.write = stream.__write;
|
|
954
|
-
delete stream.__write;
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
/**
|
|
958
|
-
* Pauses logging, queues incoming logs until resumed.
|
|
959
|
-
*/
|
|
960
|
-
pauseLogs() {
|
|
961
|
-
paused = true;
|
|
962
|
-
}
|
|
963
|
-
/**
|
|
964
|
-
* Resumes logging, processing any queued logs.
|
|
965
|
-
*/
|
|
966
|
-
resumeLogs() {
|
|
967
|
-
paused = false;
|
|
968
|
-
const _queue = queue.splice(0);
|
|
969
|
-
for (const item of _queue) {
|
|
970
|
-
item[0]._logFn(item[1], item[2]);
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Replaces logging methods with mocks if a mock function is provided.
|
|
975
|
-
*
|
|
976
|
-
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
977
|
-
*/
|
|
978
|
-
mockTypes(mockFn) {
|
|
979
|
-
const _mockFn = mockFn || this.options.mockFn;
|
|
980
|
-
this._mockFn = _mockFn;
|
|
981
|
-
if (typeof _mockFn !== "function") {
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
for (const type in this.options.types) {
|
|
985
|
-
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
986
|
-
this[type].raw = this[type];
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
_wrapLogFn(defaults, isRaw) {
|
|
990
|
-
return (...args) => {
|
|
991
|
-
if (paused) {
|
|
992
|
-
queue.push([this, defaults, args, isRaw]);
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
return this._logFn(defaults, args, isRaw);
|
|
996
|
-
};
|
|
997
|
-
}
|
|
998
|
-
_logFn(defaults, args, isRaw) {
|
|
999
|
-
if ((defaults.level || 0) > this.level) {
|
|
1000
|
-
return false;
|
|
1001
|
-
}
|
|
1002
|
-
const logObj = {
|
|
1003
|
-
date: /* @__PURE__ */ new Date(),
|
|
1004
|
-
args: [],
|
|
1005
|
-
...defaults,
|
|
1006
|
-
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
1007
|
-
};
|
|
1008
|
-
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
1009
|
-
Object.assign(logObj, args[0]);
|
|
1010
|
-
} else {
|
|
1011
|
-
logObj.args = [...args];
|
|
1012
|
-
}
|
|
1013
|
-
if (logObj.message) {
|
|
1014
|
-
logObj.args.unshift(logObj.message);
|
|
1015
|
-
delete logObj.message;
|
|
1016
|
-
}
|
|
1017
|
-
if (logObj.additional) {
|
|
1018
|
-
if (!Array.isArray(logObj.additional)) {
|
|
1019
|
-
logObj.additional = logObj.additional.split("\n");
|
|
1020
|
-
}
|
|
1021
|
-
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
1022
|
-
delete logObj.additional;
|
|
1023
|
-
}
|
|
1024
|
-
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
1025
|
-
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
1026
|
-
const resolveLog = (newLog = false) => {
|
|
1027
|
-
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
1028
|
-
if (this._lastLog.object && repeated > 0) {
|
|
1029
|
-
const args2 = [...this._lastLog.object.args];
|
|
1030
|
-
if (repeated > 1) {
|
|
1031
|
-
args2.push(`(repeated ${repeated} times)`);
|
|
1032
|
-
}
|
|
1033
|
-
this._log({
|
|
1034
|
-
...this._lastLog.object,
|
|
1035
|
-
args: args2
|
|
1036
|
-
});
|
|
1037
|
-
this._lastLog.count = 1;
|
|
1038
|
-
}
|
|
1039
|
-
if (newLog) {
|
|
1040
|
-
this._lastLog.object = logObj;
|
|
1041
|
-
this._log(logObj);
|
|
1042
|
-
}
|
|
1043
|
-
};
|
|
1044
|
-
clearTimeout(this._lastLog.timeout);
|
|
1045
|
-
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
1046
|
-
this._lastLog.time = logObj.date;
|
|
1047
|
-
if (diffTime < this.options.throttle) {
|
|
1048
|
-
try {
|
|
1049
|
-
const serializedLog = JSON.stringify([logObj.type, logObj.tag, logObj.args]);
|
|
1050
|
-
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
1051
|
-
this._lastLog.serialized = serializedLog;
|
|
1052
|
-
if (isSameLog) {
|
|
1053
|
-
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
1054
|
-
if (this._lastLog.count > this.options.throttleMin) {
|
|
1055
|
-
this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
|
|
1056
|
-
return;
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
} catch {
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
resolveLog(true);
|
|
1063
|
-
}
|
|
1064
|
-
_log(logObj) {
|
|
1065
|
-
for (const reporter of this.options.reporters) {
|
|
1066
|
-
reporter.log(logObj, {
|
|
1067
|
-
options: this.options
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
};
|
|
1072
|
-
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
1073
|
-
if (input === undefined) {
|
|
1074
|
-
return defaultLevel;
|
|
1075
|
-
}
|
|
1076
|
-
if (typeof input === "number") {
|
|
1077
|
-
return input;
|
|
1078
|
-
}
|
|
1079
|
-
if (types[input] && types[input].level !== undefined) {
|
|
1080
|
-
return types[input].level;
|
|
1081
|
-
}
|
|
1082
|
-
return defaultLevel;
|
|
1083
|
-
}
|
|
1084
|
-
Consola.prototype.add = Consola.prototype.addReporter;
|
|
1085
|
-
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
1086
|
-
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
1087
|
-
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
1088
|
-
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
1089
|
-
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
1090
|
-
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
1091
|
-
function createConsola(options = {}) {
|
|
1092
|
-
return new Consola(options);
|
|
1093
|
-
}
|
|
1094
|
-
function parseStack(stack) {
|
|
1095
|
-
const cwd = process.cwd() + path8.sep;
|
|
1096
|
-
const lines = stack.split("\n").splice(1).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
1097
|
-
return lines;
|
|
1098
|
-
}
|
|
1099
|
-
function writeStream(data, stream) {
|
|
1100
|
-
const write = stream.__write || stream.write;
|
|
1101
|
-
return write.call(stream, data);
|
|
1102
|
-
}
|
|
1103
|
-
var bracket = (x) => x ? `[${x}]` : "";
|
|
1104
|
-
var BasicReporter = class {
|
|
1105
|
-
formatStack(stack, opts) {
|
|
1106
|
-
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
1107
|
-
return indent + parseStack(stack).join(`
|
|
1108
|
-
${indent}`);
|
|
1109
|
-
}
|
|
1110
|
-
formatError(err, opts) {
|
|
1111
|
-
const message = err.message ?? util.formatWithOptions(opts, err);
|
|
1112
|
-
const stack = err.stack ? this.formatStack(err.stack, opts) : "";
|
|
1113
|
-
const level = opts?.errorLevel || 0;
|
|
1114
|
-
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
|
|
1115
|
-
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
|
|
1116
|
-
...opts,
|
|
1117
|
-
errorLevel: level + 1
|
|
1118
|
-
}) : "";
|
|
1119
|
-
return causedPrefix + message + "\n" + stack + causedError;
|
|
1120
|
-
}
|
|
1121
|
-
formatArgs(args, opts) {
|
|
1122
|
-
const _args = args.map((arg) => {
|
|
1123
|
-
if (arg && typeof arg.stack === "string") {
|
|
1124
|
-
return this.formatError(arg, opts);
|
|
1125
|
-
}
|
|
1126
|
-
return arg;
|
|
1127
|
-
});
|
|
1128
|
-
return util.formatWithOptions(opts, ..._args);
|
|
1129
|
-
}
|
|
1130
|
-
formatDate(date, opts) {
|
|
1131
|
-
return opts.date ? date.toLocaleTimeString() : "";
|
|
1132
|
-
}
|
|
1133
|
-
filterAndJoin(arr) {
|
|
1134
|
-
return arr.filter(Boolean).join(" ");
|
|
1135
|
-
}
|
|
1136
|
-
formatLogObj(logObj, opts) {
|
|
1137
|
-
const message = this.formatArgs(logObj.args, opts);
|
|
1138
|
-
if (logObj.type === "box") {
|
|
1139
|
-
return "\n" + [bracket(logObj.tag), logObj.title && logObj.title, ...message.split("\n")].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
|
|
1140
|
-
}
|
|
1141
|
-
return this.filterAndJoin([bracket(logObj.type), bracket(logObj.tag), message]);
|
|
1142
|
-
}
|
|
1143
|
-
log(logObj, ctx) {
|
|
1144
|
-
const line = this.formatLogObj(logObj, {
|
|
1145
|
-
columns: ctx.options.stdout.columns || 0,
|
|
1146
|
-
...ctx.options.formatOptions
|
|
1147
|
-
});
|
|
1148
|
-
return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
1149
|
-
}
|
|
1150
|
-
};
|
|
1151
|
-
var {
|
|
1152
|
-
env = {},
|
|
1153
|
-
argv = [],
|
|
1154
|
-
platform = ""
|
|
1155
|
-
} = typeof process === "undefined" ? {} : process;
|
|
1156
|
-
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
1157
|
-
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
1158
|
-
var isWindows = platform === "win32";
|
|
1159
|
-
var isDumbTerminal = env.TERM === "dumb";
|
|
1160
|
-
var isCompatibleTerminal = tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
|
|
1161
|
-
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
1162
|
-
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
1163
|
-
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)) {
|
|
1164
|
-
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
1165
|
-
}
|
|
1166
|
-
function clearBleed(index, string, open, close, replace) {
|
|
1167
|
-
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
1168
|
-
}
|
|
1169
|
-
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
1170
|
-
return (string) => string || !(string === "" || string === undefined) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
1171
|
-
}
|
|
1172
|
-
function init(open, close, replace) {
|
|
1173
|
-
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
1174
|
-
}
|
|
1175
|
-
var colorDefs = {
|
|
1176
|
-
reset: init(0, 0),
|
|
1177
|
-
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
1178
|
-
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
1179
|
-
italic: init(3, 23),
|
|
1180
|
-
underline: init(4, 24),
|
|
1181
|
-
inverse: init(7, 27),
|
|
1182
|
-
hidden: init(8, 28),
|
|
1183
|
-
strikethrough: init(9, 29),
|
|
1184
|
-
black: init(30, 39),
|
|
1185
|
-
red: init(31, 39),
|
|
1186
|
-
green: init(32, 39),
|
|
1187
|
-
yellow: init(33, 39),
|
|
1188
|
-
blue: init(34, 39),
|
|
1189
|
-
magenta: init(35, 39),
|
|
1190
|
-
cyan: init(36, 39),
|
|
1191
|
-
white: init(37, 39),
|
|
1192
|
-
gray: init(90, 39),
|
|
1193
|
-
bgBlack: init(40, 49),
|
|
1194
|
-
bgRed: init(41, 49),
|
|
1195
|
-
bgGreen: init(42, 49),
|
|
1196
|
-
bgYellow: init(43, 49),
|
|
1197
|
-
bgBlue: init(44, 49),
|
|
1198
|
-
bgMagenta: init(45, 49),
|
|
1199
|
-
bgCyan: init(46, 49),
|
|
1200
|
-
bgWhite: init(47, 49),
|
|
1201
|
-
blackBright: init(90, 39),
|
|
1202
|
-
redBright: init(91, 39),
|
|
1203
|
-
greenBright: init(92, 39),
|
|
1204
|
-
yellowBright: init(93, 39),
|
|
1205
|
-
blueBright: init(94, 39),
|
|
1206
|
-
magentaBright: init(95, 39),
|
|
1207
|
-
cyanBright: init(96, 39),
|
|
1208
|
-
whiteBright: init(97, 39),
|
|
1209
|
-
bgBlackBright: init(100, 49),
|
|
1210
|
-
bgRedBright: init(101, 49),
|
|
1211
|
-
bgGreenBright: init(102, 49),
|
|
1212
|
-
bgYellowBright: init(103, 49),
|
|
1213
|
-
bgBlueBright: init(104, 49),
|
|
1214
|
-
bgMagentaBright: init(105, 49),
|
|
1215
|
-
bgCyanBright: init(106, 49),
|
|
1216
|
-
bgWhiteBright: init(107, 49)
|
|
1217
|
-
};
|
|
1218
|
-
function createColors(useColor = isColorSupported) {
|
|
1219
|
-
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
1220
|
-
}
|
|
1221
|
-
var colors = createColors();
|
|
1222
|
-
function getColor(color, fallback = "reset") {
|
|
1223
|
-
return colors[color] || colors[fallback];
|
|
1224
|
-
}
|
|
1225
|
-
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("|");
|
|
1226
|
-
function stripAnsi(text) {
|
|
1227
|
-
return text.replace(new RegExp(ansiRegex, "g"), "");
|
|
1228
|
-
}
|
|
1229
|
-
var boxStylePresets = {
|
|
1230
|
-
solid: {
|
|
1231
|
-
tl: "\u250C",
|
|
1232
|
-
tr: "\u2510",
|
|
1233
|
-
bl: "\u2514",
|
|
1234
|
-
br: "\u2518",
|
|
1235
|
-
h: "\u2500",
|
|
1236
|
-
v: "\u2502"
|
|
1237
|
-
},
|
|
1238
|
-
double: {
|
|
1239
|
-
tl: "\u2554",
|
|
1240
|
-
tr: "\u2557",
|
|
1241
|
-
bl: "\u255A",
|
|
1242
|
-
br: "\u255D",
|
|
1243
|
-
h: "\u2550",
|
|
1244
|
-
v: "\u2551"
|
|
1245
|
-
},
|
|
1246
|
-
doubleSingle: {
|
|
1247
|
-
tl: "\u2553",
|
|
1248
|
-
tr: "\u2556",
|
|
1249
|
-
bl: "\u2559",
|
|
1250
|
-
br: "\u255C",
|
|
1251
|
-
h: "\u2500",
|
|
1252
|
-
v: "\u2551"
|
|
1253
|
-
},
|
|
1254
|
-
doubleSingleRounded: {
|
|
1255
|
-
tl: "\u256D",
|
|
1256
|
-
tr: "\u256E",
|
|
1257
|
-
bl: "\u2570",
|
|
1258
|
-
br: "\u256F",
|
|
1259
|
-
h: "\u2500",
|
|
1260
|
-
v: "\u2551"
|
|
1261
|
-
},
|
|
1262
|
-
singleThick: {
|
|
1263
|
-
tl: "\u250F",
|
|
1264
|
-
tr: "\u2513",
|
|
1265
|
-
bl: "\u2517",
|
|
1266
|
-
br: "\u251B",
|
|
1267
|
-
h: "\u2501",
|
|
1268
|
-
v: "\u2503"
|
|
1269
|
-
},
|
|
1270
|
-
singleDouble: {
|
|
1271
|
-
tl: "\u2552",
|
|
1272
|
-
tr: "\u2555",
|
|
1273
|
-
bl: "\u2558",
|
|
1274
|
-
br: "\u255B",
|
|
1275
|
-
h: "\u2550",
|
|
1276
|
-
v: "\u2502"
|
|
1277
|
-
},
|
|
1278
|
-
singleDoubleRounded: {
|
|
1279
|
-
tl: "\u256D",
|
|
1280
|
-
tr: "\u256E",
|
|
1281
|
-
bl: "\u2570",
|
|
1282
|
-
br: "\u256F",
|
|
1283
|
-
h: "\u2550",
|
|
1284
|
-
v: "\u2502"
|
|
1285
|
-
},
|
|
1286
|
-
rounded: {
|
|
1287
|
-
tl: "\u256D",
|
|
1288
|
-
tr: "\u256E",
|
|
1289
|
-
bl: "\u2570",
|
|
1290
|
-
br: "\u256F",
|
|
1291
|
-
h: "\u2500",
|
|
1292
|
-
v: "\u2502"
|
|
1293
|
-
}
|
|
1294
|
-
};
|
|
1295
|
-
var defaultStyle = {
|
|
1296
|
-
borderColor: "white",
|
|
1297
|
-
borderStyle: "rounded",
|
|
1298
|
-
valign: "center",
|
|
1299
|
-
padding: 2,
|
|
1300
|
-
marginLeft: 1,
|
|
1301
|
-
marginTop: 1,
|
|
1302
|
-
marginBottom: 1
|
|
1303
|
-
};
|
|
1304
|
-
function box(text, _opts = {}) {
|
|
1305
|
-
const opts = {
|
|
1306
|
-
..._opts,
|
|
1307
|
-
style: {
|
|
1308
|
-
...defaultStyle,
|
|
1309
|
-
..._opts.style
|
|
1310
|
-
}
|
|
1311
|
-
};
|
|
1312
|
-
const textLines = text.split("\n");
|
|
1313
|
-
const boxLines = [];
|
|
1314
|
-
const _color = getColor(opts.style.borderColor);
|
|
1315
|
-
const borderStyle = {
|
|
1316
|
-
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
1317
|
-
};
|
|
1318
|
-
if (_color) {
|
|
1319
|
-
for (const key in borderStyle) {
|
|
1320
|
-
borderStyle[key] = _color(borderStyle[key]);
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
1324
|
-
const height = textLines.length + paddingOffset;
|
|
1325
|
-
const width = Math.max(...textLines.map((line) => stripAnsi(line).length)) + paddingOffset;
|
|
1326
|
-
const widthOffset = width + paddingOffset;
|
|
1327
|
-
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
1328
|
-
if (opts.style.marginTop > 0) {
|
|
1329
|
-
boxLines.push("".repeat(opts.style.marginTop));
|
|
1330
|
-
}
|
|
1331
|
-
if (opts.title) {
|
|
1332
|
-
const title = _color ? _color(opts.title) : opts.title;
|
|
1333
|
-
const left = borderStyle.h.repeat(Math.floor((width - stripAnsi(opts.title).length) / 2));
|
|
1334
|
-
const right = borderStyle.h.repeat(width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset);
|
|
1335
|
-
boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
|
|
1336
|
-
} else {
|
|
1337
|
-
boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
|
|
1338
|
-
}
|
|
1339
|
-
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
1340
|
-
for (let i2 = 0; i2 < height; i2++) {
|
|
1341
|
-
if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
|
|
1342
|
-
boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
|
|
1343
|
-
} else {
|
|
1344
|
-
const line = textLines[i2 - valignOffset];
|
|
1345
|
-
const left = " ".repeat(paddingOffset);
|
|
1346
|
-
const right = " ".repeat(width - stripAnsi(line).length);
|
|
1347
|
-
boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
|
|
1351
|
-
if (opts.style.marginBottom > 0) {
|
|
1352
|
-
boxLines.push("".repeat(opts.style.marginBottom));
|
|
1353
|
-
}
|
|
1354
|
-
return boxLines.join("\n");
|
|
1355
|
-
}
|
|
1356
|
-
var r = /* @__PURE__ */ Object.create(null);
|
|
1357
|
-
var i = (e) => globalThis.process?.env || undefined || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
|
|
1358
|
-
var s$1 = new Proxy(r, {
|
|
1359
|
-
get(e, o) {
|
|
1360
|
-
return i()[o] ?? r[o];
|
|
1361
|
-
},
|
|
1362
|
-
has(e, o) {
|
|
1363
|
-
const E = i();
|
|
1364
|
-
return o in E || o in r;
|
|
1365
|
-
},
|
|
1366
|
-
set(e, o, E) {
|
|
1367
|
-
const b = i(true);
|
|
1368
|
-
return b[o] = E, true;
|
|
1369
|
-
},
|
|
1370
|
-
deleteProperty(e, o) {
|
|
1371
|
-
if (!o) return false;
|
|
1372
|
-
const E = i(true);
|
|
1373
|
-
return delete E[o], true;
|
|
1374
|
-
},
|
|
1375
|
-
ownKeys() {
|
|
1376
|
-
const e = i(true);
|
|
1377
|
-
return Object.keys(e);
|
|
1378
|
-
}
|
|
1379
|
-
});
|
|
1380
|
-
var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
|
|
1381
|
-
var B = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", {
|
|
1382
|
-
ci: true
|
|
1383
|
-
}], ["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", {
|
|
1384
|
-
ci: true
|
|
1385
|
-
}], ["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", {
|
|
1386
|
-
ci: false
|
|
1387
|
-
}], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", {
|
|
1388
|
-
ci: false
|
|
1389
|
-
}], ["VERCEL", "VERCEL_ENV", {
|
|
1390
|
-
ci: false
|
|
1391
|
-
}], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", {
|
|
1392
|
-
ci: false
|
|
1393
|
-
}], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", {
|
|
1394
|
-
ci: true
|
|
1395
|
-
}], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", {
|
|
1396
|
-
ci: true
|
|
1397
|
-
}]];
|
|
1398
|
-
function p() {
|
|
1399
|
-
if (globalThis.process?.env) for (const e of B) {
|
|
1400
|
-
const o = e[1] || e[0];
|
|
1401
|
-
if (globalThis.process?.env[o]) return {
|
|
1402
|
-
name: e[0].toLowerCase(),
|
|
1403
|
-
...e[2]
|
|
1404
|
-
};
|
|
1405
|
-
}
|
|
1406
|
-
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
|
|
1407
|
-
name: "stackblitz",
|
|
1408
|
-
ci: false
|
|
1409
|
-
} : {
|
|
1410
|
-
name: "",
|
|
1411
|
-
ci: false
|
|
1412
|
-
};
|
|
1413
|
-
}
|
|
1414
|
-
var l = p();
|
|
1415
|
-
l.name;
|
|
1416
|
-
function n(e) {
|
|
1417
|
-
return e ? e !== "false" : false;
|
|
1418
|
-
}
|
|
1419
|
-
var I = globalThis.process?.platform || "";
|
|
1420
|
-
var T = n(s$1.CI) || l.ci !== false;
|
|
1421
|
-
var R = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
|
|
1422
|
-
var U = n(s$1.DEBUG);
|
|
1423
|
-
var A = t === "test" || n(s$1.TEST);
|
|
1424
|
-
n(s$1.MINIMAL) || T || A || !R;
|
|
1425
|
-
var _ = /^win/i.test(I);
|
|
1426
|
-
!n(s$1.NO_COLOR) && (n(s$1.FORCE_COLOR) || (R || _) && s$1.TERM !== "dumb" || T);
|
|
1427
|
-
var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
1428
|
-
Number(C?.split(".")[0]) || null;
|
|
1429
|
-
var y = globalThis.process || /* @__PURE__ */ Object.create(null);
|
|
1430
|
-
var c = {
|
|
1431
|
-
versions: {}
|
|
1432
|
-
};
|
|
1433
|
-
new Proxy(y, {
|
|
1434
|
-
get(e, o) {
|
|
1435
|
-
if (o === "env") return s$1;
|
|
1436
|
-
if (o in e) return e[o];
|
|
1437
|
-
if (o in c) return c[o];
|
|
1438
|
-
}
|
|
1439
|
-
});
|
|
1440
|
-
var L = globalThis.process?.release?.name === "node";
|
|
1441
|
-
var a = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
|
|
1442
|
-
var D = !!globalThis.Deno;
|
|
1443
|
-
var O = !!globalThis.fastly;
|
|
1444
|
-
var S = !!globalThis.Netlify;
|
|
1445
|
-
var N = !!globalThis.EdgeRuntime;
|
|
1446
|
-
var P = globalThis.navigator?.userAgent === "Cloudflare-Workers";
|
|
1447
|
-
var F = [[S, "netlify"], [N, "edge-light"], [P, "workerd"], [O, "fastly"], [D, "deno"], [a, "bun"], [L, "node"]];
|
|
1448
|
-
function G() {
|
|
1449
|
-
const e = F.find((o) => o[0]);
|
|
1450
|
-
if (e) return {
|
|
1451
|
-
name: e[1]
|
|
1452
|
-
};
|
|
1453
|
-
}
|
|
1454
|
-
var u = G();
|
|
1455
|
-
u?.name || "";
|
|
1456
|
-
function ansiRegex2({
|
|
1457
|
-
onlyFirst = false
|
|
1458
|
-
} = {}) {
|
|
1459
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
1460
|
-
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("|");
|
|
1461
|
-
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
1462
|
-
}
|
|
1463
|
-
var regex = ansiRegex2();
|
|
1464
|
-
function stripAnsi2(string) {
|
|
1465
|
-
if (typeof string !== "string") {
|
|
1466
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
1467
|
-
}
|
|
1468
|
-
return string.replace(regex, "");
|
|
1469
|
-
}
|
|
1470
|
-
function isAmbiguous(x) {
|
|
1471
|
-
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;
|
|
1472
|
-
}
|
|
1473
|
-
function isFullWidth(x) {
|
|
1474
|
-
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
1475
|
-
}
|
|
1476
|
-
function isWide(x) {
|
|
1477
|
-
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;
|
|
1478
|
-
}
|
|
1479
|
-
function validate(codePoint) {
|
|
1480
|
-
if (!Number.isSafeInteger(codePoint)) {
|
|
1481
|
-
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
function eastAsianWidth(codePoint, {
|
|
1485
|
-
ambiguousAsWide = false
|
|
1486
|
-
} = {}) {
|
|
1487
|
-
validate(codePoint);
|
|
1488
|
-
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
1489
|
-
return 2;
|
|
1490
|
-
}
|
|
1491
|
-
return 1;
|
|
1492
|
-
}
|
|
1493
|
-
var emojiRegex = () => {
|
|
1494
|
-
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;
|
|
1495
|
-
};
|
|
1496
|
-
var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : {
|
|
1497
|
-
segment: (str) => str.split("")
|
|
1498
|
-
};
|
|
1499
|
-
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1500
|
-
function stringWidth$1(string, options = {}) {
|
|
1501
|
-
if (typeof string !== "string" || string.length === 0) {
|
|
1502
|
-
return 0;
|
|
1503
|
-
}
|
|
1504
|
-
const {
|
|
1505
|
-
ambiguousIsNarrow = true,
|
|
1506
|
-
countAnsiEscapeCodes = false
|
|
1507
|
-
} = options;
|
|
1508
|
-
if (!countAnsiEscapeCodes) {
|
|
1509
|
-
string = stripAnsi2(string);
|
|
1510
|
-
}
|
|
1511
|
-
if (string.length === 0) {
|
|
1512
|
-
return 0;
|
|
1513
|
-
}
|
|
1514
|
-
let width = 0;
|
|
1515
|
-
const eastAsianWidthOptions = {
|
|
1516
|
-
ambiguousAsWide: !ambiguousIsNarrow
|
|
1517
|
-
};
|
|
1518
|
-
for (const {
|
|
1519
|
-
segment: character
|
|
1520
|
-
} of segmenter.segment(string)) {
|
|
1521
|
-
const codePoint = character.codePointAt(0);
|
|
1522
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
1523
|
-
continue;
|
|
1524
|
-
}
|
|
1525
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
1526
|
-
continue;
|
|
1527
|
-
}
|
|
1528
|
-
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
1529
|
-
continue;
|
|
1530
|
-
}
|
|
1531
|
-
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
1532
|
-
continue;
|
|
1533
|
-
}
|
|
1534
|
-
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
1535
|
-
continue;
|
|
1536
|
-
}
|
|
1537
|
-
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1538
|
-
continue;
|
|
1539
|
-
}
|
|
1540
|
-
if (emojiRegex().test(character)) {
|
|
1541
|
-
width += 2;
|
|
1542
|
-
continue;
|
|
1543
|
-
}
|
|
1544
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1545
|
-
}
|
|
1546
|
-
return width;
|
|
1547
|
-
}
|
|
1548
|
-
function isUnicodeSupported() {
|
|
1549
|
-
const {
|
|
1550
|
-
env: env2
|
|
1551
|
-
} = p$1__default.default;
|
|
1552
|
-
const {
|
|
1553
|
-
TERM,
|
|
1554
|
-
TERM_PROGRAM
|
|
1555
|
-
} = env2;
|
|
1556
|
-
if (p$1__default.default.platform !== "win32") {
|
|
1557
|
-
return TERM !== "linux";
|
|
1558
|
-
}
|
|
1559
|
-
return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1560
|
-
}
|
|
1561
|
-
var TYPE_COLOR_MAP = {
|
|
1562
|
-
info: "cyan",
|
|
1563
|
-
fail: "red",
|
|
1564
|
-
success: "green",
|
|
1565
|
-
ready: "green",
|
|
1566
|
-
start: "magenta"
|
|
1567
|
-
};
|
|
1568
|
-
var LEVEL_COLOR_MAP = {
|
|
1569
|
-
0: "red",
|
|
1570
|
-
1: "yellow"
|
|
1571
|
-
};
|
|
1572
|
-
var unicode = isUnicodeSupported();
|
|
1573
|
-
var s = (c2, fallback) => unicode ? c2 : fallback;
|
|
1574
|
-
var TYPE_ICONS = {
|
|
1575
|
-
error: s("\u2716", "\xD7"),
|
|
1576
|
-
fatal: s("\u2716", "\xD7"),
|
|
1577
|
-
ready: s("\u2714", "\u221A"),
|
|
1578
|
-
warn: s("\u26A0", "\u203C"),
|
|
1579
|
-
info: s("\u2139", "i"),
|
|
1580
|
-
success: s("\u2714", "\u221A"),
|
|
1581
|
-
debug: s("\u2699", "D"),
|
|
1582
|
-
trace: s("\u2192", "\u2192"),
|
|
1583
|
-
fail: s("\u2716", "\xD7"),
|
|
1584
|
-
start: s("\u25D0", "o"),
|
|
1585
|
-
log: ""
|
|
1586
|
-
};
|
|
1587
|
-
function stringWidth(str) {
|
|
1588
|
-
const hasICU = typeof Intl === "object";
|
|
1589
|
-
if (!hasICU || !Intl.Segmenter) {
|
|
1590
|
-
return stripAnsi(str).length;
|
|
1591
|
-
}
|
|
1592
|
-
return stringWidth$1(str);
|
|
1593
|
-
}
|
|
1594
|
-
var FancyReporter = class extends BasicReporter {
|
|
1595
|
-
formatStack(stack, opts) {
|
|
1596
|
-
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
1597
|
-
return `
|
|
1598
|
-
${indent}` + parseStack(stack).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)).join(`
|
|
1599
|
-
${indent}`);
|
|
1600
|
-
}
|
|
1601
|
-
formatType(logObj, isBadge, opts) {
|
|
1602
|
-
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
1603
|
-
if (isBadge) {
|
|
1604
|
-
return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
|
|
1605
|
-
}
|
|
1606
|
-
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
1607
|
-
return _type ? getColor2(typeColor)(_type) : "";
|
|
1608
|
-
}
|
|
1609
|
-
formatLogObj(logObj, opts) {
|
|
1610
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
|
|
1611
|
-
if (logObj.type === "box") {
|
|
1612
|
-
return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
|
|
1613
|
-
title: logObj.title ? characterFormat(logObj.title) : undefined,
|
|
1614
|
-
style: logObj.style
|
|
1615
|
-
});
|
|
1616
|
-
}
|
|
1617
|
-
const date = this.formatDate(logObj.date, opts);
|
|
1618
|
-
const coloredDate = date && colors.gray(date);
|
|
1619
|
-
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
1620
|
-
const type = this.formatType(logObj, isBadge, opts);
|
|
1621
|
-
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
1622
|
-
let line;
|
|
1623
|
-
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
1624
|
-
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1625
|
-
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
1626
|
-
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
1627
|
-
line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
|
|
1628
|
-
if (logObj.type === "trace") {
|
|
1629
|
-
const _err = new Error("Trace: " + logObj.message);
|
|
1630
|
-
line += this.formatStack(_err.stack || "");
|
|
1631
|
-
}
|
|
1632
|
-
return isBadge ? "\n" + line + "\n" : line;
|
|
1633
|
-
}
|
|
1634
|
-
};
|
|
1635
|
-
function characterFormat(str) {
|
|
1636
|
-
return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
|
|
1637
|
-
}
|
|
1638
|
-
function getColor2(color = "white") {
|
|
1639
|
-
return colors[color] || colors.white;
|
|
1640
|
-
}
|
|
1641
|
-
function getBgColor(color = "bgWhite") {
|
|
1642
|
-
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
1643
|
-
}
|
|
1644
|
-
function createConsola2(options = {}) {
|
|
1645
|
-
let level = _getDefaultLogLevel();
|
|
1646
|
-
if (process.env.CONSOLA_LEVEL) {
|
|
1647
|
-
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1648
|
-
}
|
|
1649
|
-
const consola2 = createConsola({
|
|
1650
|
-
level,
|
|
1651
|
-
defaults: {
|
|
1652
|
-
level
|
|
1653
|
-
},
|
|
1654
|
-
stdout: process.stdout,
|
|
1655
|
-
stderr: process.stderr,
|
|
1656
|
-
prompt: (...args) => import('./prompt-IKRSF7JL.cjs').then((m) => m.prompt(...args)),
|
|
1657
|
-
reporters: options.reporters || [options.fancy ?? !(T || A) ? new FancyReporter() : new BasicReporter()],
|
|
1658
|
-
...options
|
|
1659
|
-
});
|
|
1660
|
-
return consola2;
|
|
1661
|
-
}
|
|
1662
|
-
function _getDefaultLogLevel() {
|
|
1663
|
-
if (U) {
|
|
1664
|
-
return LogLevels.debug;
|
|
1665
|
-
}
|
|
1666
|
-
if (A) {
|
|
1667
|
-
return LogLevels.warn;
|
|
1668
|
-
}
|
|
1669
|
-
return LogLevels.info;
|
|
1670
|
-
}
|
|
1671
|
-
var consola = createConsola2();
|
|
1672
|
-
|
|
1673
604
|
// src/shared/propertyJsdoc.ts
|
|
1674
605
|
function propertyJsdoc(property, {
|
|
1675
606
|
isInherited,
|
|
@@ -1709,8 +640,8 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
1709
640
|
if (object instanceof ForeignType) {
|
|
1710
641
|
throw new Error("Should not be generating types for an external type");
|
|
1711
642
|
}
|
|
1712
|
-
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((
|
|
1713
|
-
const definition = deleteUndefineds(generatorConverters.wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true,
|
|
643
|
+
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
644
|
+
const definition = deleteUndefineds(generatorConverters.wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true, consola__default.default));
|
|
1714
645
|
const objectDefIdentifier = object.getDefinitionIdentifier(true);
|
|
1715
646
|
const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
|
|
1716
647
|
const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
|
|
@@ -1830,7 +761,7 @@ function createProps(type, identifier, strict) {
|
|
|
1830
761
|
const definition = type.getCleanedUpDefinition(true);
|
|
1831
762
|
return `export interface ${identifier} {
|
|
1832
763
|
${stringify(definition.properties, {
|
|
1833
|
-
"*": (propertyDefinition,
|
|
764
|
+
"*": (propertyDefinition, _, apiName) => {
|
|
1834
765
|
return [`readonly "${maybeStripNamespace(type, apiName)}"${// after we convert everything over we can do this:
|
|
1835
766
|
// !strict || propertyDefinition.nullable ? "?" : ""
|
|
1836
767
|
""}`, (typeof propertyDefinition.type === "object" ? remapStructType(propertyDefinition.type) : `$PropType[${JSON.stringify(propertyDefinition.type)}]`) + `${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict && !(definition.type === "object" && definition.primaryKeyApiName === apiName) ? `| undefined` : ""}`];
|
|
@@ -1864,7 +795,7 @@ function createDefinition(object, ontology, identifier, {
|
|
|
1864
795
|
}`,
|
|
1865
796
|
properties: (_value) => `{
|
|
1866
797
|
${stringify(definition.properties, {
|
|
1867
|
-
"*": (propertyDefinition,
|
|
798
|
+
"*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
|
|
1868
799
|
apiName
|
|
1869
800
|
})}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<${JSON.stringify(propertyDefinition.type)}, "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
|
|
1870
801
|
})}
|
|
@@ -1880,7 +811,7 @@ function createLinks(ontology, object, identifier) {
|
|
|
1880
811
|
${Object.keys(definition.links).length === 0 ? `export type ${identifier} = {};` : `
|
|
1881
812
|
export interface ${identifier} {
|
|
1882
813
|
${stringify(definition.links, {
|
|
1883
|
-
"*": (definition2,
|
|
814
|
+
"*": (definition2, _, key) => {
|
|
1884
815
|
const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true);
|
|
1885
816
|
return [`readonly ${key}`, `${definition2.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}>`}
|
|
1886
817
|
`];
|
|
@@ -1891,7 +822,7 @@ ${stringify(definition.links, {
|
|
|
1891
822
|
}
|
|
1892
823
|
function createPropertyKeys(type) {
|
|
1893
824
|
const properties = Object.keys(type.getCleanedUpDefinition(true).properties);
|
|
1894
|
-
return `export type PropertyKeys = ${properties.length === 0 ? "never" : properties.map((
|
|
825
|
+
return `export type PropertyKeys = ${properties.length === 0 ? "never" : properties.map((a) => maybeStripNamespace(type, a)).map((a) => `"${a}"`).join("|")};`;
|
|
1895
826
|
}
|
|
1896
827
|
function remapStructType(structType) {
|
|
1897
828
|
let output = `{`;
|
|
@@ -1904,10 +835,10 @@ function remapStructType(structType) {
|
|
|
1904
835
|
function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false, forInternalUse = false) {
|
|
1905
836
|
const definition = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));
|
|
1906
837
|
const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
|
|
1907
|
-
const parents = definition.implements?.map((
|
|
1908
|
-
const parent = ontology.requireInterfaceType(
|
|
838
|
+
const parents = definition.implements?.map((p) => {
|
|
839
|
+
const parent = ontology.requireInterfaceType(p, true);
|
|
1909
840
|
if (parent instanceof EnhancedInterfaceType) {
|
|
1910
|
-
const it = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2,
|
|
841
|
+
const it = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2, consola__default.default));
|
|
1911
842
|
return it;
|
|
1912
843
|
}
|
|
1913
844
|
}) ?? [];
|
|
@@ -2020,7 +951,7 @@ async function generatePerInterfaceDataFiles({
|
|
|
2020
951
|
`));
|
|
2021
952
|
}
|
|
2022
953
|
await fs2.writeFile(interfacesDir + ".ts", await formatTs(`
|
|
2023
|
-
${Object.values(ontology.interfaceTypes).filter((
|
|
954
|
+
${Object.values(ontology.interfaceTypes).filter((i) => i instanceof EnhancedInterfaceType).map((interfaceType) => `export {${interfaceType.shortApiName}} from "./interfaces/${interfaceType.shortApiName}${importExt}";`).join("\n")}
|
|
2024
955
|
${Object.keys(ontology.interfaceTypes).length === 0 ? "export {}" : ""}
|
|
2025
956
|
`));
|
|
2026
957
|
}
|
|
@@ -2264,9 +1195,9 @@ function getQueryParamType(enhancedOntology, input, type, isMapKey = false) {
|
|
|
2264
1195
|
case "struct":
|
|
2265
1196
|
inner = `{
|
|
2266
1197
|
${stringify(input.struct, {
|
|
2267
|
-
"*": (
|
|
1198
|
+
"*": (p, formatter, apiName) => {
|
|
2268
1199
|
return [`
|
|
2269
|
-
${type === "Param" ? "readonly " : ""}"${apiName}"${
|
|
1200
|
+
${type === "Param" ? "readonly " : ""}"${apiName}"${p.nullable ? "?" : ""}`, getQueryParamType(enhancedOntology, p, type)];
|
|
2270
1201
|
}
|
|
2271
1202
|
})}
|
|
2272
1203
|
}`;
|
|
@@ -2292,7 +1223,7 @@ function getQueryParamType(enhancedOntology, input, type, isMapKey = false) {
|
|
|
2292
1223
|
inner = `${type === "Param" ? "Readonly" : ""}Set<${getQueryParamType(enhancedOntology, input.set, type)}>`;
|
|
2293
1224
|
break;
|
|
2294
1225
|
case "union":
|
|
2295
|
-
inner = input.union.map((
|
|
1226
|
+
inner = input.union.map((u) => getQueryParamType(enhancedOntology, u, type)).join(" | ");
|
|
2296
1227
|
break;
|
|
2297
1228
|
case "map":
|
|
2298
1229
|
inner = `Record<${getQueryParamType(enhancedOntology, input.keyType, type, true)}, ${getQueryParamType(enhancedOntology, input.valueType, type)}>`;
|
|
@@ -2324,7 +1255,7 @@ async function generateRootIndexTsFile({
|
|
|
2324
1255
|
`));
|
|
2325
1256
|
}
|
|
2326
1257
|
function helper(x) {
|
|
2327
|
-
return Object.values(x).filter((x2) => !(x2 instanceof ForeignType)).map((
|
|
1258
|
+
return Object.values(x).filter((x2) => !(x2 instanceof ForeignType)).map((a) => a.shortApiName).join(", ");
|
|
2328
1259
|
}
|
|
2329
1260
|
|
|
2330
1261
|
// src/v2.0/generateClientSdkVersionTwoPointZero.ts
|