@tscircuit/cli 0.1.99 → 0.1.101

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 (2) hide show
  1. package/dist/main.js +559 -344
  2. package/package.json +2 -2
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++) {
@@ -336132,14 +336132,14 @@ Expected ` + (val42.length + 1) + " quasis but got " + node2.quasis.length);
336132
336132
  return path22.slice(0, index2 + 1);
336133
336133
  }
336134
336134
  function mergePaths(url, base) {
336135
- normalizePath2(base, base.type);
336135
+ normalizePath3(base, base.type);
336136
336136
  if (url.path === "/") {
336137
336137
  url.path = base.path;
336138
336138
  } else {
336139
336139
  url.path = stripPathFilename(base.path) + url.path;
336140
336140
  }
336141
336141
  }
336142
- function normalizePath2(url, type2) {
336142
+ function normalizePath3(url, type2) {
336143
336143
  var rel = type2 <= 4;
336144
336144
  var pieces = url.path.split("/");
336145
336145
  var pointer = 1;
@@ -336202,7 +336202,7 @@ Expected ` + (val42.length + 1) + " quasis but got " + node2.quasis.length);
336202
336202
  if (baseType > inputType)
336203
336203
  inputType = baseType;
336204
336204
  }
336205
- normalizePath2(url, inputType);
336205
+ normalizePath3(url, inputType);
336206
336206
  var queryHash = url.query + url.hash;
336207
336207
  switch (inputType) {
336208
336208
  case 2:
@@ -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.98";
433428
+ var version = "0.1.100";
433429
433429
  var package_default = {
433430
433430
  name: "@tscircuit/cli",
433431
433431
  version,
@@ -433436,7 +433436,7 @@ var package_default = {
433436
433436
  "@tscircuit/core": "^0.0.353",
433437
433437
  "@tscircuit/eval": "^0.0.152",
433438
433438
  "@tscircuit/fake-snippets": "^0.0.23",
433439
- "@tscircuit/file-server": "^0.0.19",
433439
+ "@tscircuit/file-server": "^0.0.23",
433440
433440
  "@tscircuit/runframe": "^0.0.341",
433441
433441
  "@types/bun": "^1.2.2",
433442
433442
  "@types/configstore": "^6.0.2",
@@ -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) => {
@@ -434300,6 +434398,8 @@ init_lib();
434300
434398
  init_lib();
434301
434399
  init_lib();
434302
434400
  init_lib();
434401
+ init_lib();
434402
+ init_lib();
434303
434403
  var fileSchema = z.object({
434304
434404
  file_id: z.string(),
434305
434405
  file_path: z.string(),
@@ -434308,28 +434408,56 @@ var fileSchema = z.object({
434308
434408
  });
434309
434409
  var eventSchema = z.object({
434310
434410
  event_id: z.string(),
434311
- event_type: z.literal("FILE_UPDATED"),
434411
+ event_type: z.union([
434412
+ z.literal("FILE_UPDATED"),
434413
+ z.literal("FILE_DELETED"),
434414
+ z.literal("FILE_CREATED")
434415
+ ]),
434312
434416
  file_path: z.string(),
434313
- created_at: z.string()
434417
+ created_at: z.string(),
434418
+ initiator: z.string().optional()
434314
434419
  });
434315
434420
  var databaseSchema = z.object({
434316
434421
  idCounter: z.number().default(0),
434317
434422
  files: z.array(fileSchema).default([]),
434318
434423
  events: z.array(eventSchema).default([])
434319
434424
  });
434425
+ function normalizePath(path7) {
434426
+ if (!path7 || path7 === "/")
434427
+ return "";
434428
+ let normalized = path7.replace(/\\+/g, "/").replace(/\/\/+/, "/");
434429
+ if (normalized.startsWith("/")) {
434430
+ normalized = normalized.slice(1);
434431
+ }
434432
+ if (normalized.length > 1 && normalized.endsWith("/")) {
434433
+ normalized = normalized.slice(0, -1);
434434
+ }
434435
+ return normalized;
434436
+ }
434320
434437
  var createDatabase = () => {
434321
434438
  return hoist(createStore(initializer));
434322
434439
  };
434323
434440
  var initializer = combine(databaseSchema.parse({}), (set, get) => ({
434324
434441
  upsertFile: (file, opts) => {
434442
+ const file_path = normalizePath(file.file_path);
434325
434443
  set((state) => {
434326
- const existingFileIndex = state.files.findIndex((f) => f.file_path === file.file_path);
434444
+ const existingFileIndex = state.files.findIndex((f) => normalizePath(f.file_path) === file_path);
434327
434445
  const newFile = {
434328
434446
  ...file,
434447
+ file_path,
434329
434448
  file_id: existingFileIndex >= 0 ? state.files[existingFileIndex].file_id : state.idCounter.toString(),
434330
434449
  created_at: existingFileIndex >= 0 ? state.files[existingFileIndex].created_at : (/* @__PURE__ */ new Date()).toISOString()
434331
434450
  };
434332
- const files = existingFileIndex >= 0 ? state.files.map((f, i) => i === existingFileIndex ? newFile : f) : [...state.files, newFile];
434451
+ let files;
434452
+ if (existingFileIndex >= 0) {
434453
+ files = [
434454
+ ...state.files.slice(0, existingFileIndex),
434455
+ newFile,
434456
+ ...state.files.slice(existingFileIndex + 1)
434457
+ ];
434458
+ } else {
434459
+ files = [...state.files, newFile];
434460
+ }
434333
434461
  return {
434334
434462
  files,
434335
434463
  idCounter: existingFileIndex >= 0 ? state.idCounter : state.idCounter + 1
@@ -434337,15 +434465,88 @@ var initializer = combine(databaseSchema.parse({}), (set, get) => ({
434337
434465
  });
434338
434466
  get().createEvent({
434339
434467
  event_type: "FILE_UPDATED",
434340
- file_path: file.file_path,
434468
+ file_path,
434341
434469
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
434342
434470
  initiator: opts.initiator
434343
434471
  });
434344
- return get().files.find((f) => f.file_path === file.file_path);
434472
+ return get().files.find((f) => normalizePath(f.file_path) === file_path);
434345
434473
  },
434346
434474
  getFile: (query) => {
434347
434475
  const state = get();
434348
- return state.files.find((f) => query.file_id && f.file_id === query.file_id || query.file_path && f.file_path === query.file_path);
434476
+ return state.files.find((f) => query.file_id && f.file_id === query.file_id || query.file_path && normalizePath(f.file_path) === normalizePath(query.file_path));
434477
+ },
434478
+ getFileByPath: (file_path) => {
434479
+ const state = get();
434480
+ const norm = normalizePath(file_path);
434481
+ return state.files.find((f) => normalizePath(f.file_path) === norm);
434482
+ },
434483
+ renameFile: (old_file_path, new_file_path, opts) => {
434484
+ let renamedFile;
434485
+ const normOld = normalizePath(old_file_path);
434486
+ const normNew = normalizePath(new_file_path);
434487
+ set((state) => {
434488
+ const fileIndex = state.files.findIndex((f) => normalizePath(f.file_path) === normOld);
434489
+ if (fileIndex === -1)
434490
+ return state;
434491
+ const file = state.files[fileIndex];
434492
+ renamedFile = {
434493
+ ...file,
434494
+ file_path: normNew
434495
+ };
434496
+ const files = [
434497
+ ...state.files.slice(0, fileIndex),
434498
+ renamedFile,
434499
+ ...state.files.slice(fileIndex + 1)
434500
+ ];
434501
+ state.events.push({
434502
+ event_id: (state.idCounter + 0).toString(),
434503
+ event_type: "FILE_CREATED",
434504
+ file_path: normNew,
434505
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
434506
+ initiator: opts.initiator
434507
+ });
434508
+ state.events.push({
434509
+ event_id: (state.idCounter + 1).toString(),
434510
+ event_type: "FILE_DELETED",
434511
+ file_path: normOld,
434512
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
434513
+ initiator: opts.initiator
434514
+ });
434515
+ return {
434516
+ files,
434517
+ events: state.events,
434518
+ idCounter: state.idCounter + 2
434519
+ };
434520
+ });
434521
+ return renamedFile;
434522
+ },
434523
+ deleteFile: (query, opts) => {
434524
+ let deletedFile;
434525
+ set((state) => {
434526
+ const initialLength = state.files.length;
434527
+ const files = state.files.filter((f) => {
434528
+ const match = query.file_id && f.file_id === query.file_id || query.file_path && normalizePath(f.file_path) === normalizePath(query.file_path);
434529
+ if (match) {
434530
+ deletedFile = f;
434531
+ }
434532
+ return !match;
434533
+ });
434534
+ if (files.length === initialLength) {
434535
+ return state;
434536
+ }
434537
+ return {
434538
+ files
434539
+ };
434540
+ });
434541
+ if (deletedFile) {
434542
+ get().createEvent({
434543
+ event_type: "FILE_DELETED",
434544
+ file_path: normalizePath(deletedFile.file_path),
434545
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
434546
+ initiator: opts.initiator
434547
+ });
434548
+ }
434549
+ return deletedFile;
434349
434550
  },
434350
434551
  createEvent: (event) => {
434351
434552
  set((state) => ({
@@ -434662,6 +434863,25 @@ var reset_default = withRouteSpec({
434662
434863
  ctx.db.resetEvents();
434663
434864
  return ctx.json({ ok: true });
434664
434865
  });
434866
+ var delete_default = withRouteSpec({
434867
+ methods: ["POST", "DELETE"],
434868
+ commonParams: z.object({
434869
+ file_id: z.string().optional(),
434870
+ file_path: z.string().optional(),
434871
+ initiator: z.string().optional()
434872
+ }),
434873
+ jsonResponse: z.union([z.null(), z.object({ error: z.string() })])
434874
+ })(async (req, ctx) => {
434875
+ const { file_id, file_path, initiator } = req.commonParams;
434876
+ if (!file_id && !file_path) {
434877
+ return ctx.json({ error: "Either file_id or file_path must be provided" }, { status: 400 });
434878
+ }
434879
+ const deletedFile = ctx.db.deleteFile({ file_id, file_path }, { initiator });
434880
+ if (!deletedFile) {
434881
+ return ctx.json({ error: "File not found" }, { status: 404 });
434882
+ }
434883
+ return ctx.json(null, { status: 204 });
434884
+ });
434665
434885
  var download_default = withRouteSpec({
434666
434886
  methods: ["GET"],
434667
434887
  queryParams: z.object({
@@ -434734,6 +434954,39 @@ var list_default4 = withRouteSpec({
434734
434954
  }))
434735
434955
  });
434736
434956
  });
434957
+ var rename_default = withRouteSpec({
434958
+ methods: ["POST"],
434959
+ jsonBody: z.object({
434960
+ old_file_path: z.string(),
434961
+ new_file_path: z.string(),
434962
+ initiator: z.string().optional()
434963
+ }),
434964
+ jsonResponse: z.object({
434965
+ file: z.object({
434966
+ file_id: z.string(),
434967
+ file_path: z.string(),
434968
+ text_content: z.string(),
434969
+ created_at: z.string()
434970
+ }).nullable()
434971
+ })
434972
+ })(async (req, ctx) => {
434973
+ const body = await req.json();
434974
+ const oldFile = ctx.db.getFileByPath(body.old_file_path);
434975
+ if (!oldFile) {
434976
+ return ctx.json({ file: null }, { status: 404 });
434977
+ }
434978
+ const existingFile = ctx.db.getFileByPath(body.new_file_path);
434979
+ if (existingFile) {
434980
+ return ctx.json({ file: null }, { status: 409 });
434981
+ }
434982
+ const file = ctx.db.renameFile(body.old_file_path, body.new_file_path, {
434983
+ initiator: body.initiator
434984
+ });
434985
+ if (!file) {
434986
+ return ctx.json({ file: null }, { status: 500 });
434987
+ }
434988
+ return ctx.json({ file });
434989
+ });
434737
434990
  var upsert_default = withRouteSpec({
434738
434991
  methods: ["POST"],
434739
434992
  jsonBody: z.object({
@@ -434866,10 +435119,12 @@ var routeMapWithHandlers = {
434866
435119
  "/events/create": create_default2,
434867
435120
  "/events/list": list_default3,
434868
435121
  "/events/reset": reset_default,
435122
+ "/files/delete": delete_default,
434869
435123
  "/files/download": download_default,
434870
435124
  "/files/download/[[file_path]]": file_path_default,
434871
435125
  "/files/get": get_default2,
434872
435126
  "/files/list": list_default4,
435127
+ "/files/rename": rename_default,
434873
435128
  "/files/upsert": upsert_default,
434874
435129
  "/health": health_default,
434875
435130
  "/proxy": proxy_default,
@@ -435977,7 +436232,7 @@ function createPattern(matcher) {
435977
436232
  }
435978
436233
  return () => false;
435979
436234
  }
435980
- function normalizePath(path7) {
436235
+ function normalizePath2(path7) {
435981
436236
  if (typeof path7 !== "string")
435982
436237
  throw new Error("string expected");
435983
436238
  path7 = sysPath2.normalize(path7);
@@ -435993,7 +436248,7 @@ function normalizePath(path7) {
435993
436248
  return path7;
435994
436249
  }
435995
436250
  function matchPatterns(patterns, testString, stats) {
435996
- const path7 = normalizePath(testString);
436251
+ const path7 = normalizePath2(testString);
435997
436252
  for (let index = 0;index < patterns.length; index++) {
435998
436253
  const pattern = patterns[index];
435999
436254
  if (pattern(path7, stats)) {
@@ -438010,103 +438265,6 @@ var import_debug = __toESM2(require_src(), 1);
438010
438265
  import * as fs16 from "node:fs";
438011
438266
  import * as path16 from "node:path";
438012
438267
 
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
438268
  // lib/shared/get-entrypoint.ts
438111
438269
  import * as fs12 from "node:fs";
438112
438270
  import * as path13 from "node:path";
@@ -439036,6 +439194,9 @@ async function addPackage(componentPath, projectDir = process.cwd()) {
439036
439194
  }
439037
439195
 
439038
439196
  // cli/dev/DevServer.ts
439197
+ var import_debug2 = __toESM2(require_src(), 1);
439198
+ var debug2 = import_debug2.default("tscircuit:devserver");
439199
+
439039
439200
  class DevServer {
439040
439201
  port;
439041
439202
  componentFilePath;
@@ -439072,6 +439233,9 @@ class DevServer {
439072
439233
  });
439073
439234
  this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
439074
439235
  this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
439236
+ this.filesystemWatcher.on("unlink", (filePath) => this.handleFileRemovedFromFilesystem(filePath));
439237
+ this.filesystemWatcher.on("unlinkDir", (filePath) => this.handleFileRemovedFromFilesystem(filePath));
439238
+ this.filesystemWatcher.on("rename", (oldPath, newPath) => this.handleFileRename(oldPath, newPath));
439075
439239
  await this.upsertInitialFiles();
439076
439240
  this.typesHandler?.handleInitialTypeDependencies(this.componentFilePath);
439077
439241
  }
@@ -439100,6 +439264,56 @@ class DevServer {
439100
439264
  }
439101
439265
  }).json();
439102
439266
  }
439267
+ async handleFileRemovedFromFilesystem(absoluteFilePath) {
439268
+ const relativeFilePath = path18.relative(this.projectDir, absoluteFilePath);
439269
+ if (!relativeFilePath || relativeFilePath.trim() === "") {
439270
+ debug2("Skipping delete for empty file path");
439271
+ return;
439272
+ }
439273
+ debug2(`Deleting file ${relativeFilePath} from server`);
439274
+ const deleteFile = async () => {
439275
+ return await this.fsKy.post("api/files/delete", {
439276
+ json: {
439277
+ file_path: relativeFilePath,
439278
+ initiator: "filesystem_change"
439279
+ },
439280
+ throwHttpErrors: false,
439281
+ timeout: 5000,
439282
+ retry: {
439283
+ limit: 3,
439284
+ methods: ["POST"],
439285
+ statusCodes: [408, 413, 429, 500, 502, 503, 504]
439286
+ }
439287
+ }).json();
439288
+ };
439289
+ const response = await Promise.resolve(deleteFile()).catch((error) => {
439290
+ console.error(`Network error deleting ${relativeFilePath}: ${error instanceof Error ? error.message : String(error)}`);
439291
+ return { error: "Connection error" };
439292
+ });
439293
+ if (response && response.error) {
439294
+ if (response.error.includes("File not found")) {
439295
+ debug2(`File not found: ${relativeFilePath}`);
439296
+ } else {
439297
+ console.error(`Failed to delete file ${relativeFilePath}: ${response.error}`);
439298
+ }
439299
+ return;
439300
+ }
439301
+ debug2(`Successfully deleted file ${relativeFilePath} from server`);
439302
+ }
439303
+ async handleFileRename(oldPath, newPath) {
439304
+ const oldRelativePath = path18.relative(this.projectDir, oldPath);
439305
+ const newRelativePath = path18.relative(this.projectDir, newPath);
439306
+ await this.handleFileRemovedFromFilesystem(oldPath);
439307
+ const fileContent = fs18.readFileSync(newPath, "utf-8");
439308
+ await this.fsKy.post("api/files/upsert", {
439309
+ json: {
439310
+ file_path: newRelativePath,
439311
+ text_content: fileContent,
439312
+ initiator: "filesystem_change"
439313
+ }
439314
+ });
439315
+ debug2(`File renamed from ${oldRelativePath} to ${newRelativePath}`);
439316
+ }
439103
439317
  async upsertInitialFiles() {
439104
439318
  const filePaths = getPackageFilePaths(this.projectDir);
439105
439319
  for (const filePath of filePaths) {
@@ -439133,6 +439347,7 @@ class DevServer {
439133
439347
  async stop() {
439134
439348
  this.httpServer?.close();
439135
439349
  this.eventsWatcher?.stop();
439350
+ await this.filesystemWatcher?.close();
439136
439351
  }
439137
439352
  async handleInstallPackage(full_package_name) {
439138
439353
  const postEvent = async (event, message) => {
@@ -439941,33 +440156,33 @@ init_dist4();
439941
440156
  var import_transformation_matrix38 = __toESM2(require_build_commonjs(), 1);
439942
440157
  init_dist2();
439943
440158
  init_dist2();
439944
- var import_debug2 = __toESM2(require_src(), 1);
440159
+ var import_debug3 = __toESM2(require_src(), 1);
439945
440160
  init_dist2();
439946
440161
  var import_transformation_matrix39 = __toESM2(require_build_commonjs(), 1);
439947
440162
  init_dist2();
439948
- var import_debug3 = __toESM2(require_src(), 1);
440163
+ var import_debug4 = __toESM2(require_src(), 1);
439949
440164
  init_dist2();
439950
440165
  var import_transformation_matrix40 = __toESM2(require_build_commonjs(), 1);
439951
440166
  var import_transformation_matrix41 = __toESM2(require_build_commonjs(), 1);
439952
440167
  var import_transformation_matrix42 = __toESM2(require_build_commonjs(), 1);
439953
- var import_debug4 = __toESM2(require_src(), 1);
440168
+ var import_debug5 = __toESM2(require_src(), 1);
439954
440169
  var import_transformation_matrix43 = __toESM2(require_build_commonjs(), 1);
439955
440170
  var import_transformation_matrix44 = __toESM2(require_build_commonjs(), 1);
439956
440171
  var import_transformation_matrix45 = __toESM2(require_build_commonjs(), 1);
439957
- var import_debug5 = __toESM2(require_src(), 1);
439958
440172
  var import_debug6 = __toESM2(require_src(), 1);
439959
- var import_transformation_matrix46 = __toESM2(require_build_commonjs(), 1);
439960
440173
  var import_debug7 = __toESM2(require_src(), 1);
440174
+ var import_transformation_matrix46 = __toESM2(require_build_commonjs(), 1);
440175
+ var import_debug8 = __toESM2(require_src(), 1);
439961
440176
  var import_transformation_matrix47 = __toESM2(require_build_commonjs(), 1);
439962
440177
  init_dist2();
439963
440178
  var import_transformation_matrix48 = __toESM2(require_build_commonjs(), 1);
439964
- var import_debug8 = __toESM2(require_src(), 1);
440179
+ var import_debug9 = __toESM2(require_src(), 1);
439965
440180
  var import_transformation_matrix49 = __toESM2(require_build_commonjs(), 1);
439966
440181
  var import_transformation_matrix50 = __toESM2(require_build_commonjs(), 1);
439967
440182
  init_dist2();
439968
- var import_debug9 = __toESM2(require_src(), 1);
439969
440183
  var import_debug10 = __toESM2(require_src(), 1);
439970
440184
  var import_debug11 = __toESM2(require_src(), 1);
440185
+ var import_debug12 = __toESM2(require_src(), 1);
439971
440186
  function getComponentValue(sourceComponent) {
439972
440187
  if (!sourceComponent)
439973
440188
  return "";
@@ -440368,7 +440583,7 @@ function getCombinedSourcePortName(circuitElements, connectedSourcePortIds) {
440368
440583
  }
440369
440584
  return portInfos.map((p) => p.displayName).join("--");
440370
440585
  }
440371
- var debug2 = import_debug2.default("dsn-converter:processPcbTraces");
440586
+ var debug3 = import_debug3.default("dsn-converter:processPcbTraces");
440372
440587
  var DEFAULT_VIA_DIAMETER = 600;
440373
440588
  var DEFAULT_VIA_HOLE = 300;
440374
440589
  function createWire(opts) {
@@ -440392,7 +440607,7 @@ function processPcbTraces(circuitElements, pcb) {
440392
440607
  source_trace_id: pcbTrace.source_trace_id
440393
440608
  });
440394
440609
  const source_net2 = source_trace2 && su_default(circuitElements).source_net.list().find((n2) => source_trace2.connected_source_net_ids.includes(n2.source_net_id));
440395
- debug2(`PCB TRACE
440610
+ debug3(`PCB TRACE
440396
440611
  ----------
440397
440612
  `, pcbTrace);
440398
440613
  const sourceTraceConnectedPortIds = getCombinedSourcePortName(circuitElements, source_trace2?.connected_source_port_ids || []);
@@ -440401,7 +440616,7 @@ function processPcbTraces(circuitElements, pcb) {
440401
440616
  let currentWire = null;
440402
440617
  for (let i = 0;i < pcbTrace.route.length; i++) {
440403
440618
  const point2 = pcbTrace.route[i];
440404
- debug2(`POINT
440619
+ debug3(`POINT
440405
440620
  ------
440406
440621
  `, point2);
440407
440622
  if (point2.route_type === "wire") {
@@ -440443,7 +440658,7 @@ function processPcbTraces(circuitElements, pcb) {
440443
440658
  continue;
440444
440659
  }
440445
440660
  if (point2.route_type === "via") {
440446
- debug2(`VIA
440661
+ debug3(`VIA
440447
440662
  ----
440448
440663
  `, point2);
440449
440664
  if (currentWire) {
@@ -440452,7 +440667,7 @@ function processPcbTraces(circuitElements, pcb) {
440452
440667
  currentWire = null;
440453
440668
  }
440454
440669
  const viaPadstackName = findOrCreateViaPadstack(dsnWrapper, DEFAULT_VIA_DIAMETER, DEFAULT_VIA_HOLE);
440455
- debug2("VIA PADSTACK NAME:", viaPadstackName);
440670
+ debug3("VIA PADSTACK NAME:", viaPadstackName);
440456
440671
  if (dsnWrapper.getStructure() && !dsnWrapper.getStructure()?.via) {
440457
440672
  dsnWrapper.getStructure().via = viaPadstackName;
440458
440673
  }
@@ -440474,7 +440689,7 @@ function processPcbTraces(circuitElements, pcb) {
440474
440689
  }
440475
440690
  }
440476
440691
  }
440477
- debug2("PCB WIRING/NETWORK_OUT AT END", JSON.stringify(pcb.is_dsn_pcb ? pcb.wiring : pcb.routes.network_out.nets, null, 2));
440692
+ debug3("PCB WIRING/NETWORK_OUT AT END", JSON.stringify(pcb.is_dsn_pcb ? pcb.wiring : pcb.routes.network_out.nets, null, 2));
440478
440693
  }
440479
440694
  var transformMmToUm2 = import_transformation_matrix39.scale(1000);
440480
440695
  function processPlatedHoles(componentGroups, circuitElements, pcb) {
@@ -440752,7 +440967,7 @@ function groupComponents(circuitElements) {
440752
440967
  }
440753
440968
  return Array.from(componentMap.values());
440754
440969
  }
440755
- var debug22 = import_debug3.default("dsn-converter:mergeDsnSessionIntoDsnPcb");
440970
+ var debug22 = import_debug4.default("dsn-converter:mergeDsnSessionIntoDsnPcb");
440756
440971
  var stringifyDsnJson = (dsnJson) => {
440757
440972
  const indent = " ";
440758
440973
  let result = "";
@@ -440941,14 +441156,14 @@ var convertCircuitJsonToDsnString = (circuitJson) => {
440941
441156
  const dsnJson = convertCircuitJsonToDsnJson(circuitJson);
440942
441157
  return stringifyDsnJson(dsnJson);
440943
441158
  };
440944
- var debug3 = import_debug4.default("dsn-converter:convertPadstacksToSmtpads");
440945
- var debug4 = import_debug5.default("dsn-converter:convertWiringPathToPcbTraces");
440946
- var debug5 = import_debug7.default("dsn-converter:convertWiringViaToPcbVias");
440947
- var debug6 = import_debug6.default("dsn-converter:convertWiresToPcbTraces");
440948
- var debug7 = import_debug8.default("dsn-converter");
440949
- var debug8 = import_debug10.default("dsn-converter:getPinNum");
440950
- var debug9 = import_debug11.default("dsn-converter:getViaCoords");
440951
- var debug10 = import_debug9.default("dsn-converter:parse-dsn-to-dsn-json");
441159
+ var debug32 = import_debug5.default("dsn-converter:convertPadstacksToSmtpads");
441160
+ var debug4 = import_debug6.default("dsn-converter:convertWiringPathToPcbTraces");
441161
+ var debug5 = import_debug8.default("dsn-converter:convertWiringViaToPcbVias");
441162
+ var debug6 = import_debug7.default("dsn-converter:convertWiresToPcbTraces");
441163
+ var debug7 = import_debug9.default("dsn-converter");
441164
+ var debug8 = import_debug11.default("dsn-converter:getPinNum");
441165
+ var debug9 = import_debug12.default("dsn-converter:getViaCoords");
441166
+ var debug10 = import_debug10.default("dsn-converter:parse-dsn-to-dsn-json");
440952
441167
 
440953
441168
  // node_modules/@tscircuit/eval/dist/eval/chunk-7SIVWFC6.js
440954
441169
  function normalizeFilePath(filePath) {
@@ -444706,25 +444921,25 @@ var fp = footprinter;
444706
444921
 
444707
444922
  // node_modules/@tscircuit/core/dist/index.js
444708
444923
  init_dist();
444709
- var import_debug15 = __toESM2(require_src(), 1);
444924
+ var import_debug16 = __toESM2(require_src(), 1);
444710
444925
  var import_react = __toESM2(require_react(), 1);
444711
444926
  var import_react_reconciler = __toESM2(require_react_reconciler(), 1);
444712
444927
  var import_react_reconciler_18 = __toESM2(require_react_reconciler_18(), 1);
444713
444928
  var import_constants12 = __toESM2(require_constants5(), 1);
444714
- var import_debug16 = __toESM2(require_src(), 1);
444929
+ var import_debug17 = __toESM2(require_src(), 1);
444715
444930
  var import_transformation_matrix54 = __toESM2(require_build_commonjs(), 1);
444716
444931
  init_dist();
444717
- var import_debug17 = __toESM2(require_src(), 1);
444932
+ var import_debug18 = __toESM2(require_src(), 1);
444718
444933
  init_dist3();
444719
444934
  var import_transformation_matrix55 = __toESM2(require_build_commonjs(), 1);
444720
444935
  init_lib();
444721
444936
  init_lib();
444722
444937
 
444723
444938
  // node_modules/@tscircuit/infgrid-ijump-astar/dist/index.js
444724
- var import_debug12 = __toESM2(require_src(), 1);
444725
- init_dist();
444726
444939
  var import_debug13 = __toESM2(require_src(), 1);
444940
+ init_dist();
444727
444941
  var import_debug14 = __toESM2(require_src(), 1);
444942
+ var import_debug15 = __toESM2(require_src(), 1);
444728
444943
  init_dist2();
444729
444944
  var import_performance_now = __toESM2(require_performance_now(), 1);
444730
444945
 
@@ -445032,7 +445247,7 @@ function addViasWhenLayerChanges(route) {
445032
445247
  newRoute.push(route[route.length - 1]);
445033
445248
  return newRoute;
445034
445249
  }
445035
- var debug11 = import_debug13.default("autorouter:shortenPathWithShortcuts");
445250
+ var debug11 = import_debug14.default("autorouter:shortenPathWithShortcuts");
445036
445251
  function shortenPathWithShortcuts(route, checkIfObstacleBetweenPoints) {
445037
445252
  if (route.length <= 2) {
445038
445253
  return route;
@@ -445137,7 +445352,7 @@ function shortenPathWithShortcuts(route, checkIfObstacleBetweenPoints) {
445137
445352
  }
445138
445353
  return shortened;
445139
445354
  }
445140
- var debug23 = import_debug12.default("autorouting-dataset:astar");
445355
+ var debug23 = import_debug13.default("autorouting-dataset:astar");
445141
445356
  var GeneralizedAstarAutorouter = class {
445142
445357
  openSet = [];
445143
445358
  closedSet = /* @__PURE__ */ new Set;
@@ -445491,7 +445706,7 @@ var GeneralizedAstarAutorouter = class {
445491
445706
  }
445492
445707
  }
445493
445708
  };
445494
- var debug32 = import_debug14.default("autorouting-dataset:infinite-grid-ijump-astar:get-distance-to-overcome-obstacle");
445709
+ var debug33 = import_debug15.default("autorouting-dataset:infinite-grid-ijump-astar:get-distance-to-overcome-obstacle");
445495
445710
  function getDistanceToOvercomeObstacle({
445496
445711
  node,
445497
445712
  travelDir,
@@ -445529,7 +445744,7 @@ function getDistanceToOvercomeObstacle({
445529
445744
  const o1OrthoDim = extendingAlongXAxis ? obstacle.height : obstacle.width;
445530
445745
  const o2OrthoDim = extendingAlongXAxis ? obstacleAtEnd.height : obstacleAtEnd.width;
445531
445746
  if (o2OrthoDim > o1OrthoDim) {
445532
- debug32("next obstacle on path is bigger, not trying to overcome it");
445747
+ debug33("next obstacle on path is bigger, not trying to overcome it");
445533
445748
  return distToOvercomeObstacle;
445534
445749
  }
445535
445750
  const endObstacleDistToOvercome = getDistanceToOvercomeObstacle({
@@ -448156,7 +448371,7 @@ class Row {
448156
448371
  _constant;
448157
448372
  }
448158
448373
  // node_modules/@tscircuit/core/dist/index.js
448159
- var import_debug18 = __toESM2(require_src(), 1);
448374
+ var import_debug19 = __toESM2(require_src(), 1);
448160
448375
  init_dist();
448161
448376
 
448162
448377
  // node_modules/@tscircuit/math-utils/dist/index.js
@@ -456411,7 +456626,7 @@ var CapacityMeshSolver = class extends BaseSolver {
456411
456626
 
456412
456627
  // node_modules/@tscircuit/core/dist/index.js
456413
456628
  init_dist();
456414
- var import_debug19 = __toESM2(require_src(), 1);
456629
+ var import_debug20 = __toESM2(require_src(), 1);
456415
456630
  var import_transformation_matrix61 = __toESM2(require_build_commonjs(), 1);
456416
456631
  init_dist2();
456417
456632
  init_dist2();
@@ -456511,7 +456726,7 @@ __export4(components_exports, {
456511
456726
  Transistor: () => Transistor,
456512
456727
  Via: () => Via
456513
456728
  });
456514
- var debug13 = import_debug16.default("tscircuit:renderable");
456729
+ var debug13 = import_debug17.default("tscircuit:renderable");
456515
456730
  var orderedRenderPhases = [
456516
456731
  "ReactSubtreesRender",
456517
456732
  "InitializePortsFromChildren",
@@ -456964,7 +457179,7 @@ function isMatchingSelector(component, selector) {
456964
457179
  return component.props[prop].toString() === value2;
456965
457180
  });
456966
457181
  }
456967
- var debugSelectAll = import_debug17.default("tscircuit:primitive-component:selectAll");
457182
+ var debugSelectAll = import_debug18.default("tscircuit:primitive-component:selectAll");
456968
457183
  var PrimitiveComponent = class extends Renderable {
456969
457184
  parent = null;
456970
457185
  children;
@@ -458799,7 +459014,7 @@ var getAllDimensionsForSchematicBox = (params2) => {
458799
459014
  pinCount
458800
459015
  };
458801
459016
  };
458802
- var debug24 = import_debug18.default("tscircuit:core:footprint");
459017
+ var debug24 = import_debug19.default("tscircuit:core:footprint");
458803
459018
  var Footprint = class extends PrimitiveComponent {
458804
459019
  get config() {
458805
459020
  return {
@@ -460287,7 +460502,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
460287
460502
  this.schematic_trace_id = trace.schematic_trace_id;
460288
460503
  }
460289
460504
  };
460290
- var debug33 = import_debug15.default("tscircuit:core");
460505
+ var debug34 = import_debug16.default("tscircuit:core");
460291
460506
  var rotation3 = z.object({
460292
460507
  x: rotation,
460293
460508
  y: rotation,
@@ -460676,7 +460891,7 @@ var NormalComponent = class extends PrimitiveComponent {
460676
460891
  const existingPorts = this.children.filter((c) => c.componentName === "Port");
460677
460892
  const conflictingPort = existingPorts.find((p) => p.isMatchingAnyOf(component.getNameAndAliases()));
460678
460893
  if (conflictingPort) {
460679
- debug33(`Similar ports added. Port 1: ${conflictingPort}, Port 2: ${component}`);
460894
+ debug34(`Similar ports added. Port 1: ${conflictingPort}, Port 2: ${component}`);
460680
460895
  }
460681
460896
  }
460682
460897
  super.add(component);
@@ -461413,14 +461628,14 @@ var Group = class extends NormalComponent {
461413
461628
  return false;
461414
461629
  }
461415
461630
  _hasTracesToRoute() {
461416
- const debug42 = import_debug19.default("tscircuit:core:_hasTracesToRoute");
461631
+ const debug42 = import_debug20.default("tscircuit:core:_hasTracesToRoute");
461417
461632
  const traces = this.selectAll("trace");
461418
461633
  debug42(`[${this.getString()}] has ${traces.length} traces to route`);
461419
461634
  return traces.length > 0;
461420
461635
  }
461421
461636
  async _runEffectMakeHttpAutoroutingRequest() {
461422
461637
  const { db } = this.root;
461423
- const debug42 = import_debug19.default("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
461638
+ const debug42 = import_debug20.default("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
461424
461639
  const props = this._parsedProps;
461425
461640
  const autorouterConfig2 = this._getAutorouterConfig();
461426
461641
  const serverUrl = autorouterConfig2.serverUrl;
@@ -461518,7 +461733,7 @@ var Group = class extends NormalComponent {
461518
461733
  async _runLocalAutorouting() {
461519
461734
  const { db } = this.root;
461520
461735
  const props = this._parsedProps;
461521
- const debug42 = import_debug19.default("tscircuit:core:_runLocalAutorouting");
461736
+ const debug42 = import_debug20.default("tscircuit:core:_runLocalAutorouting");
461522
461737
  debug42(`[${this.getString()}] starting local autorouting`);
461523
461738
  const autorouterConfig2 = this._getAutorouterConfig();
461524
461739
  const { simpleRouteJson, connMap } = getSimpleRouteJsonFromCircuitJson({
@@ -461594,7 +461809,7 @@ var Group = class extends NormalComponent {
461594
461809
  }
461595
461810
  }
461596
461811
  doInitialPcbTraceRender() {
461597
- const debug42 = import_debug19.default("tscircuit:core:doInitialPcbTraceRender");
461812
+ const debug42 = import_debug20.default("tscircuit:core:doInitialPcbTraceRender");
461598
461813
  if (!this.isSubcircuit)
461599
461814
  return;
461600
461815
  if (this.root?.pcbDisabled)
@@ -461613,7 +461828,7 @@ var Group = class extends NormalComponent {
461613
461828
  this._startAsyncAutorouting();
461614
461829
  }
461615
461830
  updatePcbTraceRender() {
461616
- const debug42 = import_debug19.default("tscircuit:core:updatePcbTraceRender");
461831
+ const debug42 = import_debug20.default("tscircuit:core:updatePcbTraceRender");
461617
461832
  debug42(`[${this.getString()}] updating...`);
461618
461833
  if (!this.isSubcircuit)
461619
461834
  return;
@@ -464203,10 +464418,10 @@ var CircuitRunner = class {
464203
464418
 
464204
464419
  // lib/shared/generate-circuit-json.ts
464205
464420
  var import_make_vfs2 = __toESM2(require_dist8(), 1);
464206
- var import_debug20 = __toESM2(require_src(), 1);
464421
+ var import_debug21 = __toESM2(require_src(), 1);
464207
464422
  import path21 from "node:path";
464208
464423
  import fs21 from "node:fs";
464209
- var debug14 = import_debug20.default("tsci:generate-circuit-json");
464424
+ var debug14 = import_debug21.default("tsci:generate-circuit-json");
464210
464425
  var ALLOWED_FILE_EXTENSIONS = [
464211
464426
  ".tsx",
464212
464427
  ".ts",
@@ -464415,7 +464630,7 @@ function registerUpgradeCommand(program3) {
464415
464630
  program3.command("upgrade").description("Upgrade CLI to the latest version").action(async () => {
464416
464631
  const isUpdated = await checkForTsciUpdates();
464417
464632
  if (!isUpdated) {
464418
- console.log(kleur_default.green("You are already using the latest version of tsci."));
464633
+ console.log(kleur_default.green(`You are already using the latest version of tsci (v${currentCliVersion()})`));
464419
464634
  }
464420
464635
  });
464421
464636
  }