@formspec/build 0.1.0-alpha.51 → 0.1.0-alpha.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2401,8 +2401,22 @@ var init_resolve_custom_type = __esm({
2401
2401
  }
2402
2402
  });
2403
2403
 
2404
- // src/analyzer/tsdoc-parser.ts
2404
+ // src/analyzer/builtin-brands.ts
2405
2405
  import * as ts3 from "typescript";
2406
+ function isIntegerBrandedType(type) {
2407
+ if (!type.isIntersection()) return false;
2408
+ if (!type.types.some((member) => !!(member.flags & ts3.TypeFlags.Number))) return false;
2409
+ return collectBrandIdentifiers(type).includes("__integerBrand");
2410
+ }
2411
+ var init_builtin_brands = __esm({
2412
+ "src/analyzer/builtin-brands.ts"() {
2413
+ "use strict";
2414
+ init_ts_type_utils();
2415
+ }
2416
+ });
2417
+
2418
+ // src/analyzer/tsdoc-parser.ts
2419
+ import * as ts4 from "typescript";
2406
2420
  import {
2407
2421
  checkSyntheticTagApplication,
2408
2422
  choosePreferredPayloadText,
@@ -2410,6 +2424,7 @@ import {
2410
2424
  getTagDefinition as getTagDefinition2,
2411
2425
  hasTypeSemanticCapability,
2412
2426
  normalizeFormSpecTagName as normalizeFormSpecTagName2,
2427
+ stripNullishUnion as stripNullishUnion2,
2413
2428
  parseConstraintTagValue,
2414
2429
  parseDefaultValueTagValue,
2415
2430
  parseTagSyntax,
@@ -2443,23 +2458,23 @@ function getExtensionTypeNames(registry) {
2443
2458
  function collectImportedNames(sourceFile) {
2444
2459
  const importedNames = /* @__PURE__ */ new Set();
2445
2460
  for (const statement of sourceFile.statements) {
2446
- if (ts3.isImportDeclaration(statement) && statement.importClause !== void 0) {
2461
+ if (ts4.isImportDeclaration(statement) && statement.importClause !== void 0) {
2447
2462
  const clause = statement.importClause;
2448
2463
  if (clause.name !== void 0) {
2449
2464
  importedNames.add(clause.name.text);
2450
2465
  }
2451
2466
  if (clause.namedBindings !== void 0) {
2452
- if (ts3.isNamedImports(clause.namedBindings)) {
2467
+ if (ts4.isNamedImports(clause.namedBindings)) {
2453
2468
  for (const specifier of clause.namedBindings.elements) {
2454
2469
  importedNames.add(specifier.name.text);
2455
2470
  }
2456
- } else if (ts3.isNamespaceImport(clause.namedBindings)) {
2471
+ } else if (ts4.isNamespaceImport(clause.namedBindings)) {
2457
2472
  importedNames.add(clause.namedBindings.name.text);
2458
2473
  }
2459
2474
  }
2460
2475
  continue;
2461
2476
  }
2462
- if (ts3.isImportEqualsDeclaration(statement)) {
2477
+ if (ts4.isImportEqualsDeclaration(statement)) {
2463
2478
  importedNames.add(statement.name.text);
2464
2479
  }
2465
2480
  }
@@ -2467,13 +2482,13 @@ function collectImportedNames(sourceFile) {
2467
2482
  }
2468
2483
  function isNonReferenceIdentifier(node) {
2469
2484
  const parent = node.parent;
2470
- if ((ts3.isBindingElement(parent) || ts3.isClassDeclaration(parent) || ts3.isEnumDeclaration(parent) || ts3.isEnumMember(parent) || ts3.isFunctionDeclaration(parent) || ts3.isFunctionExpression(parent) || ts3.isImportClause(parent) || ts3.isImportEqualsDeclaration(parent) || ts3.isImportSpecifier(parent) || ts3.isInterfaceDeclaration(parent) || ts3.isMethodDeclaration(parent) || ts3.isMethodSignature(parent) || ts3.isModuleDeclaration(parent) || ts3.isNamespaceExport(parent) || ts3.isNamespaceImport(parent) || ts3.isParameter(parent) || ts3.isPropertyDeclaration(parent) || ts3.isPropertySignature(parent) || ts3.isSetAccessorDeclaration(parent) || ts3.isGetAccessorDeclaration(parent) || ts3.isTypeAliasDeclaration(parent) || ts3.isTypeParameterDeclaration(parent) || ts3.isVariableDeclaration(parent)) && parent.name === node) {
2485
+ if ((ts4.isBindingElement(parent) || ts4.isClassDeclaration(parent) || ts4.isEnumDeclaration(parent) || ts4.isEnumMember(parent) || ts4.isFunctionDeclaration(parent) || ts4.isFunctionExpression(parent) || ts4.isImportClause(parent) || ts4.isImportEqualsDeclaration(parent) || ts4.isImportSpecifier(parent) || ts4.isInterfaceDeclaration(parent) || ts4.isMethodDeclaration(parent) || ts4.isMethodSignature(parent) || ts4.isModuleDeclaration(parent) || ts4.isNamespaceExport(parent) || ts4.isNamespaceImport(parent) || ts4.isParameter(parent) || ts4.isPropertyDeclaration(parent) || ts4.isPropertySignature(parent) || ts4.isSetAccessorDeclaration(parent) || ts4.isGetAccessorDeclaration(parent) || ts4.isTypeAliasDeclaration(parent) || ts4.isTypeParameterDeclaration(parent) || ts4.isVariableDeclaration(parent)) && parent.name === node) {
2471
2486
  return true;
2472
2487
  }
2473
- if ((ts3.isPropertyAssignment(parent) || ts3.isPropertyAccessExpression(parent)) && parent.name === node) {
2488
+ if ((ts4.isPropertyAssignment(parent) || ts4.isPropertyAccessExpression(parent)) && parent.name === node) {
2474
2489
  return true;
2475
2490
  }
2476
- if (ts3.isQualifiedName(parent) && parent.right === node) {
2491
+ if (ts4.isQualifiedName(parent) && parent.right === node) {
2477
2492
  return true;
2478
2493
  }
2479
2494
  return false;
@@ -2487,11 +2502,11 @@ function statementReferencesImportedName(statement, importedNames) {
2487
2502
  if (referencesImportedName) {
2488
2503
  return;
2489
2504
  }
2490
- if (ts3.isIdentifier(node) && importedNames.has(node.text) && !isNonReferenceIdentifier(node)) {
2505
+ if (ts4.isIdentifier(node) && importedNames.has(node.text) && !isNonReferenceIdentifier(node)) {
2491
2506
  referencesImportedName = true;
2492
2507
  return;
2493
2508
  }
2494
- ts3.forEachChild(node, visit);
2509
+ ts4.forEachChild(node, visit);
2495
2510
  };
2496
2511
  visit(statement);
2497
2512
  return referencesImportedName;
@@ -2502,9 +2517,9 @@ function buildSupportingDeclarations(sourceFile, extensionTypeNames) {
2502
2517
  [...importedNames].filter((name) => !extensionTypeNames.has(name))
2503
2518
  );
2504
2519
  return sourceFile.statements.filter((statement) => {
2505
- if (ts3.isImportDeclaration(statement)) return false;
2506
- if (ts3.isImportEqualsDeclaration(statement)) return false;
2507
- if (ts3.isExportDeclaration(statement) && statement.moduleSpecifier !== void 0)
2520
+ if (ts4.isImportDeclaration(statement)) return false;
2521
+ if (ts4.isImportEqualsDeclaration(statement)) return false;
2522
+ if (ts4.isExportDeclaration(statement) && statement.moduleSpecifier !== void 0)
2508
2523
  return false;
2509
2524
  if (statementReferencesImportedName(statement, importedNamesToSkip)) {
2510
2525
  return false;
@@ -2600,7 +2615,7 @@ function stripHintNullishUnion(type) {
2600
2615
  return type;
2601
2616
  }
2602
2617
  const nonNullish = type.types.filter(
2603
- (member) => (member.flags & (ts3.TypeFlags.Null | ts3.TypeFlags.Undefined)) === 0
2618
+ (member) => (member.flags & (ts4.TypeFlags.Null | ts4.TypeFlags.Undefined)) === 0
2604
2619
  );
2605
2620
  if (nonNullish.length === 1 && nonNullish[0] !== void 0) {
2606
2621
  return nonNullish[0];
@@ -2616,10 +2631,10 @@ function isUserEmittableHintProperty(property, declaration) {
2616
2631
  }
2617
2632
  if ("name" in declaration && declaration.name !== void 0) {
2618
2633
  const name = declaration.name;
2619
- if (ts3.isComputedPropertyName(name) || ts3.isPrivateIdentifier(name)) {
2634
+ if (ts4.isComputedPropertyName(name) || ts4.isPrivateIdentifier(name)) {
2620
2635
  return false;
2621
2636
  }
2622
- if (!ts3.isIdentifier(name) && !ts3.isStringLiteral(name) && !ts3.isNumericLiteral(name)) {
2637
+ if (!ts4.isIdentifier(name) && !ts4.isStringLiteral(name) && !ts4.isNumericLiteral(name)) {
2623
2638
  return false;
2624
2639
  }
2625
2640
  }
@@ -2837,6 +2852,9 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2837
2852
  }
2838
2853
  const hasBroadening = (() => {
2839
2854
  if (target === null) {
2855
+ if (isIntegerBrandedType(stripNullishUnion2(subjectType)) && definition.capabilities.includes("numeric-comparable")) {
2856
+ return true;
2857
+ }
2840
2858
  return hasBuiltinConstraintBroadening(tagName, options);
2841
2859
  }
2842
2860
  const registry = options?.extensionRegistry;
@@ -2988,12 +3006,12 @@ function parseTSDocTags(node, file = "", options) {
2988
3006
  const sourceText = sourceFile.getFullText();
2989
3007
  const extensionTypeNames = getExtensionTypeNames(options?.extensionRegistry);
2990
3008
  const supportingDeclarations = buildSupportingDeclarations(sourceFile, extensionTypeNames);
2991
- const commentRanges = ts3.getLeadingCommentRanges(sourceText, node.getFullStart());
3009
+ const commentRanges = ts4.getLeadingCommentRanges(sourceText, node.getFullStart());
2992
3010
  const rawTextFallbacks = collectRawTextFallbacks(node, file);
2993
3011
  const extensionTagNames = getExtensionTagNames(options);
2994
3012
  if (commentRanges) {
2995
3013
  for (const range of commentRanges) {
2996
- if (range.kind !== ts3.SyntaxKind.MultiLineCommentTrivia) {
3014
+ if (range.kind !== ts4.SyntaxKind.MultiLineCommentTrivia) {
2997
3015
  continue;
2998
3016
  }
2999
3017
  const commentText = sourceText.substring(range.pos, range.end);
@@ -3150,10 +3168,10 @@ function extractDisplayNameMetadata(node) {
3150
3168
  const memberDisplayNames = /* @__PURE__ */ new Map();
3151
3169
  const sourceFile = node.getSourceFile();
3152
3170
  const sourceText = sourceFile.getFullText();
3153
- const commentRanges = ts3.getLeadingCommentRanges(sourceText, node.getFullStart());
3171
+ const commentRanges = ts4.getLeadingCommentRanges(sourceText, node.getFullStart());
3154
3172
  if (commentRanges) {
3155
3173
  for (const range of commentRanges) {
3156
- if (range.kind !== ts3.SyntaxKind.MultiLineCommentTrivia) continue;
3174
+ if (range.kind !== ts4.SyntaxKind.MultiLineCommentTrivia) continue;
3157
3175
  const commentText = sourceText.substring(range.pos, range.end);
3158
3176
  if (!commentText.startsWith("/**")) continue;
3159
3177
  const unified = parseUnifiedComment(commentText);
@@ -3178,7 +3196,7 @@ function extractDisplayNameMetadata(node) {
3178
3196
  }
3179
3197
  function collectRawTextFallbacks(node, file) {
3180
3198
  const fallbacks = /* @__PURE__ */ new Map();
3181
- for (const tag of ts3.getJSDocTags(node)) {
3199
+ for (const tag of ts4.getJSDocTags(node)) {
3182
3200
  const tagName = normalizeConstraintTagName2(tag.tagName.text);
3183
3201
  if (!TAGS_REQUIRING_RAW_TEXT.has(tagName)) continue;
3184
3202
  const commentText = getTagCommentText(tag)?.trim() ?? "";
@@ -3233,14 +3251,15 @@ function getTagCommentText(tag) {
3233
3251
  if (typeof tag.comment === "string") {
3234
3252
  return tag.comment;
3235
3253
  }
3236
- return ts3.getTextOfJSDocComment(tag.comment);
3254
+ return ts4.getTextOfJSDocComment(tag.comment);
3237
3255
  }
3238
3256
  var SYNTHETIC_TYPE_FORMAT_FLAGS, MAX_HINT_CANDIDATES, MAX_HINT_DEPTH, parseResultCache;
3239
3257
  var init_tsdoc_parser = __esm({
3240
3258
  "src/analyzer/tsdoc-parser.ts"() {
3241
3259
  "use strict";
3242
3260
  init_resolve_custom_type();
3243
- SYNTHETIC_TYPE_FORMAT_FLAGS = ts3.TypeFormatFlags.NoTruncation | ts3.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
3261
+ init_builtin_brands();
3262
+ SYNTHETIC_TYPE_FORMAT_FLAGS = ts4.TypeFormatFlags.NoTruncation | ts4.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
3244
3263
  MAX_HINT_CANDIDATES = 5;
3245
3264
  MAX_HINT_DEPTH = 3;
3246
3265
  parseResultCache = /* @__PURE__ */ new Map();
@@ -3248,7 +3267,7 @@ var init_tsdoc_parser = __esm({
3248
3267
  });
3249
3268
 
3250
3269
  // src/analyzer/jsdoc-constraints.ts
3251
- import * as ts4 from "typescript";
3270
+ import * as ts5 from "typescript";
3252
3271
  function extractJSDocParseResult(node, file = "", options) {
3253
3272
  return parseTSDocTags(node, file, options);
3254
3273
  }
@@ -3263,18 +3282,18 @@ function extractJSDocAnnotationNodes(node, file = "", options) {
3263
3282
  function extractDefaultValueAnnotation(initializer, file = "") {
3264
3283
  if (!initializer) return null;
3265
3284
  let value;
3266
- if (ts4.isStringLiteral(initializer)) {
3285
+ if (ts5.isStringLiteral(initializer)) {
3267
3286
  value = initializer.text;
3268
- } else if (ts4.isNumericLiteral(initializer)) {
3287
+ } else if (ts5.isNumericLiteral(initializer)) {
3269
3288
  value = Number(initializer.text);
3270
- } else if (initializer.kind === ts4.SyntaxKind.TrueKeyword) {
3289
+ } else if (initializer.kind === ts5.SyntaxKind.TrueKeyword) {
3271
3290
  value = true;
3272
- } else if (initializer.kind === ts4.SyntaxKind.FalseKeyword) {
3291
+ } else if (initializer.kind === ts5.SyntaxKind.FalseKeyword) {
3273
3292
  value = false;
3274
- } else if (initializer.kind === ts4.SyntaxKind.NullKeyword) {
3293
+ } else if (initializer.kind === ts5.SyntaxKind.NullKeyword) {
3275
3294
  value = null;
3276
- } else if (ts4.isPrefixUnaryExpression(initializer)) {
3277
- if (initializer.operator === ts4.SyntaxKind.MinusToken && ts4.isNumericLiteral(initializer.operand)) {
3295
+ } else if (ts5.isPrefixUnaryExpression(initializer)) {
3296
+ if (initializer.operator === ts5.SyntaxKind.MinusToken && ts5.isNumericLiteral(initializer.operand)) {
3278
3297
  value = -Number(initializer.operand.text);
3279
3298
  }
3280
3299
  }
@@ -3301,44 +3320,34 @@ var init_jsdoc_constraints = __esm({
3301
3320
  });
3302
3321
 
3303
3322
  // src/analyzer/class-analyzer.ts
3304
- import * as ts5 from "typescript";
3323
+ import * as ts6 from "typescript";
3305
3324
  import {
3306
3325
  analyzeMetadataForNodeWithChecker,
3307
3326
  parseCommentBlock
3308
3327
  } from "@formspec/analysis/internal";
3309
3328
  function isObjectType(type) {
3310
- return !!(type.flags & ts5.TypeFlags.Object);
3329
+ return !!(type.flags & ts6.TypeFlags.Object);
3311
3330
  }
3312
3331
  function isIntersectionType(type) {
3313
- return !!(type.flags & ts5.TypeFlags.Intersection);
3314
- }
3315
- function isIntegerBrandedType(type) {
3316
- if (!type.isIntersection()) {
3317
- return false;
3318
- }
3319
- const hasNumberBase = type.types.some((member) => !!(member.flags & ts5.TypeFlags.Number));
3320
- if (!hasNumberBase) {
3321
- return false;
3322
- }
3323
- return collectBrandIdentifiers(type).includes("__integerBrand");
3332
+ return !!(type.flags & ts6.TypeFlags.Intersection);
3324
3333
  }
3325
3334
  function isResolvableObjectLikeAliasTypeNode(typeNode) {
3326
- if (ts5.isParenthesizedTypeNode(typeNode)) {
3335
+ if (ts6.isParenthesizedTypeNode(typeNode)) {
3327
3336
  return isResolvableObjectLikeAliasTypeNode(typeNode.type);
3328
3337
  }
3329
- if (ts5.isTypeLiteralNode(typeNode) || ts5.isTypeReferenceNode(typeNode)) {
3338
+ if (ts6.isTypeLiteralNode(typeNode) || ts6.isTypeReferenceNode(typeNode)) {
3330
3339
  return true;
3331
3340
  }
3332
- return ts5.isIntersectionTypeNode(typeNode) && typeNode.types.length > 0 && typeNode.types.every((member) => isResolvableObjectLikeAliasTypeNode(member));
3341
+ return ts6.isIntersectionTypeNode(typeNode) && typeNode.types.length > 0 && typeNode.types.every((member) => isResolvableObjectLikeAliasTypeNode(member));
3333
3342
  }
3334
3343
  function isSemanticallyPlainObjectLikeType(type, checker) {
3335
3344
  if (isIntersectionType(type)) {
3336
3345
  return type.types.length > 0 && type.types.every((member) => isSemanticallyPlainObjectLikeType(member, checker));
3337
3346
  }
3338
- return isObjectType(type) && checker.getSignaturesOfType(type, ts5.SignatureKind.Call).length === 0 && checker.getSignaturesOfType(type, ts5.SignatureKind.Construct).length === 0 && !checker.isArrayType(type) && !checker.isTupleType(type);
3347
+ return isObjectType(type) && checker.getSignaturesOfType(type, ts6.SignatureKind.Call).length === 0 && checker.getSignaturesOfType(type, ts6.SignatureKind.Construct).length === 0 && !checker.isArrayType(type) && !checker.isTupleType(type);
3339
3348
  }
3340
3349
  function isTypeReference(type) {
3341
- return !!(type.flags & ts5.TypeFlags.Object) && !!(type.objectFlags & ts5.ObjectFlags.Reference);
3350
+ return !!(type.flags & ts6.TypeFlags.Object) && !!(type.objectFlags & ts6.ObjectFlags.Reference);
3342
3351
  }
3343
3352
  function makeParseOptions(extensionRegistry, fieldType, checker, subjectType, hostType) {
3344
3353
  if (extensionRegistry === void 0 && fieldType === void 0 && checker === void 0 && subjectType === void 0 && hostType === void 0) {
@@ -3398,7 +3407,7 @@ function resolveNodeMetadata(metadataPolicy, declarationKind, logicalName, node,
3398
3407
  function analyzeDeclarationRootInfo(declaration, checker, file = "", extensionRegistry, metadataPolicy) {
3399
3408
  const normalizedMetadataPolicy = createAnalyzerMetadataPolicy(metadataPolicy);
3400
3409
  const declarationType = checker.getTypeAtLocation(declaration);
3401
- const logicalName = ts5.isClassDeclaration(declaration) ? declaration.name?.text ?? "AnonymousClass" : declaration.name.text;
3410
+ const logicalName = ts6.isClassDeclaration(declaration) ? declaration.name?.text ?? "AnonymousClass" : declaration.name.text;
3402
3411
  const docResult = extractJSDocParseResult(
3403
3412
  declaration,
3404
3413
  file,
@@ -3446,7 +3455,7 @@ function analyzeClassToIR(classDecl, checker, file = "", extensionRegistry, meta
3446
3455
  const instanceMethods = [];
3447
3456
  const staticMethods = [];
3448
3457
  for (const member of classDecl.members) {
3449
- if (ts5.isPropertyDeclaration(member)) {
3458
+ if (ts6.isPropertyDeclaration(member)) {
3450
3459
  const fieldNode = analyzeFieldToIR(
3451
3460
  member,
3452
3461
  checker,
@@ -3462,10 +3471,10 @@ function analyzeClassToIR(classDecl, checker, file = "", extensionRegistry, meta
3462
3471
  fields.push(fieldNode);
3463
3472
  fieldLayouts.push({});
3464
3473
  }
3465
- } else if (ts5.isMethodDeclaration(member)) {
3474
+ } else if (ts6.isMethodDeclaration(member)) {
3466
3475
  const methodInfo = analyzeMethod(member, checker);
3467
3476
  if (methodInfo) {
3468
- const isStatic = member.modifiers?.some((m) => m.kind === ts5.SyntaxKind.StaticKeyword);
3477
+ const isStatic = member.modifiers?.some((m) => m.kind === ts6.SyntaxKind.StaticKeyword);
3469
3478
  if (isStatic) {
3470
3479
  staticMethods.push(methodInfo);
3471
3480
  } else {
@@ -3528,7 +3537,7 @@ function analyzeInterfaceToIR(interfaceDecl, checker, file = "", extensionRegist
3528
3537
  diagnostics.push(...interfaceDoc.diagnostics);
3529
3538
  const visiting = /* @__PURE__ */ new Set();
3530
3539
  for (const member of interfaceDecl.members) {
3531
- if (ts5.isPropertySignature(member)) {
3540
+ if (ts6.isPropertySignature(member)) {
3532
3541
  const fieldNode = analyzeInterfacePropertyToIR(
3533
3542
  member,
3534
3543
  checker,
@@ -3586,7 +3595,7 @@ function analyzeTypeAliasToIR(typeAlias, checker, file = "", extensionRegistry,
3586
3595
  if (members === null) {
3587
3596
  const sourceFile = typeAlias.getSourceFile();
3588
3597
  const { line } = sourceFile.getLineAndCharacterOfPosition(typeAlias.getStart());
3589
- const kindDesc = ts5.SyntaxKind[typeAlias.type.kind] ?? "unknown";
3598
+ const kindDesc = ts6.SyntaxKind[typeAlias.type.kind] ?? "unknown";
3590
3599
  return {
3591
3600
  ok: false,
3592
3601
  kind: "not-object-like",
@@ -3621,7 +3630,7 @@ function analyzeTypeAliasToIR(typeAlias, checker, file = "", extensionRegistry,
3621
3630
  diagnostics.push(...typeAliasDoc.diagnostics);
3622
3631
  const visiting = /* @__PURE__ */ new Set();
3623
3632
  for (const member of members) {
3624
- if (ts5.isPropertySignature(member)) {
3633
+ if (ts6.isPropertySignature(member)) {
3625
3634
  const fieldNode = analyzeInterfacePropertyToIR(
3626
3635
  member,
3627
3636
  checker,
@@ -3688,13 +3697,13 @@ function makeAnalysisDiagnostic(code, message, primaryLocation, relatedLocations
3688
3697
  function getLeadingParsedTags(node) {
3689
3698
  const sourceFile = node.getSourceFile();
3690
3699
  const sourceText = sourceFile.getFullText();
3691
- const commentRanges = ts5.getLeadingCommentRanges(sourceText, node.getFullStart());
3700
+ const commentRanges = ts6.getLeadingCommentRanges(sourceText, node.getFullStart());
3692
3701
  if (commentRanges === void 0) {
3693
3702
  return [];
3694
3703
  }
3695
3704
  const parsedTags = [];
3696
3705
  for (const range of commentRanges) {
3697
- if (range.kind !== ts5.SyntaxKind.MultiLineCommentTrivia) {
3706
+ if (range.kind !== ts6.SyntaxKind.MultiLineCommentTrivia) {
3698
3707
  continue;
3699
3708
  }
3700
3709
  const commentText = sourceText.slice(range.pos, range.end);
@@ -3712,19 +3721,19 @@ function resolveDiscriminatorProperty(node, checker, fieldName) {
3712
3721
  return null;
3713
3722
  }
3714
3723
  const declaration = propertySymbol.valueDeclaration ?? propertySymbol.declarations?.find(
3715
- (candidate) => ts5.isPropertyDeclaration(candidate) || ts5.isPropertySignature(candidate)
3724
+ (candidate) => ts6.isPropertyDeclaration(candidate) || ts6.isPropertySignature(candidate)
3716
3725
  ) ?? propertySymbol.declarations?.[0];
3717
3726
  return {
3718
3727
  declaration,
3719
3728
  type: checker.getTypeOfSymbolAtLocation(propertySymbol, declaration ?? node),
3720
- optional: !!(propertySymbol.flags & ts5.SymbolFlags.Optional) || declaration !== void 0 && "questionToken" in declaration && declaration.questionToken !== void 0
3729
+ optional: !!(propertySymbol.flags & ts6.SymbolFlags.Optional) || declaration !== void 0 && "questionToken" in declaration && declaration.questionToken !== void 0
3721
3730
  };
3722
3731
  }
3723
3732
  function isLocalTypeParameterName(node, typeParameterName) {
3724
3733
  return node.typeParameters?.some((typeParameter) => typeParameter.name.text === typeParameterName) ?? false;
3725
3734
  }
3726
3735
  function isNullishSemanticType(type) {
3727
- if (type.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined | ts5.TypeFlags.Void | ts5.TypeFlags.Unknown | ts5.TypeFlags.Any)) {
3736
+ if (type.flags & (ts6.TypeFlags.Null | ts6.TypeFlags.Undefined | ts6.TypeFlags.Void | ts6.TypeFlags.Unknown | ts6.TypeFlags.Any)) {
3728
3737
  return true;
3729
3738
  }
3730
3739
  return type.isUnion() && type.types.some((member) => isNullishSemanticType(member));
@@ -3734,7 +3743,7 @@ function isStringLikeSemanticType(type, checker, seen = /* @__PURE__ */ new Set(
3734
3743
  return false;
3735
3744
  }
3736
3745
  seen.add(type);
3737
- if (type.flags & ts5.TypeFlags.StringLike) {
3746
+ if (type.flags & ts6.TypeFlags.StringLike) {
3738
3747
  return true;
3739
3748
  }
3740
3749
  if (type.isUnion()) {
@@ -3747,13 +3756,13 @@ function isStringLikeSemanticType(type, checker, seen = /* @__PURE__ */ new Set(
3747
3756
  return false;
3748
3757
  }
3749
3758
  function getObjectLikeTypeAliasMembers(typeNode) {
3750
- if (ts5.isParenthesizedTypeNode(typeNode)) {
3759
+ if (ts6.isParenthesizedTypeNode(typeNode)) {
3751
3760
  return getObjectLikeTypeAliasMembers(typeNode.type);
3752
3761
  }
3753
- if (ts5.isTypeLiteralNode(typeNode)) {
3762
+ if (ts6.isTypeLiteralNode(typeNode)) {
3754
3763
  return [...typeNode.members];
3755
3764
  }
3756
- if (ts5.isIntersectionTypeNode(typeNode)) {
3765
+ if (ts6.isIntersectionTypeNode(typeNode)) {
3757
3766
  const members = [];
3758
3767
  for (const intersectionMember of typeNode.types) {
3759
3768
  const resolvedMembers = getObjectLikeTypeAliasMembers(intersectionMember);
@@ -3916,7 +3925,7 @@ function resolveLiteralDiscriminatorPropertyValue(boundType, propertyName, check
3916
3925
  }
3917
3926
  if (propertyType.isUnion()) {
3918
3927
  const nonNullMembers = propertyType.types.filter(
3919
- (member) => !(member.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined))
3928
+ (member) => !(member.flags & (ts6.TypeFlags.Null | ts6.TypeFlags.Undefined))
3920
3929
  );
3921
3930
  if (nonNullMembers.length > 0 && nonNullMembers.every((member) => member.isStringLiteral())) {
3922
3931
  diagnostics.push(
@@ -3965,13 +3974,13 @@ function resolveNamedDiscriminatorDeclaration(type, checker, seen = /* @__PURE__
3965
3974
  seen.add(type);
3966
3975
  const symbol = type.aliasSymbol ?? type.getSymbol();
3967
3976
  if (symbol !== void 0) {
3968
- const aliased = symbol.flags & ts5.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : void 0;
3977
+ const aliased = symbol.flags & ts6.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : void 0;
3969
3978
  const targetSymbol = aliased ?? symbol;
3970
3979
  const declaration = targetSymbol.declarations?.find(
3971
- (candidate) => ts5.isClassDeclaration(candidate) || ts5.isInterfaceDeclaration(candidate) || ts5.isTypeAliasDeclaration(candidate) || ts5.isEnumDeclaration(candidate)
3980
+ (candidate) => ts6.isClassDeclaration(candidate) || ts6.isInterfaceDeclaration(candidate) || ts6.isTypeAliasDeclaration(candidate) || ts6.isEnumDeclaration(candidate)
3972
3981
  );
3973
3982
  if (declaration !== void 0) {
3974
- if (ts5.isTypeAliasDeclaration(declaration) && ts5.isTypeReferenceNode(declaration.type) && checker.getTypeFromTypeNode(declaration.type) !== type) {
3983
+ if (ts6.isTypeAliasDeclaration(declaration) && ts6.isTypeReferenceNode(declaration.type) && checker.getTypeFromTypeNode(declaration.type) !== type) {
3975
3984
  return resolveNamedDiscriminatorDeclaration(
3976
3985
  checker.getTypeFromTypeNode(declaration.type),
3977
3986
  checker,
@@ -3999,7 +4008,7 @@ function resolveDiscriminatorValue(boundType, fieldName, checker, provenance, di
3999
4008
  }
4000
4009
  if (boundType.isUnion()) {
4001
4010
  const nonNullMembers = boundType.types.filter(
4002
- (member) => !(member.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined))
4011
+ (member) => !(member.flags & (ts6.TypeFlags.Null | ts6.TypeFlags.Undefined))
4003
4012
  );
4004
4013
  if (nonNullMembers.every((member) => member.isStringLiteral())) {
4005
4014
  diagnostics.push(
@@ -4044,7 +4053,7 @@ function resolveDiscriminatorValue(boundType, fieldName, checker, provenance, di
4044
4053
  return null;
4045
4054
  }
4046
4055
  function getDeclarationName(node) {
4047
- if (ts5.isClassDeclaration(node) || ts5.isInterfaceDeclaration(node) || ts5.isTypeAliasDeclaration(node) || ts5.isEnumDeclaration(node)) {
4056
+ if (ts6.isClassDeclaration(node) || ts6.isInterfaceDeclaration(node) || ts6.isTypeAliasDeclaration(node) || ts6.isEnumDeclaration(node)) {
4048
4057
  return node.name?.text ?? "anonymous";
4049
4058
  }
4050
4059
  return "anonymous";
@@ -4099,11 +4108,11 @@ function extractReferenceTypeArguments(type, checker, file, typeRegistry, visiti
4099
4108
  if (sourceTypeNode === void 0) {
4100
4109
  return [];
4101
4110
  }
4102
- const unwrapParentheses = (typeNode) => ts5.isParenthesizedTypeNode(typeNode) ? unwrapParentheses(typeNode.type) : typeNode;
4111
+ const unwrapParentheses = (typeNode) => ts6.isParenthesizedTypeNode(typeNode) ? unwrapParentheses(typeNode.type) : typeNode;
4103
4112
  const directTypeNode = unwrapParentheses(sourceTypeNode);
4104
- const referenceTypeNode = ts5.isTypeReferenceNode(directTypeNode) ? directTypeNode : (() => {
4113
+ const referenceTypeNode = ts6.isTypeReferenceNode(directTypeNode) ? directTypeNode : (() => {
4105
4114
  const resolvedTypeNode = resolveAliasedTypeNode(directTypeNode, checker);
4106
- return ts5.isTypeReferenceNode(resolvedTypeNode) ? resolvedTypeNode : null;
4115
+ return ts6.isTypeReferenceNode(resolvedTypeNode) ? resolvedTypeNode : null;
4107
4116
  })();
4108
4117
  if (referenceTypeNode?.typeArguments === void 0) {
4109
4118
  return [];
@@ -4158,7 +4167,7 @@ function applyDiscriminatorToObjectProperties(properties, node, subjectType, che
4158
4167
  );
4159
4168
  }
4160
4169
  function analyzeFieldToIR(prop, checker, file, typeRegistry, visiting, diagnostics, hostType, metadataPolicy, extensionRegistry) {
4161
- if (!ts5.isIdentifier(prop.name)) {
4170
+ if (!ts6.isIdentifier(prop.name)) {
4162
4171
  return null;
4163
4172
  }
4164
4173
  const name = prop.name.text;
@@ -4285,7 +4294,7 @@ function findDuplicateObjectLikeTypeAliasPropertyNames(members) {
4285
4294
  const seen = /* @__PURE__ */ new Set();
4286
4295
  const duplicates = /* @__PURE__ */ new Set();
4287
4296
  for (const member of members) {
4288
- if (!ts5.isPropertySignature(member)) {
4297
+ if (!ts6.isPropertySignature(member)) {
4289
4298
  continue;
4290
4299
  }
4291
4300
  const name = getAnalyzableObjectLikePropertyName(member.name);
@@ -4301,7 +4310,7 @@ function findDuplicateObjectLikeTypeAliasPropertyNames(members) {
4301
4310
  return [...duplicates].sort();
4302
4311
  }
4303
4312
  function getAnalyzableObjectLikePropertyName(name) {
4304
- if (ts5.isIdentifier(name) || ts5.isStringLiteral(name) || ts5.isNumericLiteral(name)) {
4313
+ if (ts6.isIdentifier(name) || ts6.isStringLiteral(name) || ts6.isNumericLiteral(name)) {
4305
4314
  return name.text;
4306
4315
  }
4307
4316
  return null;
@@ -4399,25 +4408,25 @@ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode
4399
4408
  if (isIntegerBrandedType(type)) {
4400
4409
  return { kind: "primitive", primitiveKind: "integer" };
4401
4410
  }
4402
- if (type.flags & ts5.TypeFlags.String) {
4411
+ if (type.flags & ts6.TypeFlags.String) {
4403
4412
  return { kind: "primitive", primitiveKind: "string" };
4404
4413
  }
4405
- if (type.flags & ts5.TypeFlags.Number) {
4414
+ if (type.flags & ts6.TypeFlags.Number) {
4406
4415
  return { kind: "primitive", primitiveKind: "number" };
4407
4416
  }
4408
- if (type.flags & (ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral)) {
4417
+ if (type.flags & (ts6.TypeFlags.BigInt | ts6.TypeFlags.BigIntLiteral)) {
4409
4418
  return { kind: "primitive", primitiveKind: "bigint" };
4410
4419
  }
4411
- if (type.flags & ts5.TypeFlags.Boolean) {
4420
+ if (type.flags & ts6.TypeFlags.Boolean) {
4412
4421
  return { kind: "primitive", primitiveKind: "boolean" };
4413
4422
  }
4414
- if (type.flags & ts5.TypeFlags.Null) {
4423
+ if (type.flags & ts6.TypeFlags.Null) {
4415
4424
  return { kind: "primitive", primitiveKind: "null" };
4416
4425
  }
4417
- if (type.flags & ts5.TypeFlags.Undefined) {
4426
+ if (type.flags & ts6.TypeFlags.Undefined) {
4418
4427
  return { kind: "primitive", primitiveKind: "null" };
4419
4428
  }
4420
- if (type.flags & ts5.TypeFlags.Void) {
4429
+ if (type.flags & ts6.TypeFlags.Void) {
4421
4430
  return { kind: "primitive", primitiveKind: "null" };
4422
4431
  }
4423
4432
  if (type.isStringLiteral()) {
@@ -4504,10 +4513,10 @@ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode
4504
4513
  return { kind: "primitive", primitiveKind: "string" };
4505
4514
  }
4506
4515
  function tryResolveNamedPrimitiveAlias(type, checker, file, typeRegistry, visiting, sourceNode, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics) {
4507
- if (!(type.flags & (ts5.TypeFlags.String | ts5.TypeFlags.Number | ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral | ts5.TypeFlags.Boolean | ts5.TypeFlags.Null)) && !isIntegerBrandedType(type)) {
4516
+ if (!(type.flags & (ts6.TypeFlags.String | ts6.TypeFlags.Number | ts6.TypeFlags.BigInt | ts6.TypeFlags.BigIntLiteral | ts6.TypeFlags.Boolean | ts6.TypeFlags.Null)) && !isIntegerBrandedType(type)) {
4508
4517
  return null;
4509
4518
  }
4510
- const aliasDecl = type.aliasSymbol?.declarations?.find(ts5.isTypeAliasDeclaration) ?? getReferencedTypeAliasDeclaration(sourceNode, checker);
4519
+ const aliasDecl = type.aliasSymbol?.declarations?.find(ts6.isTypeAliasDeclaration) ?? getReferencedTypeAliasDeclaration(sourceNode, checker);
4511
4520
  if (!aliasDecl) {
4512
4521
  return null;
4513
4522
  }
@@ -4557,14 +4566,14 @@ function tryResolveNamedPrimitiveAlias(type, checker, file, typeRegistry, visiti
4557
4566
  return { kind: "reference", name: aliasName, typeArguments: [] };
4558
4567
  }
4559
4568
  function getReferencedTypeAliasDeclaration(sourceNode, checker) {
4560
- const typeNode = sourceNode && (ts5.isPropertyDeclaration(sourceNode) || ts5.isPropertySignature(sourceNode) || ts5.isParameter(sourceNode)) ? sourceNode.type : void 0;
4561
- if (!typeNode || !ts5.isTypeReferenceNode(typeNode)) {
4569
+ const typeNode = sourceNode && (ts6.isPropertyDeclaration(sourceNode) || ts6.isPropertySignature(sourceNode) || ts6.isParameter(sourceNode)) ? sourceNode.type : void 0;
4570
+ if (!typeNode || !ts6.isTypeReferenceNode(typeNode)) {
4562
4571
  return void 0;
4563
4572
  }
4564
4573
  return getTypeAliasDeclarationFromTypeReference(typeNode, checker);
4565
4574
  }
4566
4575
  function shouldEmitPrimitiveAliasDefinition(typeNode, checker) {
4567
- if (!ts5.isTypeReferenceNode(typeNode)) {
4576
+ if (!ts6.isTypeReferenceNode(typeNode)) {
4568
4577
  return false;
4569
4578
  }
4570
4579
  const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
@@ -4572,10 +4581,10 @@ function shouldEmitPrimitiveAliasDefinition(typeNode, checker) {
4572
4581
  return false;
4573
4582
  }
4574
4583
  const resolved = checker.getTypeFromTypeNode(aliasDecl.type);
4575
- return !!(resolved.flags & (ts5.TypeFlags.String | ts5.TypeFlags.Number | ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral | ts5.TypeFlags.Boolean | ts5.TypeFlags.Null));
4584
+ return !!(resolved.flags & (ts6.TypeFlags.String | ts6.TypeFlags.Number | ts6.TypeFlags.BigInt | ts6.TypeFlags.BigIntLiteral | ts6.TypeFlags.Boolean | ts6.TypeFlags.Null));
4576
4585
  }
4577
4586
  function resolveAliasedPrimitiveTarget(type, checker, file, typeRegistry, visiting, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics, visitedAliases = /* @__PURE__ */ new Set()) {
4578
- const nestedAliasDecl = type.aliasSymbol?.declarations?.find(ts5.isTypeAliasDeclaration);
4587
+ const nestedAliasDecl = type.aliasSymbol?.declarations?.find(ts6.isTypeAliasDeclaration);
4579
4588
  if (nestedAliasDecl !== void 0 && !visitedAliases.has(nestedAliasDecl)) {
4580
4589
  visitedAliases.add(nestedAliasDecl);
4581
4590
  return resolveAliasedPrimitiveTarget(
@@ -4593,19 +4602,19 @@ function resolveAliasedPrimitiveTarget(type, checker, file, typeRegistry, visiti
4593
4602
  if (isIntegerBrandedType(type)) {
4594
4603
  return { kind: "primitive", primitiveKind: "integer" };
4595
4604
  }
4596
- if (type.flags & ts5.TypeFlags.String) {
4605
+ if (type.flags & ts6.TypeFlags.String) {
4597
4606
  return { kind: "primitive", primitiveKind: "string" };
4598
4607
  }
4599
- if (type.flags & ts5.TypeFlags.Number) {
4608
+ if (type.flags & ts6.TypeFlags.Number) {
4600
4609
  return { kind: "primitive", primitiveKind: "number" };
4601
4610
  }
4602
- if (type.flags & (ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral)) {
4611
+ if (type.flags & (ts6.TypeFlags.BigInt | ts6.TypeFlags.BigIntLiteral)) {
4603
4612
  return { kind: "primitive", primitiveKind: "bigint" };
4604
4613
  }
4605
- if (type.flags & ts5.TypeFlags.Boolean) {
4614
+ if (type.flags & ts6.TypeFlags.Boolean) {
4606
4615
  return { kind: "primitive", primitiveKind: "boolean" };
4607
4616
  }
4608
- if (type.flags & ts5.TypeFlags.Null) {
4617
+ if (type.flags & ts6.TypeFlags.Null) {
4609
4618
  return { kind: "primitive", primitiveKind: "null" };
4610
4619
  }
4611
4620
  return resolveTypeNode(
@@ -4632,13 +4641,13 @@ function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNod
4632
4641
  (memberTypeNode) => !isNullishTypeNode(resolveAliasedTypeNode(memberTypeNode, checker))
4633
4642
  );
4634
4643
  const nonNullTypes = allTypes.filter(
4635
- (memberType) => !(memberType.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined))
4644
+ (memberType) => !(memberType.flags & (ts6.TypeFlags.Null | ts6.TypeFlags.Undefined))
4636
4645
  );
4637
4646
  const nonNullMembers = nonNullTypes.map((memberType, index) => ({
4638
4647
  memberType,
4639
4648
  sourceNode: nonNullSourceNodes.length === nonNullTypes.length ? nonNullSourceNodes[index] : void 0
4640
4649
  }));
4641
- const hasNull = allTypes.some((t) => t.flags & ts5.TypeFlags.Null);
4650
+ const hasNull = allTypes.some((t) => t.flags & ts6.TypeFlags.Null);
4642
4651
  const memberDisplayNames = /* @__PURE__ */ new Map();
4643
4652
  if (namedDecl) {
4644
4653
  for (const [value, label] of extractDisplayNameMetadata(namedDecl).memberDisplayNames) {
@@ -4681,7 +4690,7 @@ function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNod
4681
4690
  const displayName = memberDisplayNames.get(String(value));
4682
4691
  return displayName !== void 0 ? { value, displayName } : { value };
4683
4692
  });
4684
- const isBooleanUnion2 = nonNullTypes.length === 2 && nonNullTypes.every((t) => t.flags & ts5.TypeFlags.BooleanLiteral);
4693
+ const isBooleanUnion2 = nonNullTypes.length === 2 && nonNullTypes.every((t) => t.flags & ts6.TypeFlags.BooleanLiteral);
4685
4694
  if (isBooleanUnion2) {
4686
4695
  const boolNode = { kind: "primitive", primitiveKind: "boolean" };
4687
4696
  const result = hasNull ? {
@@ -4773,7 +4782,7 @@ function tryResolveRecordType(type, checker, file, typeRegistry, visiting, metad
4773
4782
  if (type.getProperties().length > 0) {
4774
4783
  return null;
4775
4784
  }
4776
- const indexInfo = checker.getIndexInfoOfType(type, ts5.IndexKind.String);
4785
+ const indexInfo = checker.getIndexInfoOfType(type, ts6.IndexKind.String);
4777
4786
  if (!indexInfo) {
4778
4787
  return null;
4779
4788
  }
@@ -4821,10 +4830,10 @@ function shouldEmitResolvedObjectProperty(property, declaration) {
4821
4830
  }
4822
4831
  if (declaration !== void 0 && "name" in declaration && declaration.name !== void 0) {
4823
4832
  const name = declaration.name;
4824
- if (ts5.isComputedPropertyName(name) || ts5.isPrivateIdentifier(name)) {
4833
+ if (ts6.isComputedPropertyName(name) || ts6.isPrivateIdentifier(name)) {
4825
4834
  return false;
4826
4835
  }
4827
- if (!ts5.isIdentifier(name) && !ts5.isStringLiteral(name) && !ts5.isNumericLiteral(name)) {
4836
+ if (!ts6.isIdentifier(name) && !ts6.isStringLiteral(name) && !ts6.isNumericLiteral(name)) {
4828
4837
  return false;
4829
4838
  }
4830
4839
  }
@@ -4950,7 +4959,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
4950
4959
  if (!declaration) continue;
4951
4960
  if (!shouldEmitResolvedObjectProperty(prop, declaration)) continue;
4952
4961
  const propType = checker.getTypeOfSymbolAtLocation(prop, declaration);
4953
- const optional = !!(prop.flags & ts5.SymbolFlags.Optional);
4962
+ const optional = !!(prop.flags & ts6.SymbolFlags.Optional);
4954
4963
  const propTypeNode = resolveTypeNode(
4955
4964
  propType,
4956
4965
  checker,
@@ -4963,7 +4972,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
4963
4972
  collectedDiagnostics
4964
4973
  );
4965
4974
  const fieldNodeInfo = fieldInfoMap?.get(prop.name);
4966
- const inlineFieldNodeInfo = fieldNodeInfo === void 0 ? ts5.isPropertySignature(declaration) ? analyzeInterfacePropertyToIR(
4975
+ const inlineFieldNodeInfo = fieldNodeInfo === void 0 ? ts6.isPropertySignature(declaration) ? analyzeInterfacePropertyToIR(
4967
4976
  declaration,
4968
4977
  checker,
4969
4978
  file,
@@ -4973,7 +4982,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
4973
4982
  type,
4974
4983
  metadataPolicy,
4975
4984
  extensionRegistry
4976
- ) : ts5.isPropertyDeclaration(declaration) ? analyzeFieldToIR(
4985
+ ) : ts6.isPropertyDeclaration(declaration) ? analyzeFieldToIR(
4977
4986
  declaration,
4978
4987
  checker,
4979
4988
  file,
@@ -5001,7 +5010,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5001
5010
  visiting.delete(type);
5002
5011
  const objectNode = {
5003
5012
  kind: "object",
5004
- properties: namedDecl !== void 0 && (ts5.isClassDeclaration(namedDecl) || ts5.isInterfaceDeclaration(namedDecl) || ts5.isTypeAliasDeclaration(namedDecl)) ? applyDiscriminatorToObjectProperties(
5013
+ properties: namedDecl !== void 0 && (ts6.isClassDeclaration(namedDecl) || ts6.isInterfaceDeclaration(namedDecl) || ts6.isTypeAliasDeclaration(namedDecl)) ? applyDiscriminatorToObjectProperties(
5005
5014
  properties,
5006
5015
  namedDecl,
5007
5016
  type,
@@ -5049,12 +5058,12 @@ function getNamedTypeFieldNodeInfoMap(type, checker, file, typeRegistry, visitin
5049
5058
  for (const symbol of symbols) {
5050
5059
  const declarations = symbol.declarations;
5051
5060
  if (!declarations) continue;
5052
- const classDecl = declarations.find(ts5.isClassDeclaration);
5061
+ const classDecl = declarations.find(ts6.isClassDeclaration);
5053
5062
  if (classDecl) {
5054
5063
  const map = /* @__PURE__ */ new Map();
5055
5064
  const hostType = checker.getTypeAtLocation(classDecl);
5056
5065
  for (const member of classDecl.members) {
5057
- if (ts5.isPropertyDeclaration(member) && ts5.isIdentifier(member.name)) {
5066
+ if (ts6.isPropertyDeclaration(member) && ts6.isIdentifier(member.name)) {
5058
5067
  const fieldNode = analyzeFieldToIR(
5059
5068
  member,
5060
5069
  checker,
@@ -5078,7 +5087,7 @@ function getNamedTypeFieldNodeInfoMap(type, checker, file, typeRegistry, visitin
5078
5087
  }
5079
5088
  return map;
5080
5089
  }
5081
- const interfaceDecl = declarations.find(ts5.isInterfaceDeclaration);
5090
+ const interfaceDecl = declarations.find(ts6.isInterfaceDeclaration);
5082
5091
  if (interfaceDecl) {
5083
5092
  return buildFieldNodeInfoMap(
5084
5093
  interfaceDecl.members,
@@ -5092,7 +5101,7 @@ function getNamedTypeFieldNodeInfoMap(type, checker, file, typeRegistry, visitin
5092
5101
  extensionRegistry
5093
5102
  );
5094
5103
  }
5095
- const typeAliasDecl = declarations.find(ts5.isTypeAliasDeclaration);
5104
+ const typeAliasDecl = declarations.find(ts6.isTypeAliasDeclaration);
5096
5105
  const typeAliasMembers = typeAliasDecl === void 0 ? null : getObjectLikeTypeAliasMembers(typeAliasDecl.type);
5097
5106
  if (typeAliasDecl && typeAliasMembers !== null) {
5098
5107
  return buildFieldNodeInfoMap(
@@ -5116,10 +5125,10 @@ function extractArrayElementTypeNode(sourceNode, checker) {
5116
5125
  return void 0;
5117
5126
  }
5118
5127
  const resolvedTypeNode = resolveAliasedTypeNode(typeNode, checker);
5119
- if (ts5.isArrayTypeNode(resolvedTypeNode)) {
5128
+ if (ts6.isArrayTypeNode(resolvedTypeNode)) {
5120
5129
  return resolvedTypeNode.elementType;
5121
5130
  }
5122
- if (ts5.isTypeReferenceNode(resolvedTypeNode) && ts5.isIdentifier(resolvedTypeNode.typeName) && resolvedTypeNode.typeName.text === "Array" && resolvedTypeNode.typeArguments?.[0]) {
5131
+ if (ts6.isTypeReferenceNode(resolvedTypeNode) && ts6.isIdentifier(resolvedTypeNode.typeName) && resolvedTypeNode.typeName.text === "Array" && resolvedTypeNode.typeArguments?.[0]) {
5123
5132
  return resolvedTypeNode.typeArguments[0];
5124
5133
  }
5125
5134
  return void 0;
@@ -5130,13 +5139,13 @@ function extractUnionMemberTypeNodes(sourceNode, checker) {
5130
5139
  return [];
5131
5140
  }
5132
5141
  const resolvedTypeNode = resolveAliasedTypeNode(typeNode, checker);
5133
- return ts5.isUnionTypeNode(resolvedTypeNode) ? [...resolvedTypeNode.types] : [];
5142
+ return ts6.isUnionTypeNode(resolvedTypeNode) ? [...resolvedTypeNode.types] : [];
5134
5143
  }
5135
5144
  function resolveAliasedTypeNode(typeNode, checker, visited = /* @__PURE__ */ new Set()) {
5136
- if (ts5.isParenthesizedTypeNode(typeNode)) {
5145
+ if (ts6.isParenthesizedTypeNode(typeNode)) {
5137
5146
  return resolveAliasedTypeNode(typeNode.type, checker, visited);
5138
5147
  }
5139
- if (!ts5.isTypeReferenceNode(typeNode) || !ts5.isIdentifier(typeNode.typeName)) {
5148
+ if (!ts6.isTypeReferenceNode(typeNode) || !ts6.isIdentifier(typeNode.typeName)) {
5140
5149
  return typeNode;
5141
5150
  }
5142
5151
  const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
@@ -5147,15 +5156,15 @@ function resolveAliasedTypeNode(typeNode, checker, visited = /* @__PURE__ */ new
5147
5156
  return resolveAliasedTypeNode(aliasDecl.type, checker, visited);
5148
5157
  }
5149
5158
  function isNullishTypeNode(typeNode) {
5150
- if (typeNode.kind === ts5.SyntaxKind.NullKeyword || typeNode.kind === ts5.SyntaxKind.UndefinedKeyword) {
5159
+ if (typeNode.kind === ts6.SyntaxKind.NullKeyword || typeNode.kind === ts6.SyntaxKind.UndefinedKeyword) {
5151
5160
  return true;
5152
5161
  }
5153
- return ts5.isLiteralTypeNode(typeNode) && (typeNode.literal.kind === ts5.SyntaxKind.NullKeyword || typeNode.literal.kind === ts5.SyntaxKind.UndefinedKeyword);
5162
+ return ts6.isLiteralTypeNode(typeNode) && (typeNode.literal.kind === ts6.SyntaxKind.NullKeyword || typeNode.literal.kind === ts6.SyntaxKind.UndefinedKeyword);
5154
5163
  }
5155
5164
  function buildFieldNodeInfoMap(members, checker, file, typeRegistry, visiting, metadataPolicy, hostType, diagnostics, extensionRegistry) {
5156
5165
  const map = /* @__PURE__ */ new Map();
5157
5166
  for (const member of members) {
5158
- if (ts5.isPropertySignature(member)) {
5167
+ if (ts6.isPropertySignature(member)) {
5159
5168
  const fieldNode = analyzeInterfacePropertyToIR(
5160
5169
  member,
5161
5170
  checker,
@@ -5180,7 +5189,7 @@ function buildFieldNodeInfoMap(members, checker, file, typeRegistry, visiting, m
5180
5189
  return map;
5181
5190
  }
5182
5191
  function extractTypeAliasConstraintNodes(typeNode, checker, file, extensionRegistry, depth = 0) {
5183
- if (!ts5.isTypeReferenceNode(typeNode)) return [];
5192
+ if (!ts6.isTypeReferenceNode(typeNode)) return [];
5184
5193
  if (depth >= MAX_ALIAS_CHAIN_DEPTH) {
5185
5194
  const aliasName = typeNode.typeName.getText();
5186
5195
  throw new Error(
@@ -5189,7 +5198,7 @@ function extractTypeAliasConstraintNodes(typeNode, checker, file, extensionRegis
5189
5198
  }
5190
5199
  const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
5191
5200
  if (!aliasDecl) return [];
5192
- if (ts5.isTypeLiteralNode(aliasDecl.type)) return [];
5201
+ if (ts6.isTypeLiteralNode(aliasDecl.type)) return [];
5193
5202
  const aliasFieldType = resolveTypeNode(
5194
5203
  checker.getTypeAtLocation(aliasDecl.type),
5195
5204
  checker,
@@ -5233,14 +5242,14 @@ function getNamedTypeName(type) {
5233
5242
  const symbol = type.getSymbol();
5234
5243
  if (symbol?.declarations) {
5235
5244
  const decl = symbol.declarations[0];
5236
- if (decl && (ts5.isClassDeclaration(decl) || ts5.isInterfaceDeclaration(decl) || ts5.isTypeAliasDeclaration(decl))) {
5237
- const name = ts5.isClassDeclaration(decl) ? decl.name?.text : decl.name.text;
5245
+ if (decl && (ts6.isClassDeclaration(decl) || ts6.isInterfaceDeclaration(decl) || ts6.isTypeAliasDeclaration(decl))) {
5246
+ const name = ts6.isClassDeclaration(decl) ? decl.name?.text : decl.name.text;
5238
5247
  if (name) return name;
5239
5248
  }
5240
5249
  }
5241
5250
  const aliasSymbol = type.aliasSymbol;
5242
5251
  if (aliasSymbol?.declarations) {
5243
- const aliasDecl = aliasSymbol.declarations.find(ts5.isTypeAliasDeclaration);
5252
+ const aliasDecl = aliasSymbol.declarations.find(ts6.isTypeAliasDeclaration);
5244
5253
  if (aliasDecl) {
5245
5254
  return aliasDecl.name.text;
5246
5255
  }
@@ -5251,24 +5260,24 @@ function getNamedTypeDeclaration(type) {
5251
5260
  const symbol = type.getSymbol();
5252
5261
  if (symbol?.declarations) {
5253
5262
  const decl = symbol.declarations[0];
5254
- if (decl && (ts5.isClassDeclaration(decl) || ts5.isInterfaceDeclaration(decl) || ts5.isTypeAliasDeclaration(decl))) {
5263
+ if (decl && (ts6.isClassDeclaration(decl) || ts6.isInterfaceDeclaration(decl) || ts6.isTypeAliasDeclaration(decl))) {
5255
5264
  return decl;
5256
5265
  }
5257
5266
  }
5258
5267
  const aliasSymbol = type.aliasSymbol;
5259
5268
  if (aliasSymbol?.declarations) {
5260
- return aliasSymbol.declarations.find(ts5.isTypeAliasDeclaration);
5269
+ return aliasSymbol.declarations.find(ts6.isTypeAliasDeclaration);
5261
5270
  }
5262
5271
  return void 0;
5263
5272
  }
5264
5273
  function analyzeMethod(method, checker) {
5265
- if (!ts5.isIdentifier(method.name)) {
5274
+ if (!ts6.isIdentifier(method.name)) {
5266
5275
  return null;
5267
5276
  }
5268
5277
  const name = method.name.text;
5269
5278
  const parameters = [];
5270
5279
  for (const param of method.parameters) {
5271
- if (ts5.isIdentifier(param.name)) {
5280
+ if (ts6.isIdentifier(param.name)) {
5272
5281
  const paramInfo = analyzeParameter(param, checker);
5273
5282
  parameters.push(paramInfo);
5274
5283
  }
@@ -5279,7 +5288,7 @@ function analyzeMethod(method, checker) {
5279
5288
  return { name, parameters, returnTypeNode, returnType };
5280
5289
  }
5281
5290
  function analyzeParameter(param, checker) {
5282
- const name = ts5.isIdentifier(param.name) ? param.name.text : "param";
5291
+ const name = ts6.isIdentifier(param.name) ? param.name.text : "param";
5283
5292
  const typeNode = param.type;
5284
5293
  const type = checker.getTypeAtLocation(param);
5285
5294
  const formSpecExportName = detectFormSpecReference(typeNode);
@@ -5288,15 +5297,15 @@ function analyzeParameter(param, checker) {
5288
5297
  }
5289
5298
  function detectFormSpecReference(typeNode) {
5290
5299
  if (!typeNode) return null;
5291
- if (!ts5.isTypeReferenceNode(typeNode)) return null;
5292
- const typeName = ts5.isIdentifier(typeNode.typeName) ? typeNode.typeName.text : ts5.isQualifiedName(typeNode.typeName) ? typeNode.typeName.right.text : null;
5300
+ if (!ts6.isTypeReferenceNode(typeNode)) return null;
5301
+ const typeName = ts6.isIdentifier(typeNode.typeName) ? typeNode.typeName.text : ts6.isQualifiedName(typeNode.typeName) ? typeNode.typeName.right.text : null;
5293
5302
  if (typeName !== "InferSchema" && typeName !== "InferFormSchema") return null;
5294
5303
  const typeArg = typeNode.typeArguments?.[0];
5295
- if (!typeArg || !ts5.isTypeQueryNode(typeArg)) return null;
5296
- if (ts5.isIdentifier(typeArg.exprName)) {
5304
+ if (!typeArg || !ts6.isTypeQueryNode(typeArg)) return null;
5305
+ if (ts6.isIdentifier(typeArg.exprName)) {
5297
5306
  return typeArg.exprName.text;
5298
5307
  }
5299
- if (ts5.isQualifiedName(typeArg.exprName)) {
5308
+ if (ts6.isQualifiedName(typeArg.exprName)) {
5300
5309
  return typeArg.exprName.right.text;
5301
5310
  }
5302
5311
  return null;
@@ -5309,6 +5318,7 @@ var init_class_analyzer = __esm({
5309
5318
  init_tsdoc_parser();
5310
5319
  init_resolve_custom_type();
5311
5320
  init_ts_type_utils();
5321
+ init_builtin_brands();
5312
5322
  init_metadata();
5313
5323
  RESOLVING_TYPE_PLACEHOLDER = {
5314
5324
  kind: "object",
@@ -5320,7 +5330,7 @@ var init_class_analyzer = __esm({
5320
5330
  });
5321
5331
 
5322
5332
  // src/analyzer/program.ts
5323
- import * as ts6 from "typescript";
5333
+ import * as ts7 from "typescript";
5324
5334
  import * as path from "path";
5325
5335
  function createProgramContextFromProgram(program, filePath) {
5326
5336
  const absolutePath = path.resolve(filePath);
@@ -5337,23 +5347,23 @@ function createProgramContextFromProgram(program, filePath) {
5337
5347
  function createProgramContext(filePath, additionalFiles) {
5338
5348
  const absolutePath = path.resolve(filePath);
5339
5349
  const fileDir = path.dirname(absolutePath);
5340
- const configPath = ts6.findConfigFile(fileDir, ts6.sys.fileExists.bind(ts6.sys), "tsconfig.json");
5350
+ const configPath = ts7.findConfigFile(fileDir, ts7.sys.fileExists.bind(ts7.sys), "tsconfig.json");
5341
5351
  let compilerOptions;
5342
5352
  let fileNames;
5343
5353
  if (configPath) {
5344
- const configFile = ts6.readConfigFile(configPath, ts6.sys.readFile.bind(ts6.sys));
5354
+ const configFile = ts7.readConfigFile(configPath, ts7.sys.readFile.bind(ts7.sys));
5345
5355
  if (configFile.error) {
5346
5356
  throw new Error(
5347
- `Error reading tsconfig.json: ${ts6.flattenDiagnosticMessageText(configFile.error.messageText, "\n")}`
5357
+ `Error reading tsconfig.json: ${ts7.flattenDiagnosticMessageText(configFile.error.messageText, "\n")}`
5348
5358
  );
5349
5359
  }
5350
- const parsed = ts6.parseJsonConfigFileContent(
5360
+ const parsed = ts7.parseJsonConfigFileContent(
5351
5361
  configFile.config,
5352
- ts6.sys,
5362
+ ts7.sys,
5353
5363
  path.dirname(configPath)
5354
5364
  );
5355
5365
  if (parsed.errors.length > 0) {
5356
- const errorMessages = parsed.errors.map((e) => ts6.flattenDiagnosticMessageText(e.messageText, "\n")).join("\n");
5366
+ const errorMessages = parsed.errors.map((e) => ts7.flattenDiagnosticMessageText(e.messageText, "\n")).join("\n");
5357
5367
  throw new Error(`Error parsing tsconfig.json: ${errorMessages}`);
5358
5368
  }
5359
5369
  compilerOptions = parsed.options;
@@ -5361,9 +5371,9 @@ function createProgramContext(filePath, additionalFiles) {
5361
5371
  fileNames = [.../* @__PURE__ */ new Set([...parsed.fileNames, absolutePath, ...normalizedAdditional])];
5362
5372
  } else {
5363
5373
  compilerOptions = {
5364
- target: ts6.ScriptTarget.ES2022,
5365
- module: ts6.ModuleKind.NodeNext,
5366
- moduleResolution: ts6.ModuleResolutionKind.NodeNext,
5374
+ target: ts7.ScriptTarget.ES2022,
5375
+ module: ts7.ModuleKind.NodeNext,
5376
+ moduleResolution: ts7.ModuleResolutionKind.NodeNext,
5367
5377
  strict: true,
5368
5378
  skipLibCheck: true,
5369
5379
  declaration: true
@@ -5371,7 +5381,7 @@ function createProgramContext(filePath, additionalFiles) {
5371
5381
  const normalizedAdditional = (additionalFiles ?? []).map((f) => path.resolve(f));
5372
5382
  fileNames = [.../* @__PURE__ */ new Set([absolutePath, ...normalizedAdditional])];
5373
5383
  }
5374
- const program = ts6.createProgram(fileNames, compilerOptions);
5384
+ const program = ts7.createProgram(fileNames, compilerOptions);
5375
5385
  const sourceFile = program.getSourceFile(absolutePath);
5376
5386
  if (!sourceFile) {
5377
5387
  throw new Error(`Could not find source file: ${absolutePath}`);
@@ -5390,19 +5400,19 @@ function findNodeByName(sourceFile, name, predicate, getName) {
5390
5400
  result = node;
5391
5401
  return;
5392
5402
  }
5393
- ts6.forEachChild(node, visit);
5403
+ ts7.forEachChild(node, visit);
5394
5404
  }
5395
5405
  visit(sourceFile);
5396
5406
  return result;
5397
5407
  }
5398
5408
  function findClassByName(sourceFile, className) {
5399
- return findNodeByName(sourceFile, className, ts6.isClassDeclaration, (n) => n.name?.text);
5409
+ return findNodeByName(sourceFile, className, ts7.isClassDeclaration, (n) => n.name?.text);
5400
5410
  }
5401
5411
  function findInterfaceByName(sourceFile, interfaceName) {
5402
- return findNodeByName(sourceFile, interfaceName, ts6.isInterfaceDeclaration, (n) => n.name.text);
5412
+ return findNodeByName(sourceFile, interfaceName, ts7.isInterfaceDeclaration, (n) => n.name.text);
5403
5413
  }
5404
5414
  function findTypeAliasByName(sourceFile, aliasName) {
5405
- return findNodeByName(sourceFile, aliasName, ts6.isTypeAliasDeclaration, (n) => n.name.text);
5415
+ return findNodeByName(sourceFile, aliasName, ts7.isTypeAliasDeclaration, (n) => n.name.text);
5406
5416
  }
5407
5417
  function getResolvedObjectRootType(rootType, typeRegistry) {
5408
5418
  if (rootType.kind === "object") {
@@ -5442,22 +5452,22 @@ function createResolvedObjectAliasAnalysis(name, rootType, typeRegistry, rootInf
5442
5452
  };
5443
5453
  }
5444
5454
  function containsTypeReferenceInObjectLikeAlias(typeNode) {
5445
- if (ts6.isParenthesizedTypeNode(typeNode)) {
5455
+ if (ts7.isParenthesizedTypeNode(typeNode)) {
5446
5456
  return containsTypeReferenceInObjectLikeAlias(typeNode.type);
5447
5457
  }
5448
- if (ts6.isTypeReferenceNode(typeNode)) {
5458
+ if (ts7.isTypeReferenceNode(typeNode)) {
5449
5459
  return true;
5450
5460
  }
5451
- return ts6.isIntersectionTypeNode(typeNode) && typeNode.types.some((member) => containsTypeReferenceInObjectLikeAlias(member));
5461
+ return ts7.isIntersectionTypeNode(typeNode) && typeNode.types.some((member) => containsTypeReferenceInObjectLikeAlias(member));
5452
5462
  }
5453
5463
  function collectFallbackAliasMemberPropertyNames(typeNode, checker) {
5454
- if (ts6.isParenthesizedTypeNode(typeNode)) {
5464
+ if (ts7.isParenthesizedTypeNode(typeNode)) {
5455
5465
  return collectFallbackAliasMemberPropertyNames(typeNode.type, checker);
5456
5466
  }
5457
- if (ts6.isTypeLiteralNode(typeNode)) {
5467
+ if (ts7.isTypeLiteralNode(typeNode)) {
5458
5468
  const propertyNames = [];
5459
5469
  for (const member of typeNode.members) {
5460
- if (!ts6.isPropertySignature(member)) {
5470
+ if (!ts7.isPropertySignature(member)) {
5461
5471
  continue;
5462
5472
  }
5463
5473
  const propertyName = getAnalyzableObjectLikePropertyName(member.name);
@@ -5467,13 +5477,13 @@ function collectFallbackAliasMemberPropertyNames(typeNode, checker) {
5467
5477
  }
5468
5478
  return propertyNames;
5469
5479
  }
5470
- if (ts6.isTypeReferenceNode(typeNode)) {
5480
+ if (ts7.isTypeReferenceNode(typeNode)) {
5471
5481
  return checker.getTypeFromTypeNode(typeNode).getProperties().map((property) => property.getName());
5472
5482
  }
5473
5483
  return null;
5474
5484
  }
5475
5485
  function findFallbackAliasDuplicatePropertyNames(typeNode, checker) {
5476
- if (!ts6.isIntersectionTypeNode(typeNode)) {
5486
+ if (!ts7.isIntersectionTypeNode(typeNode)) {
5477
5487
  return [];
5478
5488
  }
5479
5489
  const seen = /* @__PURE__ */ new Set();
@@ -5680,7 +5690,7 @@ var init_program = __esm({
5680
5690
  });
5681
5691
 
5682
5692
  // src/extensions/symbol-registry.ts
5683
- import * as ts7 from "typescript";
5693
+ import * as ts8 from "typescript";
5684
5694
  import * as path2 from "path";
5685
5695
  function buildSymbolMapFromConfig(configPath, program, checker, extensionRegistry) {
5686
5696
  const symbolMap = /* @__PURE__ */ new Map();
@@ -5690,10 +5700,10 @@ function buildSymbolMapFromConfig(configPath, program, checker, extensionRegistr
5690
5700
  return symbolMap;
5691
5701
  }
5692
5702
  function visit(node) {
5693
- if (ts7.isCallExpression(node) && isDefineCustomTypeCall(node, checker)) {
5703
+ if (ts8.isCallExpression(node) && isDefineCustomTypeCall(node, checker)) {
5694
5704
  processDefineCustomTypeCall(node);
5695
5705
  }
5696
- ts7.forEachChild(node, visit);
5706
+ ts8.forEachChild(node, visit);
5697
5707
  }
5698
5708
  function processDefineCustomTypeCall(call) {
5699
5709
  const typeArgNode = call.typeArguments?.[0];
@@ -5730,7 +5740,7 @@ function isDefineCustomTypeCall(node, checker) {
5730
5740
  if (node.typeArguments === void 0 || node.typeArguments.length === 0) return false;
5731
5741
  const callSymbol = checker.getSymbolAtLocation(node.expression);
5732
5742
  if (callSymbol !== void 0) {
5733
- const resolved = callSymbol.flags & ts7.SymbolFlags.Alias ? checker.getAliasedSymbol(callSymbol) : callSymbol;
5743
+ const resolved = callSymbol.flags & ts8.SymbolFlags.Alias ? checker.getAliasedSymbol(callSymbol) : callSymbol;
5734
5744
  const decl = resolved.declarations?.[0];
5735
5745
  if (decl !== void 0) {
5736
5746
  const sourceFile = decl.getSourceFile().fileName.replace(/\\/g, "/");
@@ -5738,24 +5748,24 @@ function isDefineCustomTypeCall(node, checker) {
5738
5748
  (sourceFile.includes("@formspec/core") || sourceFile.includes("/packages/core/"));
5739
5749
  }
5740
5750
  }
5741
- return ts7.isIdentifier(node.expression) && node.expression.text === "defineCustomType";
5751
+ return ts8.isIdentifier(node.expression) && node.expression.text === "defineCustomType";
5742
5752
  }
5743
5753
  function extractTypeNameFromCallArg(call) {
5744
5754
  const arg = call.arguments[0];
5745
- if (arg === void 0 || !ts7.isObjectLiteralExpression(arg)) {
5755
+ if (arg === void 0 || !ts8.isObjectLiteralExpression(arg)) {
5746
5756
  return null;
5747
5757
  }
5748
5758
  const typeNameProp = arg.properties.find(
5749
- (p) => ts7.isPropertyAssignment(p) && ts7.isIdentifier(p.name) && p.name.text === "typeName"
5759
+ (p) => ts8.isPropertyAssignment(p) && ts8.isIdentifier(p.name) && p.name.text === "typeName"
5750
5760
  );
5751
- if (typeNameProp === void 0 || !ts7.isStringLiteral(typeNameProp.initializer)) {
5761
+ if (typeNameProp === void 0 || !ts8.isStringLiteral(typeNameProp.initializer)) {
5752
5762
  return null;
5753
5763
  }
5754
5764
  return typeNameProp.initializer.text;
5755
5765
  }
5756
5766
  function extractEnclosingExtensionId(call, checker) {
5757
- for (let node = call.parent; !ts7.isSourceFile(node); node = node.parent) {
5758
- if (ts7.isCallExpression(node) && isDefineExtensionCall(node, checker)) {
5767
+ for (let node = call.parent; !ts8.isSourceFile(node); node = node.parent) {
5768
+ if (ts8.isCallExpression(node) && isDefineExtensionCall(node, checker)) {
5759
5769
  return extractExtensionIdFromCallArg(node);
5760
5770
  }
5761
5771
  }
@@ -5764,24 +5774,24 @@ function extractEnclosingExtensionId(call, checker) {
5764
5774
  function isDefineExtensionCall(node, checker) {
5765
5775
  const callSymbol = checker.getSymbolAtLocation(node.expression);
5766
5776
  if (callSymbol !== void 0) {
5767
- const resolved = callSymbol.flags & ts7.SymbolFlags.Alias ? checker.getAliasedSymbol(callSymbol) : callSymbol;
5777
+ const resolved = callSymbol.flags & ts8.SymbolFlags.Alias ? checker.getAliasedSymbol(callSymbol) : callSymbol;
5768
5778
  const decl = resolved.declarations?.[0];
5769
5779
  if (decl !== void 0) {
5770
5780
  const sourceFile = decl.getSourceFile().fileName.replace(/\\/g, "/");
5771
5781
  return resolved.name === "defineExtension" && (sourceFile.includes("@formspec/core") || sourceFile.includes("/packages/core/"));
5772
5782
  }
5773
5783
  }
5774
- return ts7.isIdentifier(node.expression) && node.expression.text === "defineExtension";
5784
+ return ts8.isIdentifier(node.expression) && node.expression.text === "defineExtension";
5775
5785
  }
5776
5786
  function extractExtensionIdFromCallArg(call) {
5777
5787
  const arg = call.arguments[0];
5778
- if (arg === void 0 || !ts7.isObjectLiteralExpression(arg)) {
5788
+ if (arg === void 0 || !ts8.isObjectLiteralExpression(arg)) {
5779
5789
  return null;
5780
5790
  }
5781
5791
  const prop = arg.properties.find(
5782
- (p) => ts7.isPropertyAssignment(p) && ts7.isIdentifier(p.name) && p.name.text === "extensionId"
5792
+ (p) => ts8.isPropertyAssignment(p) && ts8.isIdentifier(p.name) && p.name.text === "extensionId"
5783
5793
  );
5784
- if (prop === void 0 || !ts7.isStringLiteral(prop.initializer)) {
5794
+ if (prop === void 0 || !ts8.isStringLiteral(prop.initializer)) {
5785
5795
  return null;
5786
5796
  }
5787
5797
  return prop.initializer.text;
@@ -5893,7 +5903,7 @@ var init_validate = __esm({
5893
5903
  });
5894
5904
 
5895
5905
  // src/generators/class-schema.ts
5896
- import * as ts8 from "typescript";
5906
+ import * as ts9 from "typescript";
5897
5907
  function generateClassSchemas(analysis, source, options) {
5898
5908
  const result = generateClassSchemasDetailed(analysis, source, options);
5899
5909
  if (!result.ok || result.jsonSchema === void 0 || result.uiSchema === void 0) {
@@ -6063,7 +6073,7 @@ function generateSchemasBatch(options) {
6063
6073
  return options.targets.map((target) => {
6064
6074
  let ctx;
6065
6075
  try {
6066
- const cacheKey = ts8.sys.useCaseSensitiveFileNames ? target.filePath : target.filePath.toLowerCase();
6076
+ const cacheKey = ts9.sys.useCaseSensitiveFileNames ? target.filePath : target.filePath.toLowerCase();
6067
6077
  const cachedContext = contextCache.get(cacheKey);
6068
6078
  if (cachedContext === void 0) {
6069
6079
  const additionalFiles = options.configPath !== void 0 ? [options.configPath] : void 0;
@@ -6232,7 +6242,7 @@ var init_class_schema = __esm({
6232
6242
  });
6233
6243
 
6234
6244
  // src/static-build.ts
6235
- import * as ts9 from "typescript";
6245
+ import * as ts10 from "typescript";
6236
6246
  function toStaticBuildContext(context) {
6237
6247
  return context;
6238
6248
  }
@@ -6247,7 +6257,7 @@ function getModuleSymbol(context) {
6247
6257
  return context.checker.getSymbolAtLocation(context.sourceFile) ?? sourceFileWithSymbol.symbol;
6248
6258
  }
6249
6259
  function isSchemaSourceDeclaration(declaration) {
6250
- return ts9.isClassDeclaration(declaration) || ts9.isInterfaceDeclaration(declaration) || ts9.isTypeAliasDeclaration(declaration);
6260
+ return ts10.isClassDeclaration(declaration) || ts10.isInterfaceDeclaration(declaration) || ts10.isTypeAliasDeclaration(declaration);
6251
6261
  }
6252
6262
  function resolveModuleExport(context, exportName = "default") {
6253
6263
  const moduleSymbol = getModuleSymbol(context);
@@ -6258,7 +6268,7 @@ function resolveModuleExport(context, exportName = "default") {
6258
6268
  if (exportSymbol === null) {
6259
6269
  return null;
6260
6270
  }
6261
- return exportSymbol.flags & ts9.SymbolFlags.Alias ? context.checker.getAliasedSymbol(exportSymbol) : exportSymbol;
6271
+ return exportSymbol.flags & ts10.SymbolFlags.Alias ? context.checker.getAliasedSymbol(exportSymbol) : exportSymbol;
6262
6272
  }
6263
6273
  function resolveModuleExportDeclaration(context, exportName = "default") {
6264
6274
  return resolveModuleExport(context, exportName)?.declarations?.find(isSchemaSourceDeclaration) ?? null;
@@ -6271,7 +6281,7 @@ var init_static_build = __esm({
6271
6281
  });
6272
6282
 
6273
6283
  // src/generators/discovered-schema.ts
6274
- import * as ts10 from "typescript";
6284
+ import * as ts11 from "typescript";
6275
6285
  import { analyzeMetadataForNodeWithChecker as analyzeMetadataForNodeWithChecker2 } from "@formspec/analysis/internal";
6276
6286
  import { IR_VERSION as IR_VERSION3 } from "@formspec/core/internals";
6277
6287
  function toDiscoveredTypeSchemas(result, resolvedMetadata) {
@@ -6281,17 +6291,17 @@ function toDiscoveredTypeSchemas(result, resolvedMetadata) {
6281
6291
  };
6282
6292
  }
6283
6293
  function isNamedTypeDeclaration(declaration) {
6284
- return ts10.isClassDeclaration(declaration) || ts10.isInterfaceDeclaration(declaration) || ts10.isTypeAliasDeclaration(declaration);
6294
+ return ts11.isClassDeclaration(declaration) || ts11.isInterfaceDeclaration(declaration) || ts11.isTypeAliasDeclaration(declaration);
6285
6295
  }
6286
6296
  function hasConcreteTypeArguments(type, checker) {
6287
6297
  if ("aliasTypeArguments" in type && Array.isArray(type.aliasTypeArguments) && type.aliasTypeArguments.length > 0) {
6288
6298
  return true;
6289
6299
  }
6290
- if ((type.flags & ts10.TypeFlags.Object) === 0) {
6300
+ if ((type.flags & ts11.TypeFlags.Object) === 0) {
6291
6301
  return false;
6292
6302
  }
6293
6303
  const objectType = type;
6294
- if ((objectType.objectFlags & ts10.ObjectFlags.Reference) === 0) {
6304
+ if ((objectType.objectFlags & ts11.ObjectFlags.Reference) === 0) {
6295
6305
  return false;
6296
6306
  }
6297
6307
  return checker.getTypeArguments(objectType).length > 0;
@@ -6304,13 +6314,13 @@ function getNamedTypeDeclaration2(type) {
6304
6314
  return declaration;
6305
6315
  }
6306
6316
  }
6307
- const aliasDeclaration = type.aliasSymbol?.declarations?.find(ts10.isTypeAliasDeclaration);
6317
+ const aliasDeclaration = type.aliasSymbol?.declarations?.find(ts11.isTypeAliasDeclaration);
6308
6318
  return aliasDeclaration;
6309
6319
  }
6310
6320
  function getFallbackName(sourceNode, fallback = "AnonymousType") {
6311
6321
  if (sourceNode !== void 0 && "name" in sourceNode) {
6312
6322
  const namedNode = sourceNode;
6313
- if (namedNode.name !== void 0 && ts10.isIdentifier(namedNode.name)) {
6323
+ if (namedNode.name !== void 0 && ts11.isIdentifier(namedNode.name)) {
6314
6324
  return namedNode.name.text;
6315
6325
  }
6316
6326
  }
@@ -6532,7 +6542,7 @@ function generateSchemasFromResolvedType(options, skipNamedDeclaration = false,
6532
6542
  function generateSchemasFromDeclaration(options) {
6533
6543
  const filePath = options.declaration.getSourceFile().fileName;
6534
6544
  const resolved = resolveStaticOptions(options);
6535
- if (ts10.isClassDeclaration(options.declaration)) {
6545
+ if (ts11.isClassDeclaration(options.declaration)) {
6536
6546
  return generateSchemasFromAnalysis(
6537
6547
  analyzeClassToIR(
6538
6548
  options.declaration,
@@ -6546,7 +6556,7 @@ function generateSchemasFromDeclaration(options) {
6546
6556
  resolved
6547
6557
  );
6548
6558
  }
6549
- if (ts10.isInterfaceDeclaration(options.declaration)) {
6559
+ if (ts11.isInterfaceDeclaration(options.declaration)) {
6550
6560
  return generateSchemasFromAnalysis(
6551
6561
  analyzeInterfaceToIR(
6552
6562
  options.declaration,
@@ -6560,7 +6570,7 @@ function generateSchemasFromDeclaration(options) {
6560
6570
  resolved
6561
6571
  );
6562
6572
  }
6563
- if (ts10.isTypeAliasDeclaration(options.declaration)) {
6573
+ if (ts11.isTypeAliasDeclaration(options.declaration)) {
6564
6574
  const analyzedAlias = analyzeTypeAliasToIR(
6565
6575
  options.declaration,
6566
6576
  options.context.checker,
@@ -6619,7 +6629,7 @@ function generateSchemasFromReturnType(options) {
6619
6629
  const returnType = signature !== void 0 ? options.context.checker.getReturnTypeOfSignature(signature) : options.context.checker.getTypeAtLocation(options.declaration);
6620
6630
  const type = unwrapPromiseType(options.context.checker, returnType);
6621
6631
  const sourceNode = type !== returnType ? unwrapPromiseTypeNode(options.declaration.type) ?? options.declaration.type ?? options.declaration : options.declaration.type ?? options.declaration;
6622
- const fallbackName = options.declaration.name !== void 0 && ts10.isIdentifier(options.declaration.name) ? `${options.declaration.name.text}ReturnType` : "ReturnType";
6632
+ const fallbackName = options.declaration.name !== void 0 && ts11.isIdentifier(options.declaration.name) ? `${options.declaration.name.text}ReturnType` : "ReturnType";
6623
6633
  return generateSchemasFromResolvedType({
6624
6634
  ...options,
6625
6635
  type,
@@ -6666,14 +6676,14 @@ function unwrapPromiseTypeNode(typeNode) {
6666
6676
  if (typeNode === void 0) {
6667
6677
  return void 0;
6668
6678
  }
6669
- if (ts10.isParenthesizedTypeNode(typeNode)) {
6679
+ if (ts11.isParenthesizedTypeNode(typeNode)) {
6670
6680
  const unwrapped = unwrapPromiseTypeNode(typeNode.type);
6671
6681
  return unwrapped ?? typeNode;
6672
6682
  }
6673
6683
  return isPromiseTypeReferenceNode(typeNode) ? typeNode.typeArguments[0] : typeNode;
6674
6684
  }
6675
6685
  function isPromiseTypeReferenceNode(typeNode) {
6676
- return ts10.isTypeReferenceNode(typeNode) && ts10.isIdentifier(typeNode.typeName) && typeNode.typeName.text === "Promise" && typeNode.typeArguments !== void 0 && typeNode.typeArguments.length > 0;
6686
+ return ts11.isTypeReferenceNode(typeNode) && ts11.isIdentifier(typeNode.typeName) && typeNode.typeName.text === "Promise" && typeNode.typeArguments !== void 0 && typeNode.typeArguments.length > 0;
6677
6687
  }
6678
6688
  var init_discovered_schema = __esm({
6679
6689
  "src/generators/discovered-schema.ts"() {