@tscircuit/cli 0.1.98 → 0.1.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/dist/main.js +319 -288
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -51,6 +51,7 @@ Commands:
51
51
  export [options] <file> Export tscircuit code to various formats
52
52
  add <component> Add a tscircuit component package to your project
53
53
  upgrade Upgrade CLI to the latest version
54
+ search <query> Search for snippets in the tscircuit registry
54
55
  help [command] display help for command
55
56
  ```
56
57
  <!-- END_HELP_OUTPUT -->
package/dist/main.js CHANGED
@@ -7063,11 +7063,11 @@ var require_typescript = __commonJS((exports2, module2) => {
7063
7063
  function compareTextSpans(a, b) {
7064
7064
  return compareValues(a == null ? undefined : a.start, b == null ? undefined : b.start) || compareValues(a == null ? undefined : a.length, b == null ? undefined : b.length);
7065
7065
  }
7066
- function maxBy(arr, init, mapper) {
7066
+ function maxBy(arr, init2, mapper) {
7067
7067
  for (let i = 0;i < arr.length; i++) {
7068
- init = Math.max(init, mapper(arr[i]));
7068
+ init2 = Math.max(init2, mapper(arr[i]));
7069
7069
  }
7070
- return init;
7070
+ return init2;
7071
7071
  }
7072
7072
  function min(items, compare) {
7073
7073
  return reduceLeft(items, (x, y) => compare(x, y) === -1 ? x : y);
@@ -21343,8 +21343,8 @@ ${lanes.join(`
21343
21343
  return node.initializer;
21344
21344
  }
21345
21345
  function getDeclaredExpandoInitializer(node) {
21346
- const init = getEffectiveInitializer(node);
21347
- return init && getExpandoInitializer(init, isPrototypeAccess(node.name));
21346
+ const init2 = getEffectiveInitializer(node);
21347
+ return init2 && getExpandoInitializer(init2, isPrototypeAccess(node.name));
21348
21348
  }
21349
21349
  function hasExpandoValueProperty(node, isPrototypeAssignment) {
21350
21350
  return forEach(node.properties, (p) => isPropertyAssignment(p) && isIdentifier(p.name) && p.name.escapedText === "value" && p.initializer && getExpandoInitializer(p.initializer, isPrototypeAssignment));
@@ -24319,14 +24319,14 @@ ${lanes.join(`
24319
24319
  reportsDeprecated: message.reportsDeprecated
24320
24320
  };
24321
24321
  }
24322
- function createCompilerDiagnosticFromMessageChain(chain, relatedInformation) {
24322
+ function createCompilerDiagnosticFromMessageChain(chain2, relatedInformation) {
24323
24323
  return {
24324
24324
  file: undefined,
24325
24325
  start: undefined,
24326
24326
  length: undefined,
24327
- code: chain.code,
24328
- category: chain.category,
24329
- messageText: chain.next ? chain : chain.messageText,
24327
+ code: chain2.code,
24328
+ category: chain2.category,
24329
+ messageText: chain2.next ? chain2 : chain2.messageText,
24330
24330
  relatedInformation
24331
24331
  };
24332
24332
  }
@@ -48681,11 +48681,11 @@ ${lanes.join(`
48681
48681
  if (node && isCallExpression(node)) {
48682
48682
  return !!getAssignedExpandoInitializer(node);
48683
48683
  }
48684
- let init = !node ? undefined : isVariableDeclaration(node) ? node.initializer : isBinaryExpression(node) ? node.right : isPropertyAccessExpression(node) && isBinaryExpression(node.parent) ? node.parent.right : undefined;
48685
- init = init && getRightMostAssignedExpression(init);
48686
- if (init) {
48684
+ let init2 = !node ? undefined : isVariableDeclaration(node) ? node.initializer : isBinaryExpression(node) ? node.right : isPropertyAccessExpression(node) && isBinaryExpression(node.parent) ? node.parent.right : undefined;
48685
+ init2 = init2 && getRightMostAssignedExpression(init2);
48686
+ if (init2) {
48687
48687
  const isPrototypeAssignment = isPrototypeAccess(isVariableDeclaration(node) ? node.name : isBinaryExpression(node) ? node.left : node);
48688
- return !!getExpandoInitializer(isBinaryExpression(init) && (init.operatorToken.kind === 57 || init.operatorToken.kind === 61) ? init.right : init, isPrototypeAssignment);
48688
+ return !!getExpandoInitializer(isBinaryExpression(init2) && (init2.operatorToken.kind === 57 || init2.operatorToken.kind === 61) ? init2.right : init2, isPrototypeAssignment);
48689
48689
  }
48690
48690
  return false;
48691
48691
  }
@@ -48905,11 +48905,11 @@ ${lanes.join(`
48905
48905
  } else if (isIdentifier(node)) {
48906
48906
  const symbol = lookupSymbolForName(sourceFile, node.escapedText);
48907
48907
  if (!!symbol && !!symbol.valueDeclaration && isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
48908
- const init = symbol.valueDeclaration.initializer;
48909
- q.enqueue(init);
48910
- if (isAssignmentExpression(init, true)) {
48911
- q.enqueue(init.left);
48912
- q.enqueue(init.right);
48908
+ const init2 = symbol.valueDeclaration.initializer;
48909
+ q.enqueue(init2);
48910
+ if (isAssignmentExpression(init2, true)) {
48911
+ q.enqueue(init2.left);
48912
+ q.enqueue(init2.right);
48913
48913
  }
48914
48914
  }
48915
48915
  }
@@ -52452,9 +52452,9 @@ ${lanes.join(`
52452
52452
  if (!decl || !isInJSFile(decl) || symbol.flags & 524288 || getExpandoInitializer(decl, false)) {
52453
52453
  return;
52454
52454
  }
52455
- const init = isVariableDeclaration(decl) ? getDeclaredExpandoInitializer(decl) : getAssignedExpandoInitializer(decl);
52456
- if (init) {
52457
- const initSymbol = getSymbolOfNode(init);
52455
+ const init2 = isVariableDeclaration(decl) ? getDeclaredExpandoInitializer(decl) : getAssignedExpandoInitializer(decl);
52456
+ if (init2) {
52457
+ const initSymbol = getSymbolOfNode(init2);
52458
52458
  if (initSymbol) {
52459
52459
  return mergeJSSymbols(initSymbol, symbol);
52460
52460
  }
@@ -54926,15 +54926,15 @@ ${lanes.join(`
54926
54926
  return lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol);
54927
54927
  }
54928
54928
  function lookupSymbolChainWorker(symbol, context, meaning, yieldModuleSymbol) {
54929
- let chain;
54929
+ let chain2;
54930
54930
  const isTypeParameter = symbol.flags & 262144;
54931
54931
  if (!isTypeParameter && (context.enclosingDeclaration || context.flags & 64) && !(context.internalFlags & 4)) {
54932
- chain = Debug.checkDefined(getSymbolChain(symbol, meaning, true));
54933
- Debug.assert(chain && chain.length > 0);
54932
+ chain2 = Debug.checkDefined(getSymbolChain(symbol, meaning, true));
54933
+ Debug.assert(chain2 && chain2.length > 0);
54934
54934
  } else {
54935
- chain = [symbol];
54935
+ chain2 = [symbol];
54936
54936
  }
54937
- return chain;
54937
+ return chain2;
54938
54938
  function getSymbolChain(symbol2, meaning2, endOfChain) {
54939
54939
  let accessibleSymbolChain = getAccessibleSymbolChain(symbol2, context.enclosingDeclaration, meaning2, !!(context.flags & 128));
54940
54940
  let parentSpecifiers;
@@ -54992,10 +54992,10 @@ ${lanes.join(`
54992
54992
  }
54993
54993
  return typeParameterNodes;
54994
54994
  }
54995
- function lookupTypeParameterNodes(chain, index, context) {
54995
+ function lookupTypeParameterNodes(chain2, index, context) {
54996
54996
  var _a;
54997
- Debug.assert(chain && 0 <= index && index < chain.length);
54998
- const symbol = chain[index];
54997
+ Debug.assert(chain2 && 0 <= index && index < chain2.length);
54998
+ const symbol = chain2[index];
54999
54999
  const symbolId = getSymbolId(symbol);
55000
55000
  if ((_a = context.typeParameterSymbolList) == null ? undefined : _a.has(symbolId)) {
55001
55001
  return;
@@ -55006,9 +55006,9 @@ ${lanes.join(`
55006
55006
  }
55007
55007
  context.typeParameterSymbolList.add(symbolId);
55008
55008
  let typeParameterNodes;
55009
- if (context.flags & 512 && index < chain.length - 1) {
55009
+ if (context.flags & 512 && index < chain2.length - 1) {
55010
55010
  const parentSymbol = symbol;
55011
- const nextSymbol = chain[index + 1];
55011
+ const nextSymbol = chain2[index + 1];
55012
55012
  if (getCheckFlags(nextSymbol) & 1) {
55013
55013
  const params2 = getTypeParametersOfClassOrInterface(parentSymbol.flags & 2097152 ? resolveAlias(parentSymbol) : parentSymbol);
55014
55014
  typeParameterNodes = mapToTypeNodes(map(params2, (t) => getMappedType(t, nextSymbol.links.mapper)), context);
@@ -55071,31 +55071,31 @@ ${lanes.join(`
55071
55071
  return symbol.parent ? factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
55072
55072
  }
55073
55073
  function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
55074
- const chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384));
55074
+ const chain2 = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384));
55075
55075
  const isTypeOf = meaning === 111551;
55076
- if (some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
55077
- const nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
55078
- const typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context);
55076
+ if (some(chain2[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
55077
+ const nonRootParts = chain2.length > 1 ? createAccessFromSymbolChain(chain2, chain2.length - 1, 1) : undefined;
55078
+ const typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain2, 0, context);
55079
55079
  const contextFile = getSourceFileOfNode(getOriginalNode(context.enclosingDeclaration));
55080
- const targetFile = getSourceFileOfModule(chain[0]);
55080
+ const targetFile = getSourceFileOfModule(chain2[0]);
55081
55081
  let specifier;
55082
55082
  let attributes;
55083
55083
  if (getEmitModuleResolutionKind(compilerOptions) === 3 || getEmitModuleResolutionKind(compilerOptions) === 99) {
55084
55084
  if ((targetFile == null ? undefined : targetFile.impliedNodeFormat) === 99 && targetFile.impliedNodeFormat !== (contextFile == null ? undefined : contextFile.impliedNodeFormat)) {
55085
- specifier = getSpecifierForModuleSymbol(chain[0], context, 99);
55085
+ specifier = getSpecifierForModuleSymbol(chain2[0], context, 99);
55086
55086
  attributes = factory.createImportAttributes(factory.createNodeArray([
55087
55087
  factory.createImportAttribute(factory.createStringLiteral("resolution-mode"), factory.createStringLiteral("import"))
55088
55088
  ]));
55089
55089
  }
55090
55090
  }
55091
55091
  if (!specifier) {
55092
- specifier = getSpecifierForModuleSymbol(chain[0], context);
55092
+ specifier = getSpecifierForModuleSymbol(chain2[0], context);
55093
55093
  }
55094
55094
  if (!(context.flags & 67108864) && getEmitModuleResolutionKind(compilerOptions) !== 1 && specifier.includes("/node_modules/")) {
55095
55095
  const oldSpecifier = specifier;
55096
55096
  if (getEmitModuleResolutionKind(compilerOptions) === 3 || getEmitModuleResolutionKind(compilerOptions) === 99) {
55097
55097
  const swappedMode = (contextFile == null ? undefined : contextFile.impliedNodeFormat) === 99 ? 1 : 99;
55098
- specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
55098
+ specifier = getSpecifierForModuleSymbol(chain2[0], context, swappedMode);
55099
55099
  if (specifier.includes("/node_modules/")) {
55100
55100
  specifier = oldSpecifier;
55101
55101
  } else {
@@ -55125,7 +55125,7 @@ ${lanes.join(`
55125
55125
  return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit, attributes, qualifier, typeParameterNodes, isTypeOf), splitNode.indexType);
55126
55126
  }
55127
55127
  }
55128
- const entityName = createAccessFromSymbolChain(chain, chain.length - 1, 0);
55128
+ const entityName = createAccessFromSymbolChain(chain2, chain2.length - 1, 0);
55129
55129
  if (isIndexedAccessTypeNode(entityName)) {
55130
55130
  return entityName;
55131
55131
  }
@@ -55137,10 +55137,10 @@ ${lanes.join(`
55137
55137
  setIdentifierTypeArguments(lastId, undefined);
55138
55138
  return factory.createTypeReferenceNode(entityName, lastTypeArgs);
55139
55139
  }
55140
- function createAccessFromSymbolChain(chain2, index, stopper) {
55141
- const typeParameterNodes = index === chain2.length - 1 ? overrideTypeArguments : lookupTypeParameterNodes(chain2, index, context);
55142
- const symbol2 = chain2[index];
55143
- const parent2 = chain2[index - 1];
55140
+ function createAccessFromSymbolChain(chain22, index, stopper) {
55141
+ const typeParameterNodes = index === chain22.length - 1 ? overrideTypeArguments : lookupTypeParameterNodes(chain22, index, context);
55142
+ const symbol2 = chain22[index];
55143
+ const parent2 = chain22[index - 1];
55144
55144
  let symbolName2;
55145
55145
  if (index === 0) {
55146
55146
  context.flags |= 16777216;
@@ -55161,7 +55161,7 @@ ${lanes.join(`
55161
55161
  if (symbolName2 === undefined) {
55162
55162
  const name = firstDefined(symbol2.declarations, getNameOfDeclaration);
55163
55163
  if (name && isComputedPropertyName(name) && isEntityName(name.expression)) {
55164
- const LHS = createAccessFromSymbolChain(chain2, index - 1, stopper);
55164
+ const LHS = createAccessFromSymbolChain(chain22, index - 1, stopper);
55165
55165
  if (isEntityName(LHS)) {
55166
55166
  return factory.createIndexedAccessTypeNode(factory.createParenthesizedType(factory.createTypeQueryNode(LHS)), factory.createTypeQueryNode(name.expression));
55167
55167
  }
@@ -55171,7 +55171,7 @@ ${lanes.join(`
55171
55171
  }
55172
55172
  context.approximateLength += symbolName2.length + 1;
55173
55173
  if (!(context.flags & 16) && parent2 && getMembersOfSymbol(parent2) && getMembersOfSymbol(parent2).get(symbol2.escapedName) && getSymbolIfSameReference(getMembersOfSymbol(parent2).get(symbol2.escapedName), symbol2)) {
55174
- const LHS = createAccessFromSymbolChain(chain2, index - 1, stopper);
55174
+ const LHS = createAccessFromSymbolChain(chain22, index - 1, stopper);
55175
55175
  if (isIndexedAccessTypeNode(LHS)) {
55176
55176
  return factory.createIndexedAccessTypeNode(LHS, factory.createLiteralTypeNode(factory.createStringLiteral(symbolName2)));
55177
55177
  } else {
@@ -55183,7 +55183,7 @@ ${lanes.join(`
55183
55183
  setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
55184
55184
  identifier.symbol = symbol2;
55185
55185
  if (index > stopper) {
55186
- const LHS = createAccessFromSymbolChain(chain2, index - 1, stopper);
55186
+ const LHS = createAccessFromSymbolChain(chain22, index - 1, stopper);
55187
55187
  if (!isEntityName(LHS)) {
55188
55188
  return Debug.fail("Impossible construct - an export of an indexed access cannot be reachable");
55189
55189
  }
@@ -55241,14 +55241,14 @@ ${lanes.join(`
55241
55241
  return result;
55242
55242
  }
55243
55243
  function symbolToName(symbol, context, meaning, expectsIdentifier) {
55244
- const chain = lookupSymbolChain(symbol, context, meaning);
55245
- if (expectsIdentifier && chain.length !== 1 && !context.encounteredError && !(context.flags & 65536)) {
55244
+ const chain2 = lookupSymbolChain(symbol, context, meaning);
55245
+ if (expectsIdentifier && chain2.length !== 1 && !context.encounteredError && !(context.flags & 65536)) {
55246
55246
  context.encounteredError = true;
55247
55247
  }
55248
- return createEntityNameFromSymbolChain(chain, chain.length - 1);
55249
- function createEntityNameFromSymbolChain(chain2, index) {
55250
- const typeParameterNodes = lookupTypeParameterNodes(chain2, index, context);
55251
- const symbol2 = chain2[index];
55248
+ return createEntityNameFromSymbolChain(chain2, chain2.length - 1);
55249
+ function createEntityNameFromSymbolChain(chain22, index) {
55250
+ const typeParameterNodes = lookupTypeParameterNodes(chain22, index, context);
55251
+ const symbol2 = chain22[index];
55252
55252
  if (index === 0) {
55253
55253
  context.flags |= 16777216;
55254
55254
  }
@@ -55260,15 +55260,15 @@ ${lanes.join(`
55260
55260
  if (typeParameterNodes)
55261
55261
  setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
55262
55262
  identifier.symbol = symbol2;
55263
- return index > 0 ? factory.createQualifiedName(createEntityNameFromSymbolChain(chain2, index - 1), identifier) : identifier;
55263
+ return index > 0 ? factory.createQualifiedName(createEntityNameFromSymbolChain(chain22, index - 1), identifier) : identifier;
55264
55264
  }
55265
55265
  }
55266
55266
  function symbolToExpression(symbol, context, meaning) {
55267
- const chain = lookupSymbolChain(symbol, context, meaning);
55268
- return createExpressionFromSymbolChain(chain, chain.length - 1);
55269
- function createExpressionFromSymbolChain(chain2, index) {
55270
- const typeParameterNodes = lookupTypeParameterNodes(chain2, index, context);
55271
- const symbol2 = chain2[index];
55267
+ const chain2 = lookupSymbolChain(symbol, context, meaning);
55268
+ return createExpressionFromSymbolChain(chain2, chain2.length - 1);
55269
+ function createExpressionFromSymbolChain(chain22, index) {
55270
+ const typeParameterNodes = lookupTypeParameterNodes(chain22, index, context);
55271
+ const symbol2 = chain22[index];
55272
55272
  if (index === 0) {
55273
55273
  context.flags |= 16777216;
55274
55274
  }
@@ -55285,7 +55285,7 @@ ${lanes.join(`
55285
55285
  if (typeParameterNodes)
55286
55286
  setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
55287
55287
  identifier.symbol = symbol2;
55288
- return index > 0 ? factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), identifier) : identifier;
55288
+ return index > 0 ? factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain22, index - 1), identifier) : identifier;
55289
55289
  } else {
55290
55290
  if (firstChar === 91) {
55291
55291
  symbolName2 = symbolName2.substring(1, symbolName2.length - 1);
@@ -55304,7 +55304,7 @@ ${lanes.join(`
55304
55304
  identifier.symbol = symbol2;
55305
55305
  expression = identifier;
55306
55306
  }
55307
- return factory.createElementAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), expression);
55307
+ return factory.createElementAccessExpression(createExpressionFromSymbolChain(chain22, index - 1), expression);
55308
55308
  }
55309
55309
  }
55310
55310
  }
@@ -55607,9 +55607,9 @@ ${lanes.join(`
55607
55607
  return false;
55608
55608
  const accessibleResult = isSymbolAccessible(sym, decl, meaning, false);
55609
55609
  if (accessibleResult.accessibility === 0) {
55610
- const chain = lookupSymbolChainWorker(sym, context, meaning);
55610
+ const chain2 = lookupSymbolChainWorker(sym, context, meaning);
55611
55611
  if (!(sym.flags & 4)) {
55612
- const root = chain[0];
55612
+ const root = chain2[0];
55613
55613
  const contextFile = getSourceFileOfNode(oldcontext.enclosingDeclaration);
55614
55614
  if (some(root.declarations, (d) => getSourceFileOfNode(d) === contextFile)) {
55615
55615
  includePrivateSymbol(root);
@@ -57233,9 +57233,9 @@ ${lanes.join(`
57233
57233
  }
57234
57234
  return widened;
57235
57235
  }
57236
- function getJSContainerObjectType(decl, symbol, init) {
57236
+ function getJSContainerObjectType(decl, symbol, init2) {
57237
57237
  var _a, _b;
57238
- if (!isInJSFile(decl) || !init || !isObjectLiteralExpression(init) || init.properties.length) {
57238
+ if (!isInJSFile(decl) || !init2 || !isObjectLiteralExpression(init2) || init2.properties.length) {
57239
57239
  return;
57240
57240
  }
57241
57241
  const exports22 = createSymbolTable();
@@ -64818,10 +64818,10 @@ ${lanes.join(`
64818
64818
  }
64819
64819
  } else if (errorInfo) {
64820
64820
  if (containingMessageChain) {
64821
- const chain = containingMessageChain();
64822
- if (chain) {
64823
- concatenateDiagnosticMessageChains(chain, errorInfo);
64824
- errorInfo = chain;
64821
+ const chain2 = containingMessageChain();
64822
+ if (chain2) {
64823
+ concatenateDiagnosticMessageChains(chain2, errorInfo);
64824
+ errorInfo = chain2;
64825
64825
  }
64826
64826
  }
64827
64827
  let relatedInformation;
@@ -66000,7 +66000,7 @@ ${lanes.join(`
66000
66000
  function countMessageChainBreadth(info) {
66001
66001
  if (!info)
66002
66002
  return 0;
66003
- return reduceLeft(info, (value2, chain) => value2 + 1 + countMessageChainBreadth(chain.next), 0);
66003
+ return reduceLeft(info, (value2, chain2) => value2 + 1 + countMessageChainBreadth(chain2.next), 0);
66004
66004
  }
66005
66005
  function relateVariances(sourceTypeArguments, targetTypeArguments, variances, intersectionState2) {
66006
66006
  if (result2 = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors2, intersectionState2)) {
@@ -69662,8 +69662,8 @@ ${lanes.join(`
69662
69662
  return unreachableNeverType;
69663
69663
  }
69664
69664
  if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConstLike2(node))) {
69665
- const init = getDeclaredExpandoInitializer(node);
69666
- if (init && (init.kind === 218 || init.kind === 219)) {
69665
+ const init2 = getDeclaredExpandoInitializer(node);
69666
+ if (init2 && (init2.kind === 218 || init2.kind === 219)) {
69667
69667
  return getTypeAtFlowNode(flow.antecedent);
69668
69668
  }
69669
69669
  }
@@ -74749,17 +74749,17 @@ ${lanes.join(`
74749
74749
  const error3 = isDecorator(node) ? hasRestParameter2 ? Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_at_least_0 : Diagnostics.The_runtime_will_invoke_the_decorator_with_1_arguments_but_the_decorator_expects_0 : hasRestParameter2 ? Diagnostics.Expected_at_least_0_arguments_but_got_1 : isVoidPromiseError ? Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise : Diagnostics.Expected_0_arguments_but_got_1;
74750
74750
  if (min2 < args.length && args.length < max) {
74751
74751
  if (headMessage) {
74752
- let chain = chainDiagnosticMessages(undefined, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, args.length, maxBelow, minAbove);
74753
- chain = chainDiagnosticMessages(chain, headMessage);
74754
- return getDiagnosticForCallNode(node, chain);
74752
+ let chain2 = chainDiagnosticMessages(undefined, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, args.length, maxBelow, minAbove);
74753
+ chain2 = chainDiagnosticMessages(chain2, headMessage);
74754
+ return getDiagnosticForCallNode(node, chain2);
74755
74755
  }
74756
74756
  return getDiagnosticForCallNode(node, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, args.length, maxBelow, minAbove);
74757
74757
  } else if (args.length < min2) {
74758
74758
  let diagnostic;
74759
74759
  if (headMessage) {
74760
- let chain = chainDiagnosticMessages(undefined, error3, parameterRange, args.length);
74761
- chain = chainDiagnosticMessages(chain, headMessage);
74762
- diagnostic = getDiagnosticForCallNode(node, chain);
74760
+ let chain2 = chainDiagnosticMessages(undefined, error3, parameterRange, args.length);
74761
+ chain2 = chainDiagnosticMessages(chain2, headMessage);
74762
+ diagnostic = getDiagnosticForCallNode(node, chain2);
74763
74763
  } else {
74764
74764
  diagnostic = getDiagnosticForCallNode(node, error3, parameterRange, args.length);
74765
74765
  }
@@ -74779,9 +74779,9 @@ ${lanes.join(`
74779
74779
  }
74780
74780
  setTextRangePosEnd(errorSpan, pos, end);
74781
74781
  if (headMessage) {
74782
- let chain = chainDiagnosticMessages(undefined, error3, parameterRange, args.length);
74783
- chain = chainDiagnosticMessages(chain, headMessage);
74784
- return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), errorSpan, chain);
74782
+ let chain2 = chainDiagnosticMessages(undefined, error3, parameterRange, args.length);
74783
+ chain2 = chainDiagnosticMessages(chain2, headMessage);
74784
+ return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), errorSpan, chain2);
74785
74785
  }
74786
74786
  return createDiagnosticForNodeArray(getSourceFileOfNode(node), errorSpan, error3, parameterRange, args.length);
74787
74787
  }
@@ -74793,9 +74793,9 @@ ${lanes.join(`
74793
74793
  const min2 = getMinTypeArgumentCount(sig.typeParameters);
74794
74794
  const max = length(sig.typeParameters);
74795
74795
  if (headMessage) {
74796
- let chain = chainDiagnosticMessages(undefined, Diagnostics.Expected_0_type_arguments_but_got_1, min2 < max ? min2 + "-" + max : min2, argCount);
74797
- chain = chainDiagnosticMessages(chain, headMessage);
74798
- return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), typeArguments, chain);
74796
+ let chain2 = chainDiagnosticMessages(undefined, Diagnostics.Expected_0_type_arguments_but_got_1, min2 < max ? min2 + "-" + max : min2, argCount);
74797
+ chain2 = chainDiagnosticMessages(chain2, headMessage);
74798
+ return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), typeArguments, chain2);
74799
74799
  }
74800
74800
  return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, min2 < max ? min2 + "-" + max : min2, argCount);
74801
74801
  }
@@ -74812,16 +74812,16 @@ ${lanes.join(`
74812
74812
  }
74813
74813
  if (belowArgCount !== -Infinity && aboveArgCount !== Infinity) {
74814
74814
  if (headMessage) {
74815
- let chain = chainDiagnosticMessages(undefined, Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments, argCount, belowArgCount, aboveArgCount);
74816
- chain = chainDiagnosticMessages(chain, headMessage);
74817
- return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), typeArguments, chain);
74815
+ let chain2 = chainDiagnosticMessages(undefined, Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments, argCount, belowArgCount, aboveArgCount);
74816
+ chain2 = chainDiagnosticMessages(chain2, headMessage);
74817
+ return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), typeArguments, chain2);
74818
74818
  }
74819
74819
  return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.No_overload_expects_0_type_arguments_but_overloads_do_exist_that_expect_either_1_or_2_type_arguments, argCount, belowArgCount, aboveArgCount);
74820
74820
  }
74821
74821
  if (headMessage) {
74822
- let chain = chainDiagnosticMessages(undefined, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
74823
- chain = chainDiagnosticMessages(chain, headMessage);
74824
- return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), typeArguments, chain);
74822
+ let chain2 = chainDiagnosticMessages(undefined, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
74823
+ chain2 = chainDiagnosticMessages(chain2, headMessage);
74824
+ return createDiagnosticForNodeArrayFromMessageChain(getSourceFileOfNode(node), typeArguments, chain2);
74825
74825
  }
74826
74826
  return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
74827
74827
  }
@@ -74874,15 +74874,15 @@ ${lanes.join(`
74874
74874
  if (candidatesForArgumentError) {
74875
74875
  if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
74876
74876
  const last2 = candidatesForArgumentError[candidatesForArgumentError.length - 1];
74877
- let chain;
74877
+ let chain2;
74878
74878
  if (candidatesForArgumentError.length > 3) {
74879
- chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error);
74880
- chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call);
74879
+ chain2 = chainDiagnosticMessages(chain2, Diagnostics.The_last_overload_gave_the_following_error);
74880
+ chain2 = chainDiagnosticMessages(chain2, Diagnostics.No_overload_matches_this_call);
74881
74881
  }
74882
74882
  if (headMessage) {
74883
- chain = chainDiagnosticMessages(chain, headMessage);
74883
+ chain2 = chainDiagnosticMessages(chain2, headMessage);
74884
74884
  }
74885
- const diags = getSignatureApplicabilityError(node, args, last2, assignableRelation, 0, true, () => chain, undefined);
74885
+ const diags = getSignatureApplicabilityError(node, args, last2, assignableRelation, 0, true, () => chain2, undefined);
74886
74886
  if (diags) {
74887
74887
  for (const d of diags) {
74888
74888
  if (last2.declaration && candidatesForArgumentError.length > 3) {
@@ -74901,8 +74901,8 @@ ${lanes.join(`
74901
74901
  let minIndex = 0;
74902
74902
  let i = 0;
74903
74903
  for (const c of candidatesForArgumentError) {
74904
- const chain2 = () => chainDiagnosticMessages(undefined, Diagnostics.Overload_0_of_1_2_gave_the_following_error, i + 1, candidates.length, signatureToString(c));
74905
- const diags2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain2, undefined);
74904
+ const chain22 = () => chainDiagnosticMessages(undefined, Diagnostics.Overload_0_of_1_2_gave_the_following_error, i + 1, candidates.length, signatureToString(c));
74905
+ const diags2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain22, undefined);
74906
74906
  if (diags2) {
74907
74907
  if (diags2.length <= min2) {
74908
74908
  min2 = diags2.length;
@@ -74917,17 +74917,17 @@ ${lanes.join(`
74917
74917
  }
74918
74918
  const diags = max > 1 ? allDiagnostics[minIndex] : flatten(allDiagnostics);
74919
74919
  Debug.assert(diags.length > 0, "No errors reported for 3 or fewer overload signatures");
74920
- let chain = chainDiagnosticMessages(map(diags, createDiagnosticMessageChainFromDiagnostic), Diagnostics.No_overload_matches_this_call);
74920
+ let chain2 = chainDiagnosticMessages(map(diags, createDiagnosticMessageChainFromDiagnostic), Diagnostics.No_overload_matches_this_call);
74921
74921
  if (headMessage) {
74922
- chain = chainDiagnosticMessages(chain, headMessage);
74922
+ chain2 = chainDiagnosticMessages(chain2, headMessage);
74923
74923
  }
74924
74924
  const related = [...flatMap(diags, (d) => d.relatedInformation)];
74925
74925
  let diag2;
74926
74926
  if (every(diags, (d) => d.start === diags[0].start && d.length === diags[0].length && d.file === diags[0].file)) {
74927
74927
  const { file, start, length: length2 } = diags[0];
74928
- diag2 = { file, start, length: length2, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related };
74928
+ diag2 = { file, start, length: length2, code: chain2.code, category: chain2.category, messageText: chain2, relatedInformation: related };
74929
74929
  } else {
74930
- diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), getErrorNodeForCallNode(node), chain, related);
74930
+ diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), getErrorNodeForCallNode(node), chain2, related);
74931
74931
  }
74932
74932
  addImplementationSuccessElaboration(candidatesForArgumentError[0], diag2);
74933
74933
  diagnostics.add(diag2);
@@ -75624,8 +75624,8 @@ ${lanes.join(`
75624
75624
  var _a;
75625
75625
  const assignmentSymbol = decl && getSymbolOfExpando(decl, true);
75626
75626
  const prototype = (_a = assignmentSymbol == null ? undefined : assignmentSymbol.exports) == null ? undefined : _a.get("prototype");
75627
- const init = (prototype == null ? undefined : prototype.valueDeclaration) && getAssignedJSPrototype(prototype.valueDeclaration);
75628
- return init ? getSymbolOfDeclaration(init) : undefined;
75627
+ const init2 = (prototype == null ? undefined : prototype.valueDeclaration) && getAssignedJSPrototype(prototype.valueDeclaration);
75628
+ return init2 ? getSymbolOfDeclaration(init2) : undefined;
75629
75629
  }
75630
75630
  function getSymbolOfExpando(node, allowDeclaration) {
75631
75631
  if (!node.parent) {
@@ -77999,8 +77999,8 @@ ${lanes.join(`
77999
77999
  case 3:
78000
78000
  case 4:
78001
78001
  const symbol = getSymbolOfNode(left);
78002
- const init = getAssignedExpandoInitializer(right);
78003
- return !!init && isObjectLiteralExpression(init) && !!((_a = symbol == null ? undefined : symbol.exports) == null ? undefined : _a.size);
78002
+ const init2 = getAssignedExpandoInitializer(right);
78003
+ return !!init2 && isObjectLiteralExpression(init2) && !!((_a = symbol == null ? undefined : symbol.exports) == null ? undefined : _a.size);
78004
78004
  default:
78005
78005
  return false;
78006
78006
  }
@@ -79884,12 +79884,12 @@ ${lanes.join(`
79884
79884
  if (isThenableType(type)) {
79885
79885
  if (errorNode) {
79886
79886
  Debug.assertIsDefined(diagnosticMessage);
79887
- let chain;
79887
+ let chain2;
79888
79888
  if (thisTypeForErrorOut.value) {
79889
- chain = chainDiagnosticMessages(chain, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForErrorOut.value));
79889
+ chain2 = chainDiagnosticMessages(chain2, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForErrorOut.value));
79890
79890
  }
79891
- chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args);
79892
- diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain));
79891
+ chain2 = chainDiagnosticMessages(chain2, diagnosticMessage, ...args);
79892
+ diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain2));
79893
79893
  }
79894
79894
  return;
79895
79895
  }
@@ -95458,15 +95458,15 @@ ${lanes.join(`
95458
95458
  return visitEachChild(node, visitor, context);
95459
95459
  }
95460
95460
  }
95461
- function flattenChain(chain) {
95462
- Debug.assertNotNode(chain, isNonNullChain);
95463
- const links = [chain];
95464
- while (!chain.questionDotToken && !isTaggedTemplateExpression(chain)) {
95465
- chain = cast(skipPartiallyEmittedExpressions(chain.expression), isOptionalChain);
95466
- Debug.assertNotNode(chain, isNonNullChain);
95467
- links.unshift(chain);
95461
+ function flattenChain(chain2) {
95462
+ Debug.assertNotNode(chain2, isNonNullChain);
95463
+ const links = [chain2];
95464
+ while (!chain2.questionDotToken && !isTaggedTemplateExpression(chain2)) {
95465
+ chain2 = cast(skipPartiallyEmittedExpressions(chain2.expression), isOptionalChain);
95466
+ Debug.assertNotNode(chain2, isNonNullChain);
95467
+ links.unshift(chain2);
95468
95468
  }
95469
- return { expression: chain.expression, chain: links };
95469
+ return { expression: chain2.expression, chain: links };
95470
95470
  }
95471
95471
  function visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete) {
95472
95472
  const expression = visitNonOptionalExpression(node.expression, captureThisArg, isDelete);
@@ -95521,8 +95521,8 @@ ${lanes.join(`
95521
95521
  }
95522
95522
  }
95523
95523
  function visitOptionalExpression(node, captureThisArg, isDelete) {
95524
- const { expression, chain } = flattenChain(node);
95525
- const left = visitNonOptionalExpression(skipPartiallyEmittedExpressions(expression), isCallChain(chain[0]), false);
95524
+ const { expression, chain: chain2 } = flattenChain(node);
95525
+ const left = visitNonOptionalExpression(skipPartiallyEmittedExpressions(expression), isCallChain(chain2[0]), false);
95526
95526
  let leftThisArg = isSyntheticReference(left) ? left.thisArg : undefined;
95527
95527
  let capturedLeft = isSyntheticReference(left) ? left.expression : left;
95528
95528
  let leftExpression = factory2.restoreOuterExpressions(expression, capturedLeft, 8);
@@ -95532,12 +95532,12 @@ ${lanes.join(`
95532
95532
  }
95533
95533
  let rightExpression = capturedLeft;
95534
95534
  let thisArg;
95535
- for (let i = 0;i < chain.length; i++) {
95536
- const segment = chain[i];
95535
+ for (let i = 0;i < chain2.length; i++) {
95536
+ const segment = chain2[i];
95537
95537
  switch (segment.kind) {
95538
95538
  case 211:
95539
95539
  case 212:
95540
- if (i === chain.length - 1 && captureThisArg) {
95540
+ if (i === chain2.length - 1 && captureThisArg) {
95541
95541
  if (!isSimpleCopiableExpression(rightExpression)) {
95542
95542
  thisArg = factory2.createTempVariable(hoistVariableDeclaration);
95543
95543
  rightExpression = factory2.createAssignment(thisArg, rightExpression);
@@ -112271,12 +112271,12 @@ ${lanes.join(`
112271
112271
  if (emitFileName) {
112272
112272
  const emitFilePath = toPath3(emitFileName);
112273
112273
  if (filesByName.has(emitFilePath)) {
112274
- let chain;
112274
+ let chain2;
112275
112275
  if (!options.configFilePath) {
112276
- chain = chainDiagnosticMessages(undefined, Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
112276
+ chain2 = chainDiagnosticMessages(undefined, Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
112277
112277
  }
112278
- chain = chainDiagnosticMessages(chain, Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
112279
- blockEmittingOfFile(emitFileName, createCompilerDiagnosticFromMessageChain(chain));
112278
+ chain2 = chainDiagnosticMessages(chain2, Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
112279
+ blockEmittingOfFile(emitFileName, createCompilerDiagnosticFromMessageChain(chain2));
112280
112280
  }
112281
112281
  const emitFileKey = !host.useCaseSensitiveFileNames() ? toFileNameLowerCase(emitFilePath) : emitFilePath;
112282
112282
  if (emitFilesSeen.has(emitFileKey)) {
@@ -112326,8 +112326,8 @@ ${lanes.join(`
112326
112326
  function createDiagnostic(name, value2, useInstead, message, ...args) {
112327
112327
  if (useInstead) {
112328
112328
  const details = chainDiagnosticMessages(undefined, Diagnostics.Use_0_instead, useInstead);
112329
- const chain = chainDiagnosticMessages(details, message, ...args);
112330
- createDiagnosticForOption(!value2, name, undefined, chain);
112329
+ const chain2 = chainDiagnosticMessages(details, message, ...args);
112330
+ createDiagnosticForOption(!value2, name, undefined, chain2);
112331
112331
  } else {
112332
112332
  createDiagnosticForOption(!value2, name, undefined, message, ...args);
112333
112333
  }
@@ -112384,7 +112384,7 @@ ${lanes.join(`
112384
112384
  let fileIncludeReasonDetails;
112385
112385
  let redirectInfo;
112386
112386
  let cachedChain = file && (fileReasonsToChain == null ? undefined : fileReasonsToChain.get(file.path));
112387
- let chain;
112387
+ let chain2;
112388
112388
  if (cachedChain) {
112389
112389
  if (cachedChain.fileIncludeReasonDetails) {
112390
112390
  seenReasons = new Set(reasons);
@@ -112404,7 +112404,7 @@ ${lanes.join(`
112404
112404
  seenReasons = undefined;
112405
112405
  if (seenReasons && cachedChain) {
112406
112406
  if (cachedChain.details && !processedExtraReason) {
112407
- chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
112407
+ chain2 = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
112408
112408
  } else if (cachedChain.fileIncludeReasonDetails) {
112409
112409
  if (!processedExtraReason) {
112410
112410
  if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
@@ -112421,10 +112421,10 @@ ${lanes.join(`
112421
112421
  }
112422
112422
  }
112423
112423
  }
112424
- if (!chain) {
112424
+ if (!chain2) {
112425
112425
  if (!fileIncludeReasonDetails)
112426
112426
  fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
112427
- chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
112427
+ chain2 = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
112428
112428
  }
112429
112429
  if (file) {
112430
112430
  if (cachedChain) {
@@ -112435,10 +112435,10 @@ ${lanes.join(`
112435
112435
  (fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map)).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
112436
112436
  }
112437
112437
  if (!cachedChain.details && !processedExtraReason)
112438
- cachedChain.details = chain.next;
112438
+ cachedChain.details = chain2.next;
112439
112439
  }
112440
112440
  const location = locationReason && getReferencedFileLocation(program3, locationReason);
112441
- return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
112441
+ return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain2, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain2, relatedInfo);
112442
112442
  function processReason(reason) {
112443
112443
  if (seenReasons == null ? undefined : seenReasons.has(reason))
112444
112444
  return;
@@ -113518,31 +113518,31 @@ ${lanes.join(`
113518
113518
  return sameMap(diagnostics, (diag2) => {
113519
113519
  if (isString(diag2.messageText))
113520
113520
  return diag2;
113521
- const repopulatedChain = convertOrRepopulateDiagnosticMessageChain(diag2.messageText, diag2.file, newProgram, (chain) => {
113521
+ const repopulatedChain = convertOrRepopulateDiagnosticMessageChain(diag2.messageText, diag2.file, newProgram, (chain2) => {
113522
113522
  var _a;
113523
- return (_a = chain.repopulateInfo) == null ? undefined : _a.call(chain);
113523
+ return (_a = chain2.repopulateInfo) == null ? undefined : _a.call(chain2);
113524
113524
  });
113525
113525
  return repopulatedChain === diag2.messageText ? diag2 : { ...diag2, messageText: repopulatedChain };
113526
113526
  });
113527
113527
  }
113528
- function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
113529
- const info = repopulateInfo(chain);
113528
+ function convertOrRepopulateDiagnosticMessageChain(chain2, sourceFile, newProgram, repopulateInfo) {
113529
+ const info = repopulateInfo(chain2);
113530
113530
  if (info === true) {
113531
113531
  return {
113532
113532
  ...createModeMismatchDetails(sourceFile),
113533
- next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
113533
+ next: convertOrRepopulateDiagnosticMessageChainArray(chain2.next, sourceFile, newProgram, repopulateInfo)
113534
113534
  };
113535
113535
  } else if (info) {
113536
113536
  return {
113537
113537
  ...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
113538
- next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
113538
+ next: convertOrRepopulateDiagnosticMessageChainArray(chain2.next, sourceFile, newProgram, repopulateInfo)
113539
113539
  };
113540
113540
  }
113541
- const next = convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo);
113542
- return next === chain.next ? chain : { ...chain, next };
113541
+ const next = convertOrRepopulateDiagnosticMessageChainArray(chain2.next, sourceFile, newProgram, repopulateInfo);
113542
+ return next === chain2.next ? chain2 : { ...chain2, next };
113543
113543
  }
113544
113544
  function convertOrRepopulateDiagnosticMessageChainArray(array, sourceFile, newProgram, repopulateInfo) {
113545
- return sameMap(array, (chain) => convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo));
113545
+ return sameMap(array, (chain2) => convertOrRepopulateDiagnosticMessageChain(chain2, sourceFile, newProgram, repopulateInfo));
113546
113546
  }
113547
113547
  function convertToDiagnostics(diagnostics, diagnosticFilePath, newProgram) {
113548
113548
  if (!diagnostics.length)
@@ -113569,7 +113569,7 @@ ${lanes.join(`
113569
113569
  return {
113570
113570
  ...diagnostic,
113571
113571
  file: sourceFile,
113572
- messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertOrRepopulateDiagnosticMessageChain(diagnostic.messageText, sourceFile, newProgram, (chain) => chain.info)
113572
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertOrRepopulateDiagnosticMessageChain(diagnostic.messageText, sourceFile, newProgram, (chain2) => chain2.info)
113573
113573
  };
113574
113574
  }
113575
113575
  function releaseCache(state) {
@@ -114069,22 +114069,22 @@ ${lanes.join(`
114069
114069
  messageText: isString(diagnostic.messageText) ? diagnostic.messageText : toReusableDiagnosticMessageChain(diagnostic.messageText)
114070
114070
  };
114071
114071
  }
114072
- function toReusableDiagnosticMessageChain(chain) {
114073
- if (chain.repopulateInfo) {
114072
+ function toReusableDiagnosticMessageChain(chain2) {
114073
+ if (chain2.repopulateInfo) {
114074
114074
  return {
114075
- info: chain.repopulateInfo(),
114076
- next: toReusableDiagnosticMessageChainArray(chain.next)
114075
+ info: chain2.repopulateInfo(),
114076
+ next: toReusableDiagnosticMessageChainArray(chain2.next)
114077
114077
  };
114078
114078
  }
114079
- const next = toReusableDiagnosticMessageChainArray(chain.next);
114080
- return next === chain.next ? chain : { ...chain, next };
114079
+ const next = toReusableDiagnosticMessageChainArray(chain2.next);
114080
+ return next === chain2.next ? chain2 : { ...chain2, next };
114081
114081
  }
114082
114082
  function toReusableDiagnosticMessageChainArray(array) {
114083
114083
  if (!array)
114084
114084
  return array;
114085
- return forEach(array, (chain, index) => {
114086
- const reusable = toReusableDiagnosticMessageChain(chain);
114087
- if (chain === reusable)
114085
+ return forEach(array, (chain2, index) => {
114086
+ const reusable = toReusableDiagnosticMessageChain(chain2);
114087
+ if (chain2 === reusable)
114088
114088
  return;
114089
114089
  const result = index > 0 ? array.slice(0, index - 1) : [];
114090
114090
  result.push(reusable);
@@ -123642,7 +123642,7 @@ ${lanes.join(`
123642
123642
  return Debug.checkDefined(names);
123643
123643
  }
123644
123644
  function forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, cb) {
123645
- let chain;
123645
+ let chain2;
123646
123646
  let current = defaultExport;
123647
123647
  const seen = /* @__PURE__ */ new Set;
123648
123648
  while (current) {
@@ -123657,12 +123657,12 @@ ${lanes.join(`
123657
123657
  if (final)
123658
123658
  return final;
123659
123659
  }
123660
- chain = append(chain, current);
123660
+ chain2 = append(chain2, current);
123661
123661
  if (!addToSeen(seen, current))
123662
123662
  break;
123663
123663
  current = current.flags & 2097152 ? checker.getImmediateAliasedSymbol(current) : undefined;
123664
123664
  }
123665
- for (const symbol of chain ?? emptyArray) {
123665
+ for (const symbol of chain2 ?? emptyArray) {
123666
123666
  if (symbol.parent && isExternalModuleSymbol(symbol.parent)) {
123667
123667
  const final = cb(moduleSymbolToValidIdentifier(symbol.parent, scriptTarget, false), moduleSymbolToValidIdentifier(symbol.parent, scriptTarget, true));
123668
123668
  if (final)
@@ -126079,9 +126079,9 @@ ${lanes.join(`
126079
126079
  }
126080
126080
  } else {
126081
126081
  if (isVariableStatement(node) && node.parent === sourceFile && node.declarationList.flags & 2 && node.declarationList.declarations.length === 1) {
126082
- const init = node.declarationList.declarations[0].initializer;
126083
- if (init && isRequireCall(init, true)) {
126084
- diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
126082
+ const init2 = node.declarationList.declarations[0].initializer;
126083
+ if (init2 && isRequireCall(init2, true)) {
126084
+ diags.push(createDiagnosticForNode(init2, Diagnostics.require_call_may_be_converted_to_an_import));
126085
126085
  }
126086
126086
  }
126087
126087
  const jsdocTypedefNodes = ts_codefix_exports.getJSDocTypedefNodes(node);
@@ -130095,25 +130095,25 @@ ${newComment.split(`
130095
130095
  }
130096
130096
  return occurrences.length > 0 ? occurrences : undefined;
130097
130097
  }
130098
- function getMatchingStart(chain, subchain) {
130098
+ function getMatchingStart(chain2, subchain) {
130099
130099
  if (!isIdentifier(subchain) && !isPropertyAccessExpression(subchain) && !isElementAccessExpression(subchain)) {
130100
130100
  return;
130101
130101
  }
130102
- return chainStartsWith(chain, subchain) ? subchain : undefined;
130102
+ return chainStartsWith(chain2, subchain) ? subchain : undefined;
130103
130103
  }
130104
- function chainStartsWith(chain, subchain) {
130105
- while (isCallExpression(chain) || isPropertyAccessExpression(chain) || isElementAccessExpression(chain)) {
130106
- if (getTextOfChainNode(chain) === getTextOfChainNode(subchain))
130104
+ function chainStartsWith(chain2, subchain) {
130105
+ while (isCallExpression(chain2) || isPropertyAccessExpression(chain2) || isElementAccessExpression(chain2)) {
130106
+ if (getTextOfChainNode(chain2) === getTextOfChainNode(subchain))
130107
130107
  break;
130108
- chain = chain.expression;
130108
+ chain2 = chain2.expression;
130109
130109
  }
130110
- while (isPropertyAccessExpression(chain) && isPropertyAccessExpression(subchain) || isElementAccessExpression(chain) && isElementAccessExpression(subchain)) {
130111
- if (getTextOfChainNode(chain) !== getTextOfChainNode(subchain))
130110
+ while (isPropertyAccessExpression(chain2) && isPropertyAccessExpression(subchain) || isElementAccessExpression(chain2) && isElementAccessExpression(subchain)) {
130111
+ if (getTextOfChainNode(chain2) !== getTextOfChainNode(subchain))
130112
130112
  return false;
130113
- chain = chain.expression;
130113
+ chain2 = chain2.expression;
130114
130114
  subchain = subchain.expression;
130115
130115
  }
130116
- return isIdentifier(chain) && isIdentifier(subchain) && chain.getText() === subchain.getText();
130116
+ return isIdentifier(chain2) && isIdentifier(subchain) && chain2.getText() === subchain.getText();
130117
130117
  }
130118
130118
  function getTextOfChainNode(node) {
130119
130119
  if (isIdentifier(node) || isStringOrNumericLiteralLike(node)) {
@@ -130167,17 +130167,17 @@ ${newComment.split(`
130167
130167
  }
130168
130168
  function convertOccurrences(checker, toConvert, occurrences) {
130169
130169
  if (isPropertyAccessExpression(toConvert) || isElementAccessExpression(toConvert) || isCallExpression(toConvert)) {
130170
- const chain = convertOccurrences(checker, toConvert.expression, occurrences);
130170
+ const chain2 = convertOccurrences(checker, toConvert.expression, occurrences);
130171
130171
  const lastOccurrence = occurrences.length > 0 ? occurrences[occurrences.length - 1] : undefined;
130172
130172
  const isOccurrence = (lastOccurrence == null ? undefined : lastOccurrence.getText()) === toConvert.expression.getText();
130173
130173
  if (isOccurrence)
130174
130174
  occurrences.pop();
130175
130175
  if (isCallExpression(toConvert)) {
130176
- return isOccurrence ? factory.createCallChain(chain, factory.createToken(29), toConvert.typeArguments, toConvert.arguments) : factory.createCallChain(chain, toConvert.questionDotToken, toConvert.typeArguments, toConvert.arguments);
130176
+ return isOccurrence ? factory.createCallChain(chain2, factory.createToken(29), toConvert.typeArguments, toConvert.arguments) : factory.createCallChain(chain2, toConvert.questionDotToken, toConvert.typeArguments, toConvert.arguments);
130177
130177
  } else if (isPropertyAccessExpression(toConvert)) {
130178
- return isOccurrence ? factory.createPropertyAccessChain(chain, factory.createToken(29), toConvert.name) : factory.createPropertyAccessChain(chain, toConvert.questionDotToken, toConvert.name);
130178
+ return isOccurrence ? factory.createPropertyAccessChain(chain2, factory.createToken(29), toConvert.name) : factory.createPropertyAccessChain(chain2, toConvert.questionDotToken, toConvert.name);
130179
130179
  } else if (isElementAccessExpression(toConvert)) {
130180
- return isOccurrence ? factory.createElementAccessChain(chain, factory.createToken(29), toConvert.argumentExpression) : factory.createElementAccessChain(chain, toConvert.questionDotToken, toConvert.argumentExpression);
130180
+ return isOccurrence ? factory.createElementAccessChain(chain2, factory.createToken(29), toConvert.argumentExpression) : factory.createElementAccessChain(chain2, toConvert.questionDotToken, toConvert.argumentExpression);
130181
130181
  }
130182
130182
  }
130183
130183
  return toConvert;
@@ -136989,8 +136989,8 @@ ${newComment.split(`
136989
136989
  function makeImportSpecifier2(propertyName, name) {
136990
136990
  return factory.createImportSpecifier(false, propertyName !== undefined && propertyName !== name ? factory.createIdentifier(propertyName) : undefined, factory.createIdentifier(name));
136991
136991
  }
136992
- function makeConst(modifiers, name, init) {
136993
- return factory.createVariableStatement(modifiers, factory.createVariableDeclarationList([factory.createVariableDeclaration(name, undefined, undefined, init)], 2));
136992
+ function makeConst(modifiers, name, init2) {
136993
+ return factory.createVariableStatement(modifiers, factory.createVariableDeclarationList([factory.createVariableDeclaration(name, undefined, undefined, init2)], 2));
136994
136994
  }
136995
136995
  function makeExportDeclaration(exportSpecifiers, moduleSpecifier) {
136996
136996
  return factory.createExportDeclaration(undefined, false, exportSpecifiers && factory.createNamedExports(exportSpecifiers), moduleSpecifier === undefined ? undefined : factory.createStringLiteral(moduleSpecifier));
@@ -145853,9 +145853,9 @@ ${newComment.split(`
145853
145853
  }
145854
145854
  }
145855
145855
  function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) {
145856
- const chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, -1, false);
145857
- if (chain)
145858
- return first(chain);
145856
+ const chain2 = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, -1, false);
145857
+ if (chain2)
145858
+ return first(chain2);
145859
145859
  return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker));
145860
145860
  }
145861
145861
  function isModuleSymbol(symbol) {
@@ -152356,9 +152356,9 @@ ${newComment.split(`
152356
152356
  return isFunctionLike(be.right) ? { commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner };
152357
152357
  }
152358
152358
  case 172:
152359
- const init = commentOwner.initializer;
152360
- if (init && (isFunctionExpression(init) || isArrowFunction(init))) {
152361
- return { commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) };
152359
+ const init2 = commentOwner.initializer;
152360
+ if (init2 && (isFunctionExpression(init2) || isArrowFunction(init2))) {
152361
+ return { commentOwner, parameters: init2.parameters, hasReturn: hasReturn(init2, options) };
152362
152362
  }
152363
152363
  }
152364
152364
  }
@@ -218915,7 +218915,7 @@ var require_browser = __commonJS((exports2, module2) => {
218915
218915
  var require_node = __commonJS((exports2, module2) => {
218916
218916
  var tty = __require("tty");
218917
218917
  var util2 = __require("util");
218918
- exports2.init = init;
218918
+ exports2.init = init2;
218919
218919
  exports2.log = log;
218920
218920
  exports2.formatArgs = formatArgs;
218921
218921
  exports2.save = save;
@@ -219062,7 +219062,7 @@ var require_node = __commonJS((exports2, module2) => {
219062
219062
  function load2() {
219063
219063
  return process.env.DEBUG;
219064
219064
  }
219065
- function init(debug) {
219065
+ function init2(debug) {
219066
219066
  debug.inspectOpts = {};
219067
219067
  const keys = Object.keys(exports2.inspectOpts);
219068
219068
  for (let i = 0;i < keys.length; i++) {
@@ -433425,7 +433425,7 @@ import readline from "node:readline";
433425
433425
  import { execSync as execSync2 } from "node:child_process";
433426
433426
  var import_semver = __toESM2(require_semver2(), 1);
433427
433427
  // package.json
433428
- var version = "0.1.97";
433428
+ var version = "0.1.99";
433429
433429
  var package_default = {
433430
433430
  name: "@tscircuit/cli",
433431
433431
  version,
@@ -433493,14 +433493,111 @@ var package_default = {
433493
433493
  type: "module"
433494
433494
  };
433495
433495
 
433496
+ // node_modules/kleur/index.mjs
433497
+ var FORCE_COLOR;
433498
+ var NODE_DISABLE_COLORS;
433499
+ var NO_COLOR;
433500
+ var TERM;
433501
+ var isTTY = true;
433502
+ if (typeof process !== "undefined") {
433503
+ ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
433504
+ isTTY = process.stdout && process.stdout.isTTY;
433505
+ }
433506
+ var $ = {
433507
+ enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY),
433508
+ reset: init(0, 0),
433509
+ bold: init(1, 22),
433510
+ dim: init(2, 22),
433511
+ italic: init(3, 23),
433512
+ underline: init(4, 24),
433513
+ inverse: init(7, 27),
433514
+ hidden: init(8, 28),
433515
+ strikethrough: init(9, 29),
433516
+ black: init(30, 39),
433517
+ red: init(31, 39),
433518
+ green: init(32, 39),
433519
+ yellow: init(33, 39),
433520
+ blue: init(34, 39),
433521
+ magenta: init(35, 39),
433522
+ cyan: init(36, 39),
433523
+ white: init(37, 39),
433524
+ gray: init(90, 39),
433525
+ grey: init(90, 39),
433526
+ bgBlack: init(40, 49),
433527
+ bgRed: init(41, 49),
433528
+ bgGreen: init(42, 49),
433529
+ bgYellow: init(43, 49),
433530
+ bgBlue: init(44, 49),
433531
+ bgMagenta: init(45, 49),
433532
+ bgCyan: init(46, 49),
433533
+ bgWhite: init(47, 49)
433534
+ };
433535
+ function run(arr, str) {
433536
+ let i = 0, tmp, beg = "", end = "";
433537
+ for (;i < arr.length; i++) {
433538
+ tmp = arr[i];
433539
+ beg += tmp.open;
433540
+ end += tmp.close;
433541
+ if (!!~str.indexOf(tmp.close)) {
433542
+ str = str.replace(tmp.rgx, tmp.close + tmp.open);
433543
+ }
433544
+ }
433545
+ return beg + str + end;
433546
+ }
433547
+ function chain(has, keys) {
433548
+ let ctx = { has, keys };
433549
+ ctx.reset = $.reset.bind(ctx);
433550
+ ctx.bold = $.bold.bind(ctx);
433551
+ ctx.dim = $.dim.bind(ctx);
433552
+ ctx.italic = $.italic.bind(ctx);
433553
+ ctx.underline = $.underline.bind(ctx);
433554
+ ctx.inverse = $.inverse.bind(ctx);
433555
+ ctx.hidden = $.hidden.bind(ctx);
433556
+ ctx.strikethrough = $.strikethrough.bind(ctx);
433557
+ ctx.black = $.black.bind(ctx);
433558
+ ctx.red = $.red.bind(ctx);
433559
+ ctx.green = $.green.bind(ctx);
433560
+ ctx.yellow = $.yellow.bind(ctx);
433561
+ ctx.blue = $.blue.bind(ctx);
433562
+ ctx.magenta = $.magenta.bind(ctx);
433563
+ ctx.cyan = $.cyan.bind(ctx);
433564
+ ctx.white = $.white.bind(ctx);
433565
+ ctx.gray = $.gray.bind(ctx);
433566
+ ctx.grey = $.grey.bind(ctx);
433567
+ ctx.bgBlack = $.bgBlack.bind(ctx);
433568
+ ctx.bgRed = $.bgRed.bind(ctx);
433569
+ ctx.bgGreen = $.bgGreen.bind(ctx);
433570
+ ctx.bgYellow = $.bgYellow.bind(ctx);
433571
+ ctx.bgBlue = $.bgBlue.bind(ctx);
433572
+ ctx.bgMagenta = $.bgMagenta.bind(ctx);
433573
+ ctx.bgCyan = $.bgCyan.bind(ctx);
433574
+ ctx.bgWhite = $.bgWhite.bind(ctx);
433575
+ return ctx;
433576
+ }
433577
+ function init(open, close) {
433578
+ let blk = {
433579
+ open: `\x1B[${open}m`,
433580
+ close: `\x1B[${close}m`,
433581
+ rgx: new RegExp(`\\x1b\\[${close}m`, "g")
433582
+ };
433583
+ return function(txt) {
433584
+ if (this !== undefined && this.has !== undefined) {
433585
+ !!~this.has.indexOf(open) || (this.has.push(open), this.keys.push(blk));
433586
+ return txt === undefined ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
433587
+ }
433588
+ return txt === undefined ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
433589
+ };
433590
+ }
433591
+ var kleur_default = $;
433592
+
433496
433593
  // lib/shared/check-for-cli-update.ts
433594
+ var currentCliVersion = () => program2?.version() ?? import_semver.default.inc(version, "patch") ?? version;
433497
433595
  var checkForTsciUpdates = async () => {
433498
433596
  if (process.env.TSCI_SKIP_CLI_UPDATE === "true")
433499
433597
  return;
433500
- const currentCliVersion = program2.version() ?? import_semver.default.inc(version, "patch") ?? version;
433501
433598
  const { version: latestCliVersion } = await distribution_default.get("https://registry.npmjs.org/@tscircuit/cli/latest", { throwHttpErrors: false }).json();
433502
- if (latestCliVersion && import_semver.default.gt(latestCliVersion, currentCliVersion)) {
433503
- const userWantsToUpdate = await askConfirmation(`A new version of tsci is available (${currentCliVersion} → ${latestCliVersion}).
433599
+ if (latestCliVersion && import_semver.default.gt(latestCliVersion, currentCliVersion())) {
433600
+ const userWantsToUpdate = await askConfirmation(`A new version of tsci is available (${currentCliVersion()} → ${latestCliVersion}).
433504
433601
  Would you like to update now?`);
433505
433602
  if (userWantsToUpdate) {
433506
433603
  const packageManager = detectPackageManager();
@@ -433508,7 +433605,7 @@ Would you like to update now?`);
433508
433605
  try {
433509
433606
  console.log(`Updating tsci using: ${installCommand}`);
433510
433607
  execSync2(installCommand, { stdio: "inherit" });
433511
- console.log("tsci has been updated successfully!");
433608
+ console.log(kleur_default.green("tsci has been updated successfully!"));
433512
433609
  } catch {
433513
433610
  console.warn("Update failed. You can try updating manually by running:");
433514
433611
  console.warn(` ${installCommand}`);
@@ -433517,6 +433614,7 @@ Would you like to update now?`);
433517
433614
  } else {
433518
433615
  return false;
433519
433616
  }
433617
+ return true;
433520
433618
  };
433521
433619
  var askConfirmation = (question) => {
433522
433620
  return new Promise((resolve) => {
@@ -438010,103 +438108,6 @@ var import_debug = __toESM2(require_src(), 1);
438010
438108
  import * as fs16 from "node:fs";
438011
438109
  import * as path16 from "node:path";
438012
438110
 
438013
- // node_modules/kleur/index.mjs
438014
- var FORCE_COLOR;
438015
- var NODE_DISABLE_COLORS;
438016
- var NO_COLOR;
438017
- var TERM;
438018
- var isTTY = true;
438019
- if (typeof process !== "undefined") {
438020
- ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
438021
- isTTY = process.stdout && process.stdout.isTTY;
438022
- }
438023
- var $ = {
438024
- enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY),
438025
- reset: init(0, 0),
438026
- bold: init(1, 22),
438027
- dim: init(2, 22),
438028
- italic: init(3, 23),
438029
- underline: init(4, 24),
438030
- inverse: init(7, 27),
438031
- hidden: init(8, 28),
438032
- strikethrough: init(9, 29),
438033
- black: init(30, 39),
438034
- red: init(31, 39),
438035
- green: init(32, 39),
438036
- yellow: init(33, 39),
438037
- blue: init(34, 39),
438038
- magenta: init(35, 39),
438039
- cyan: init(36, 39),
438040
- white: init(37, 39),
438041
- gray: init(90, 39),
438042
- grey: init(90, 39),
438043
- bgBlack: init(40, 49),
438044
- bgRed: init(41, 49),
438045
- bgGreen: init(42, 49),
438046
- bgYellow: init(43, 49),
438047
- bgBlue: init(44, 49),
438048
- bgMagenta: init(45, 49),
438049
- bgCyan: init(46, 49),
438050
- bgWhite: init(47, 49)
438051
- };
438052
- function run(arr, str) {
438053
- let i = 0, tmp, beg = "", end = "";
438054
- for (;i < arr.length; i++) {
438055
- tmp = arr[i];
438056
- beg += tmp.open;
438057
- end += tmp.close;
438058
- if (!!~str.indexOf(tmp.close)) {
438059
- str = str.replace(tmp.rgx, tmp.close + tmp.open);
438060
- }
438061
- }
438062
- return beg + str + end;
438063
- }
438064
- function chain(has, keys) {
438065
- let ctx = { has, keys };
438066
- ctx.reset = $.reset.bind(ctx);
438067
- ctx.bold = $.bold.bind(ctx);
438068
- ctx.dim = $.dim.bind(ctx);
438069
- ctx.italic = $.italic.bind(ctx);
438070
- ctx.underline = $.underline.bind(ctx);
438071
- ctx.inverse = $.inverse.bind(ctx);
438072
- ctx.hidden = $.hidden.bind(ctx);
438073
- ctx.strikethrough = $.strikethrough.bind(ctx);
438074
- ctx.black = $.black.bind(ctx);
438075
- ctx.red = $.red.bind(ctx);
438076
- ctx.green = $.green.bind(ctx);
438077
- ctx.yellow = $.yellow.bind(ctx);
438078
- ctx.blue = $.blue.bind(ctx);
438079
- ctx.magenta = $.magenta.bind(ctx);
438080
- ctx.cyan = $.cyan.bind(ctx);
438081
- ctx.white = $.white.bind(ctx);
438082
- ctx.gray = $.gray.bind(ctx);
438083
- ctx.grey = $.grey.bind(ctx);
438084
- ctx.bgBlack = $.bgBlack.bind(ctx);
438085
- ctx.bgRed = $.bgRed.bind(ctx);
438086
- ctx.bgGreen = $.bgGreen.bind(ctx);
438087
- ctx.bgYellow = $.bgYellow.bind(ctx);
438088
- ctx.bgBlue = $.bgBlue.bind(ctx);
438089
- ctx.bgMagenta = $.bgMagenta.bind(ctx);
438090
- ctx.bgCyan = $.bgCyan.bind(ctx);
438091
- ctx.bgWhite = $.bgWhite.bind(ctx);
438092
- return ctx;
438093
- }
438094
- function init(open2, close) {
438095
- let blk = {
438096
- open: `\x1B[${open2}m`,
438097
- close: `\x1B[${close}m`,
438098
- rgx: new RegExp(`\\x1b\\[${close}m`, "g")
438099
- };
438100
- return function(txt) {
438101
- if (this !== undefined && this.has !== undefined) {
438102
- !!~this.has.indexOf(open2) || (this.has.push(open2), this.keys.push(blk));
438103
- return txt === undefined ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
438104
- }
438105
- return txt === undefined ? chain([open2], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
438106
- };
438107
- }
438108
- var kleur_default = $;
438109
-
438110
438111
  // lib/shared/get-entrypoint.ts
438111
438112
  import * as fs12 from "node:fs";
438112
438113
  import * as path13 from "node:path";
@@ -464415,7 +464416,7 @@ function registerUpgradeCommand(program3) {
464415
464416
  program3.command("upgrade").description("Upgrade CLI to the latest version").action(async () => {
464416
464417
  const isUpdated = await checkForTsciUpdates();
464417
464418
  if (!isUpdated) {
464418
- console.log(kleur_default.green("You are already using the latest version of tsci."));
464419
+ console.log(kleur_default.green(`You are already using the latest version of tsci (v${currentCliVersion()})`));
464419
464420
  }
464420
464421
  });
464421
464422
  }
@@ -464441,6 +464442,7 @@ var registerConfigSet = (program3) => {
464441
464442
  };
464442
464443
 
464443
464444
  // cli/search/register.ts
464445
+ var import_prompts3 = __toESM2(require_prompts3(), 1);
464444
464446
  var registerSearch = (program3) => {
464445
464447
  program3.command("search").description("Search for snippets in the tscircuit registry").argument("<query>", "Search query (e.g. keyword, author, or snippet name)").action(async (query) => {
464446
464448
  const ky2 = getRegistryApiKy();
@@ -464458,8 +464460,37 @@ var registerSearch = (program3) => {
464458
464460
  return;
464459
464461
  }
464460
464462
  console.log(kleur_default.bold().underline(`Found ${results.packages.length} package(s):`));
464461
- for (const pkg of results.packages) {
464462
- console.log(kleur_default.green(pkg.name) + (pkg.description ? ` - ${pkg.description}` : ""));
464463
+ const choices = results.packages.map((pkg) => ({
464464
+ title: pkg.name,
464465
+ description: pkg.description || "",
464466
+ value: pkg.name
464467
+ }));
464468
+ const { selectedPackage } = await import_prompts3.default({
464469
+ type: "select",
464470
+ name: "selectedPackage",
464471
+ message: "Select a package to add:",
464472
+ choices,
464473
+ initial: 0
464474
+ });
464475
+ if (!selectedPackage) {
464476
+ console.log(kleur_default.yellow("No package selected."));
464477
+ return;
464478
+ }
464479
+ const { confirm } = await import_prompts3.default({
464480
+ type: "confirm",
464481
+ name: "confirm",
464482
+ message: `Do you want to add ${kleur_default.green(selectedPackage)}?`,
464483
+ initial: true
464484
+ });
464485
+ if (confirm) {
464486
+ try {
464487
+ console.log(kleur_default.blue(`Installing ${selectedPackage}...`));
464488
+ await addPackage(selectedPackage);
464489
+ console.log(kleur_default.green(`Successfully installed ${selectedPackage}`));
464490
+ } catch (error) {
464491
+ console.error(kleur_default.red(`Failed to install ${selectedPackage}:`), error);
464492
+ process.exit(1);
464493
+ }
464463
464494
  }
464464
464495
  });
464465
464496
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.98",
3
+ "version": "0.1.100",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",