@formspec/build 0.1.0-alpha.42 → 0.1.0-alpha.44

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/index.js CHANGED
@@ -1535,7 +1535,7 @@ function generateCustomType(type, ctx) {
1535
1535
  }
1536
1536
  return registration.toJsonSchema(type.payload, ctx.vendorPrefix);
1537
1537
  }
1538
- var JSON_SCHEMA_STRUCTURAL_KEYWORDS = /* @__PURE__ */ new Set([
1538
+ var VOCABULARY_MODE_BLOCKED_KEYWORDS = /* @__PURE__ */ new Set([
1539
1539
  "$schema",
1540
1540
  "$ref",
1541
1541
  "$defs",
@@ -1606,7 +1606,7 @@ function applyCustomConstraint(schema, constraint, ctx) {
1606
1606
  if (registration.emitsVocabularyKeywords) {
1607
1607
  const target = schema;
1608
1608
  for (const [key, value] of Object.entries(extensionSchema)) {
1609
- if (JSON_SCHEMA_STRUCTURAL_KEYWORDS.has(key)) {
1609
+ if (VOCABULARY_MODE_BLOCKED_KEYWORDS.has(key)) {
1610
1610
  throw new Error(
1611
1611
  `Custom constraint "${constraint.constraintId}" with emitsVocabularyKeywords must not overwrite standard JSON Schema keyword "${key}"`
1612
1612
  );
@@ -2150,7 +2150,7 @@ import * as path from "path";
2150
2150
  import * as ts3 from "typescript";
2151
2151
  import {
2152
2152
  analyzeMetadataForNodeWithChecker,
2153
- parseCommentBlock as parseCommentBlock2
2153
+ parseCommentBlock
2154
2154
  } from "@formspec/analysis/internal";
2155
2155
 
2156
2156
  // src/analyzer/jsdoc-constraints.ts
@@ -2160,73 +2160,25 @@ import * as ts2 from "typescript";
2160
2160
  import * as ts from "typescript";
2161
2161
  import {
2162
2162
  checkSyntheticTagApplication,
2163
+ choosePreferredPayloadText,
2163
2164
  extractPathTarget as extractSharedPathTarget,
2164
2165
  getTagDefinition as getTagDefinition2,
2165
2166
  hasTypeSemanticCapability,
2166
2167
  normalizeFormSpecTagName as normalizeFormSpecTagName2,
2167
2168
  parseConstraintTagValue,
2168
2169
  parseDefaultValueTagValue,
2170
+ parseTagSyntax,
2171
+ parseUnifiedComment,
2169
2172
  resolveDeclarationPlacement,
2170
2173
  resolvePathTargetType,
2171
- sliceCommentSpan,
2172
- parseCommentBlock,
2173
- parseTagSyntax
2174
+ TAGS_REQUIRING_RAW_TEXT
2174
2175
  } from "@formspec/analysis/internal";
2175
- import {
2176
- TSDocParser,
2177
- TSDocConfiguration,
2178
- TSDocTagDefinition,
2179
- TSDocTagSyntaxKind,
2180
- DocExcerpt,
2181
- DocPlainText,
2182
- DocSoftBreak,
2183
- TextRange
2184
- } from "@microsoft/tsdoc";
2185
2176
  import {
2186
2177
  BUILTIN_CONSTRAINT_DEFINITIONS as BUILTIN_CONSTRAINT_DEFINITIONS2,
2187
2178
  normalizeConstraintTagName as normalizeConstraintTagName2,
2188
2179
  isBuiltinConstraintName
2189
2180
  } from "@formspec/core/internals";
2190
2181
  import "@formspec/core/internals";
2191
- var TAGS_REQUIRING_RAW_TEXT = /* @__PURE__ */ new Set(["pattern", "enumOptions", "defaultValue"]);
2192
- function createFormSpecTSDocConfig(extensionTagNames = []) {
2193
- const config = new TSDocConfiguration();
2194
- for (const tagName of Object.keys(BUILTIN_CONSTRAINT_DEFINITIONS2)) {
2195
- config.addTagDefinition(
2196
- new TSDocTagDefinition({
2197
- tagName: "@" + tagName,
2198
- syntaxKind: TSDocTagSyntaxKind.BlockTag,
2199
- allowMultiple: true
2200
- })
2201
- );
2202
- }
2203
- for (const tagName of ["apiName", "displayName", "format", "placeholder"]) {
2204
- config.addTagDefinition(
2205
- new TSDocTagDefinition({
2206
- tagName: "@" + tagName,
2207
- syntaxKind: TSDocTagSyntaxKind.BlockTag,
2208
- allowMultiple: true
2209
- })
2210
- );
2211
- }
2212
- for (const tagName of extensionTagNames) {
2213
- config.addTagDefinition(
2214
- new TSDocTagDefinition({
2215
- tagName: "@" + tagName,
2216
- syntaxKind: TSDocTagSyntaxKind.BlockTag,
2217
- allowMultiple: true
2218
- })
2219
- );
2220
- }
2221
- return config;
2222
- }
2223
- function sharedCommentSyntaxOptions(options, offset) {
2224
- const extensions = options?.extensionRegistry?.extensions;
2225
- return {
2226
- ...offset !== void 0 ? { offset } : {},
2227
- ...extensions !== void 0 ? { extensions } : {}
2228
- };
2229
- }
2230
2182
  function sharedTagValueOptions(options) {
2231
2183
  return {
2232
2184
  ...options?.extensionRegistry !== void 0 ? { registry: options.extensionRegistry } : {},
@@ -2326,6 +2278,30 @@ function pushUniqueCompilerDiagnostics(target, additions) {
2326
2278
  target.push(diagnostic);
2327
2279
  }
2328
2280
  }
2281
+ function processConstraintTag(tagName, text, parsedTag, provenance, node, sourceFile, supportingDeclarations, options, constraints, diagnostics) {
2282
+ const compilerDiagnostics = buildCompilerBackedConstraintDiagnostics(
2283
+ node,
2284
+ sourceFile,
2285
+ tagName,
2286
+ parsedTag,
2287
+ provenance,
2288
+ supportingDeclarations,
2289
+ options
2290
+ );
2291
+ if (compilerDiagnostics.length > 0) {
2292
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2293
+ return;
2294
+ }
2295
+ const constraintNode = parseConstraintTagValue(
2296
+ tagName,
2297
+ text,
2298
+ provenance,
2299
+ sharedTagValueOptions(options)
2300
+ );
2301
+ if (constraintNode) {
2302
+ constraints.push(constraintNode);
2303
+ }
2304
+ }
2329
2305
  function renderSyntheticArgumentExpression(valueKind, argumentText) {
2330
2306
  const trimmed = argumentText.trim();
2331
2307
  if (trimmed === "") {
@@ -2611,10 +2587,9 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2611
2587
  )
2612
2588
  ];
2613
2589
  }
2614
- var parserCache = /* @__PURE__ */ new Map();
2615
2590
  var parseResultCache = /* @__PURE__ */ new Map();
2616
- function getParser(options) {
2617
- const extensionTagNames = [
2591
+ function getExtensionTagNames(options) {
2592
+ return [
2618
2593
  ...options?.extensionRegistry?.extensions.flatMap(
2619
2594
  (extension) => (extension.constraintTags ?? []).map((tag) => normalizeFormSpecTagName2(tag.tagName))
2620
2595
  ) ?? [],
@@ -2622,14 +2597,6 @@ function getParser(options) {
2622
2597
  (extension) => (extension.metadataSlots ?? []).map((slot) => normalizeFormSpecTagName2(slot.tagName))
2623
2598
  ) ?? []
2624
2599
  ].sort();
2625
- const cacheKey = extensionTagNames.join("|");
2626
- const existing = parserCache.get(cacheKey);
2627
- if (existing) {
2628
- return existing;
2629
- }
2630
- const parser = new TSDocParser(createFormSpecTSDocConfig(extensionTagNames));
2631
- parserCache.set(cacheKey, parser);
2632
- return parser;
2633
2600
  }
2634
2601
  function getExtensionRegistryCacheKey(registry) {
2635
2602
  if (registry === void 0) {
@@ -2680,13 +2647,13 @@ function parseTSDocTags(node, file = "", options) {
2680
2647
  let placeholder;
2681
2648
  let displayNameProvenance;
2682
2649
  let placeholderProvenance;
2683
- const rawTextTags = [];
2684
2650
  const sourceFile = node.getSourceFile();
2685
2651
  const sourceText = sourceFile.getFullText();
2686
2652
  const extensionTypeNames = getExtensionTypeNames(options?.extensionRegistry);
2687
2653
  const supportingDeclarations = buildSupportingDeclarations(sourceFile, extensionTypeNames);
2688
2654
  const commentRanges = ts.getLeadingCommentRanges(sourceText, node.getFullStart());
2689
2655
  const rawTextFallbacks = collectRawTextFallbacks(node, file);
2656
+ const extensionTagNames = getExtensionTagNames(options);
2690
2657
  if (commentRanges) {
2691
2658
  for (const range of commentRanges) {
2692
2659
  if (range.kind !== ts.SyntaxKind.MultiLineCommentTrivia) {
@@ -2696,38 +2663,18 @@ function parseTSDocTags(node, file = "", options) {
2696
2663
  if (!commentText.startsWith("/**")) {
2697
2664
  continue;
2698
2665
  }
2699
- const parser = getParser(options);
2700
- const parserContext = parser.parseRange(
2701
- TextRange.fromStringRange(sourceText, range.pos, range.end)
2702
- );
2703
- const docComment = parserContext.docComment;
2704
- const parsedComment = parseCommentBlock(
2705
- commentText,
2706
- sharedCommentSyntaxOptions(options, range.pos)
2707
- );
2708
- let parsedTagCursor = 0;
2709
- const nextParsedTag = (normalizedTagName) => {
2710
- while (parsedTagCursor < parsedComment.tags.length) {
2711
- const candidate = parsedComment.tags[parsedTagCursor];
2712
- parsedTagCursor += 1;
2713
- if (candidate?.normalizedTagName === normalizedTagName) {
2714
- return candidate;
2715
- }
2716
- }
2717
- return null;
2718
- };
2719
- for (const parsedTag of parsedComment.tags) {
2720
- if (TAGS_REQUIRING_RAW_TEXT.has(parsedTag.normalizedTagName)) {
2721
- rawTextTags.push({ tag: parsedTag, commentText, commentOffset: range.pos });
2722
- }
2723
- }
2724
- for (const block of docComment.customBlocks) {
2725
- const tagName = normalizeConstraintTagName2(block.blockTag.tagName.substring(1));
2726
- const parsedTag = nextParsedTag(tagName);
2666
+ const extensions = options?.extensionRegistry?.extensions;
2667
+ const unified = parseUnifiedComment(commentText, {
2668
+ offset: range.pos,
2669
+ extensionTagNames,
2670
+ ...extensions !== void 0 ? { extensions } : {}
2671
+ });
2672
+ for (const tag of unified.tags) {
2673
+ const tagName = tag.normalizedTagName;
2727
2674
  if (tagName === "displayName" || tagName === "format" || tagName === "placeholder") {
2728
- const text2 = getBestBlockPayloadText(parsedTag, commentText, range.pos, block);
2675
+ const text2 = tag.resolvedPayloadText;
2729
2676
  if (text2 === "") continue;
2730
- const provenance2 = parsedTag !== null ? provenanceForParsedTag(parsedTag, sourceFile, file) : provenanceForComment(range, sourceFile, file, tagName);
2677
+ const provenance2 = provenanceForParsedTag(tag, sourceFile, file);
2731
2678
  switch (tagName) {
2732
2679
  case "displayName":
2733
2680
  if (!isMemberTargetDisplayName(text2) && displayName === void 0) {
@@ -2752,64 +2699,69 @@ function parseTSDocTags(node, file = "", options) {
2752
2699
  }
2753
2700
  continue;
2754
2701
  }
2755
- if (TAGS_REQUIRING_RAW_TEXT.has(tagName)) continue;
2756
- const text = getBestBlockPayloadText(parsedTag, commentText, range.pos, block);
2757
- const expectedType = isBuiltinConstraintName(tagName) ? BUILTIN_CONSTRAINT_DEFINITIONS2[tagName] : void 0;
2758
- if (text === "" && expectedType !== "boolean") continue;
2759
- const provenance = parsedTag !== null ? provenanceForParsedTag(parsedTag, sourceFile, file) : provenanceForComment(range, sourceFile, file, tagName);
2760
- const compilerDiagnostics = buildCompilerBackedConstraintDiagnostics(
2761
- node,
2762
- sourceFile,
2763
- tagName,
2764
- parsedTag,
2765
- provenance,
2766
- supportingDeclarations,
2767
- options
2768
- );
2769
- if (compilerDiagnostics.length > 0) {
2770
- pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2702
+ if (TAGS_REQUIRING_RAW_TEXT.has(tagName)) {
2703
+ const fallback = rawTextFallbacks.get(tagName)?.shift();
2704
+ const text2 = choosePreferredPayloadText(tag.resolvedPayloadText, fallback?.text ?? "");
2705
+ if (text2 === "") continue;
2706
+ const provenance2 = provenanceForParsedTag(tag, sourceFile, file);
2707
+ if (tagName === "defaultValue") {
2708
+ annotations.push(parseDefaultValueTagValue(text2, provenance2));
2709
+ continue;
2710
+ }
2711
+ processConstraintTag(
2712
+ tagName,
2713
+ text2,
2714
+ tag,
2715
+ provenance2,
2716
+ node,
2717
+ sourceFile,
2718
+ supportingDeclarations,
2719
+ options,
2720
+ constraints,
2721
+ diagnostics
2722
+ );
2771
2723
  continue;
2772
2724
  }
2773
- const constraintNode = parseConstraintTagValue(
2725
+ const text = tag.resolvedPayloadText;
2726
+ const expectedType = isBuiltinConstraintName(tagName) ? BUILTIN_CONSTRAINT_DEFINITIONS2[tagName] : void 0;
2727
+ if (text === "" && expectedType !== "boolean") continue;
2728
+ const provenance = provenanceForParsedTag(tag, sourceFile, file);
2729
+ processConstraintTag(
2774
2730
  tagName,
2775
2731
  text,
2732
+ tag,
2776
2733
  provenance,
2777
- sharedTagValueOptions(options)
2734
+ node,
2735
+ sourceFile,
2736
+ supportingDeclarations,
2737
+ options,
2738
+ constraints,
2739
+ diagnostics
2778
2740
  );
2779
- if (constraintNode) {
2780
- constraints.push(constraintNode);
2781
- }
2782
2741
  }
2783
- if (docComment.deprecatedBlock !== void 0) {
2784
- const message = extractBlockText(docComment.deprecatedBlock).trim();
2742
+ if (unified.isDeprecated) {
2785
2743
  annotations.push({
2786
2744
  kind: "annotation",
2787
2745
  annotationKind: "deprecated",
2788
- ...message !== "" && { message },
2746
+ ...unified.deprecationMessage !== "" && { message: unified.deprecationMessage },
2789
2747
  provenance: provenanceForComment(range, sourceFile, file, "deprecated")
2790
2748
  });
2791
2749
  }
2792
- {
2793
- const summary = extractPlainText(docComment.summarySection).trim();
2794
- if (summary !== "") {
2795
- annotations.push({
2796
- kind: "annotation",
2797
- annotationKind: "description",
2798
- value: summary,
2799
- provenance: provenanceForComment(range, sourceFile, file, "summary")
2800
- });
2801
- }
2750
+ if (unified.summaryText !== "") {
2751
+ annotations.push({
2752
+ kind: "annotation",
2753
+ annotationKind: "description",
2754
+ value: unified.summaryText,
2755
+ provenance: provenanceForComment(range, sourceFile, file, "summary")
2756
+ });
2802
2757
  }
2803
- if (docComment.remarksBlock !== void 0) {
2804
- const remarksText = extractBlockText(docComment.remarksBlock).trim();
2805
- if (remarksText !== "") {
2806
- annotations.push({
2807
- kind: "annotation",
2808
- annotationKind: "remarks",
2809
- value: remarksText,
2810
- provenance: provenanceForComment(range, sourceFile, file, "remarks")
2811
- });
2812
- }
2758
+ if (unified.remarksText !== "") {
2759
+ annotations.push({
2760
+ kind: "annotation",
2761
+ annotationKind: "remarks",
2762
+ value: unified.remarksText,
2763
+ provenance: provenanceForComment(range, sourceFile, file, "remarks")
2764
+ });
2813
2765
  }
2814
2766
  }
2815
2767
  }
@@ -2829,77 +2781,27 @@ function parseTSDocTags(node, file = "", options) {
2829
2781
  provenance: placeholderProvenance
2830
2782
  });
2831
2783
  }
2832
- if (rawTextTags.length > 0) {
2833
- for (const rawTextTag of rawTextTags) {
2834
- const fallbackQueue = rawTextFallbacks.get(rawTextTag.tag.normalizedTagName);
2835
- const fallback = fallbackQueue?.shift();
2836
- const text = choosePreferredPayloadText(
2837
- getSharedPayloadText(rawTextTag.tag, rawTextTag.commentText, rawTextTag.commentOffset),
2838
- fallback?.text ?? ""
2839
- );
2840
- if (text === "") continue;
2841
- const provenance = provenanceForParsedTag(rawTextTag.tag, sourceFile, file);
2842
- if (rawTextTag.tag.normalizedTagName === "defaultValue") {
2843
- const defaultValueNode = parseDefaultValueTagValue(text, provenance);
2844
- annotations.push(defaultValueNode);
2845
- continue;
2846
- }
2847
- const compilerDiagnostics = buildCompilerBackedConstraintDiagnostics(
2848
- node,
2849
- sourceFile,
2850
- rawTextTag.tag.normalizedTagName,
2851
- rawTextTag.tag,
2852
- provenance,
2853
- supportingDeclarations,
2854
- options
2855
- );
2856
- if (compilerDiagnostics.length > 0) {
2857
- pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2858
- continue;
2859
- }
2860
- const constraintNode = parseConstraintTagValue(
2861
- rawTextTag.tag.normalizedTagName,
2862
- text,
2863
- provenance,
2864
- sharedTagValueOptions(options)
2865
- );
2866
- if (constraintNode) {
2867
- constraints.push(constraintNode);
2868
- }
2869
- }
2870
- }
2871
2784
  for (const [tagName, fallbacks] of rawTextFallbacks) {
2872
2785
  for (const fallback of fallbacks) {
2873
2786
  const text = fallback.text.trim();
2874
2787
  if (text === "") continue;
2875
2788
  const provenance = fallback.provenance;
2876
2789
  if (tagName === "defaultValue") {
2877
- const defaultValueNode = parseDefaultValueTagValue(text, provenance);
2878
- annotations.push(defaultValueNode);
2790
+ annotations.push(parseDefaultValueTagValue(text, provenance));
2879
2791
  continue;
2880
2792
  }
2881
- const compilerDiagnostics = buildCompilerBackedConstraintDiagnostics(
2882
- node,
2883
- sourceFile,
2793
+ processConstraintTag(
2884
2794
  tagName,
2795
+ text,
2885
2796
  null,
2886
2797
  provenance,
2798
+ node,
2799
+ sourceFile,
2887
2800
  supportingDeclarations,
2888
- options
2889
- );
2890
- if (compilerDiagnostics.length > 0) {
2891
- pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2892
- continue;
2893
- }
2894
- const constraintNode = parseConstraintTagValue(
2895
- tagName,
2896
- text,
2897
- provenance,
2898
- sharedTagValueOptions(options)
2801
+ options,
2802
+ constraints,
2803
+ diagnostics
2899
2804
  );
2900
- if (constraintNode) {
2901
- constraints.push(constraintNode);
2902
- }
2903
2805
  }
2904
2806
  }
2905
2807
  const result = { constraints, annotations, diagnostics };
@@ -2917,8 +2819,8 @@ function extractDisplayNameMetadata(node) {
2917
2819
  if (range.kind !== ts.SyntaxKind.MultiLineCommentTrivia) continue;
2918
2820
  const commentText = sourceText.substring(range.pos, range.end);
2919
2821
  if (!commentText.startsWith("/**")) continue;
2920
- const parsed = parseCommentBlock(commentText);
2921
- for (const tag of parsed.tags) {
2822
+ const unified = parseUnifiedComment(commentText);
2823
+ for (const tag of unified.tags) {
2922
2824
  if (tag.normalizedTagName !== "displayName") {
2923
2825
  continue;
2924
2826
  }
@@ -2937,51 +2839,6 @@ function extractDisplayNameMetadata(node) {
2937
2839
  memberDisplayNames
2938
2840
  };
2939
2841
  }
2940
- function extractBlockText(block) {
2941
- return extractPlainText(block.content);
2942
- }
2943
- function extractPlainText(node) {
2944
- let result = "";
2945
- if (node instanceof DocExcerpt) {
2946
- return node.content.toString();
2947
- }
2948
- if (node instanceof DocPlainText) {
2949
- return node.text;
2950
- }
2951
- if (node instanceof DocSoftBreak) {
2952
- return " ";
2953
- }
2954
- if (typeof node.getChildNodes === "function") {
2955
- for (const child of node.getChildNodes()) {
2956
- result += extractPlainText(child);
2957
- }
2958
- }
2959
- return result;
2960
- }
2961
- function choosePreferredPayloadText(primary, fallback) {
2962
- const preferred = primary.trim();
2963
- const alternate = fallback.trim();
2964
- if (preferred === "") return alternate;
2965
- if (alternate === "") return preferred;
2966
- if (alternate.includes("\n")) return alternate;
2967
- if (alternate.length > preferred.length && alternate.startsWith(preferred)) {
2968
- return alternate;
2969
- }
2970
- return preferred;
2971
- }
2972
- function getSharedPayloadText(tag, commentText, commentOffset) {
2973
- if (tag.payloadSpan === null) {
2974
- return "";
2975
- }
2976
- return sliceCommentSpan(commentText, tag.payloadSpan, {
2977
- offset: commentOffset
2978
- }).trim();
2979
- }
2980
- function getBestBlockPayloadText(tag, commentText, commentOffset, block) {
2981
- const sharedText = tag === null ? "" : getSharedPayloadText(tag, commentText, commentOffset);
2982
- const blockText = extractBlockText(block).replace(/\s+/g, " ").trim();
2983
- return choosePreferredPayloadText(sharedText, blockText);
2984
- }
2985
2842
  function collectRawTextFallbacks(node, file) {
2986
2843
  const fallbacks = /* @__PURE__ */ new Map();
2987
2844
  for (const tag of ts.getJSDocTags(node)) {
@@ -3095,6 +2952,31 @@ function isObjectType(type) {
3095
2952
  function isIntersectionType(type) {
3096
2953
  return !!(type.flags & ts3.TypeFlags.Intersection);
3097
2954
  }
2955
+ function isIntegerBrandedType(type) {
2956
+ if (!type.isIntersection()) {
2957
+ return false;
2958
+ }
2959
+ const hasNumberBase = type.types.some(
2960
+ (member) => !!(member.flags & ts3.TypeFlags.Number)
2961
+ );
2962
+ if (!hasNumberBase) {
2963
+ return false;
2964
+ }
2965
+ return type.getProperties().some((prop) => {
2966
+ const declaration = prop.valueDeclaration ?? prop.declarations?.[0];
2967
+ if (declaration === void 0) {
2968
+ return false;
2969
+ }
2970
+ if (!ts3.isPropertySignature(declaration) && !ts3.isPropertyDeclaration(declaration)) {
2971
+ return false;
2972
+ }
2973
+ const name = declaration.name;
2974
+ if (!ts3.isComputedPropertyName(name)) {
2975
+ return false;
2976
+ }
2977
+ return ts3.isIdentifier(name.expression) && name.expression.text === "__integerBrand";
2978
+ });
2979
+ }
3098
2980
  function isResolvableObjectLikeAliasTypeNode(typeNode) {
3099
2981
  if (ts3.isParenthesizedTypeNode(typeNode)) {
3100
2982
  return isResolvableObjectLikeAliasTypeNode(typeNode.type);
@@ -3479,7 +3361,7 @@ function getLeadingParsedTags(node) {
3479
3361
  if (!commentText.startsWith("/**")) {
3480
3362
  continue;
3481
3363
  }
3482
- parsedTags.push(...parseCommentBlock2(commentText, { offset: range.pos }).tags);
3364
+ parsedTags.push(...parseCommentBlock(commentText, { offset: range.pos }).tags);
3483
3365
  }
3484
3366
  return parsedTags;
3485
3367
  }
@@ -4220,6 +4102,9 @@ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode
4220
4102
  if (primitiveAlias) {
4221
4103
  return primitiveAlias;
4222
4104
  }
4105
+ if (isIntegerBrandedType(type)) {
4106
+ return { kind: "primitive", primitiveKind: "integer" };
4107
+ }
4223
4108
  if (type.flags & ts3.TypeFlags.String) {
4224
4109
  return { kind: "primitive", primitiveKind: "string" };
4225
4110
  }
@@ -4322,7 +4207,7 @@ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode
4322
4207
  return { kind: "primitive", primitiveKind: "string" };
4323
4208
  }
4324
4209
  function tryResolveNamedPrimitiveAlias(type, checker, file, typeRegistry, visiting, sourceNode, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics) {
4325
- if (!(type.flags & (ts3.TypeFlags.String | ts3.TypeFlags.Number | ts3.TypeFlags.BigInt | ts3.TypeFlags.BigIntLiteral | ts3.TypeFlags.Boolean | ts3.TypeFlags.Null))) {
4210
+ if (!(type.flags & (ts3.TypeFlags.String | ts3.TypeFlags.Number | ts3.TypeFlags.BigInt | ts3.TypeFlags.BigIntLiteral | ts3.TypeFlags.Boolean | ts3.TypeFlags.Null)) && !isIntegerBrandedType(type)) {
4326
4211
  return null;
4327
4212
  }
4328
4213
  const aliasDecl = type.aliasSymbol?.declarations?.find(ts3.isTypeAliasDeclaration) ?? getReferencedTypeAliasDeclaration(sourceNode, checker);
@@ -4408,6 +4293,9 @@ function resolveAliasedPrimitiveTarget(type, checker, file, typeRegistry, visiti
4408
4293
  visitedAliases
4409
4294
  );
4410
4295
  }
4296
+ if (isIntegerBrandedType(type)) {
4297
+ return { kind: "primitive", primitiveKind: "integer" };
4298
+ }
4411
4299
  if (type.flags & ts3.TypeFlags.String) {
4412
4300
  return { kind: "primitive", primitiveKind: "string" };
4413
4301
  }
@@ -4631,7 +4519,7 @@ function typeNodeContainsReference(type, targetName) {
4631
4519
  }
4632
4520
  }
4633
4521
  function shouldEmitResolvedObjectProperty(property, declaration) {
4634
- if (property.name.startsWith("__@")) {
4522
+ if (property.name.startsWith("__")) {
4635
4523
  return false;
4636
4524
  }
4637
4525
  if (declaration !== void 0 && "name" in declaration && declaration.name !== void 0) {
@@ -5624,7 +5512,9 @@ function generateSchemasFromClass(options) {
5624
5512
  classDecl,
5625
5513
  ctx.checker,
5626
5514
  options.filePath,
5515
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5627
5516
  options.extensionRegistry,
5517
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5628
5518
  options.metadata,
5629
5519
  options.discriminator
5630
5520
  );
@@ -5632,9 +5522,13 @@ function generateSchemasFromClass(options) {
5632
5522
  analysis,
5633
5523
  { file: options.filePath },
5634
5524
  {
5525
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5635
5526
  extensionRegistry: options.extensionRegistry,
5527
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5636
5528
  metadata: options.metadata,
5529
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5637
5530
  enumSerialization: options.enumSerialization,
5531
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5638
5532
  vendorPrefix: options.vendorPrefix
5639
5533
  }
5640
5534
  );
@@ -5681,7 +5575,12 @@ function generateSchemasDetailedInternal(options) {
5681
5575
  diagnostics: [createProgramContextFailureDiagnostic(options.filePath, error)]
5682
5576
  };
5683
5577
  }
5684
- return generateSchemasFromDetailedProgramContext(ctx, options.filePath, options.typeName, options);
5578
+ return generateSchemasFromDetailedProgramContext(
5579
+ ctx,
5580
+ options.filePath,
5581
+ options.typeName,
5582
+ options
5583
+ );
5685
5584
  }
5686
5585
  function generateSchemasFromProgramDetailed(options) {
5687
5586
  return generateSchemasFromProgram({
@@ -5699,7 +5598,12 @@ function generateSchemasFromProgramDetailedInternal(options) {
5699
5598
  diagnostics: [createProgramContextFailureDiagnostic(options.filePath, error)]
5700
5599
  };
5701
5600
  }
5702
- return generateSchemasFromDetailedProgramContext(ctx, options.filePath, options.typeName, options);
5601
+ return generateSchemasFromDetailedProgramContext(
5602
+ ctx,
5603
+ options.filePath,
5604
+ options.typeName,
5605
+ options
5606
+ );
5703
5607
  }
5704
5608
  function generateSchemasBatch(options) {
5705
5609
  const contextCache = /* @__PURE__ */ new Map();
@@ -5743,13 +5647,27 @@ function generateSchemasBatchFromProgram(options) {
5743
5647
  );
5744
5648
  });
5745
5649
  }
5650
+ function resolveOptions(options) {
5651
+ const configRegistry = options.config?.extensions !== void 0 ? createExtensionRegistry(options.config.extensions) : void 0;
5652
+ return {
5653
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5654
+ extensionRegistry: options.extensionRegistry ?? configRegistry,
5655
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5656
+ vendorPrefix: options.vendorPrefix ?? options.config?.vendorPrefix,
5657
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5658
+ enumSerialization: options.enumSerialization ?? options.config?.enumSerialization,
5659
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5660
+ metadata: options.metadata ?? options.config?.metadata
5661
+ };
5662
+ }
5746
5663
  function generateSchemasFromDetailedProgramContext(ctx, filePath, typeName, options) {
5664
+ const resolved = resolveOptions(options);
5747
5665
  const analysisResult = analyzeNamedTypeToIRFromProgramContextDetailed(
5748
5666
  ctx,
5749
5667
  filePath,
5750
5668
  typeName,
5751
- options.extensionRegistry,
5752
- options.metadata,
5669
+ resolved.extensionRegistry,
5670
+ resolved.metadata,
5753
5671
  options.discriminator
5754
5672
  );
5755
5673
  if (!analysisResult.ok) {
@@ -5762,10 +5680,10 @@ function generateSchemasFromDetailedProgramContext(ctx, filePath, typeName, opti
5762
5680
  analysisResult.analysis,
5763
5681
  { file: filePath },
5764
5682
  {
5765
- extensionRegistry: options.extensionRegistry,
5766
- metadata: options.metadata,
5767
- enumSerialization: options.enumSerialization,
5768
- vendorPrefix: options.vendorPrefix
5683
+ extensionRegistry: resolved.extensionRegistry,
5684
+ metadata: resolved.metadata,
5685
+ enumSerialization: resolved.enumSerialization,
5686
+ vendorPrefix: resolved.vendorPrefix
5769
5687
  }
5770
5688
  );
5771
5689
  }
@@ -5902,6 +5820,7 @@ function omitApiName(metadata) {
5902
5820
  }
5903
5821
  function enforceRequiredMetadata(metadata, declarationKind, logicalName, options) {
5904
5822
  const declarationPolicy = getDeclarationMetadataPolicy(
5823
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5905
5824
  normalizeMetadataPolicy(options.metadata),
5906
5825
  declarationKind
5907
5826
  );
@@ -5976,6 +5895,7 @@ function toStandaloneJsonSchema(root, typeRegistry, options) {
5976
5895
  provenance: syntheticField.provenance
5977
5896
  },
5978
5897
  {
5898
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5979
5899
  policy: normalizeMetadataPolicy(options?.metadata),
5980
5900
  surface: "tsdoc",
5981
5901
  rootLogicalName: root.name
@@ -5984,8 +5904,11 @@ function toStandaloneJsonSchema(root, typeRegistry, options) {
5984
5904
  const schema = generateJsonSchemaFromIR(
5985
5905
  ir,
5986
5906
  {
5907
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5987
5908
  extensionRegistry: options?.extensionRegistry,
5909
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5988
5910
  enumSerialization: options?.enumSerialization,
5911
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5989
5912
  vendorPrefix: options?.vendorPrefix
5990
5913
  }
5991
5914
  );
@@ -6011,9 +5934,13 @@ function generateSchemasFromAnalysis(analysis, filePath, options) {
6011
5934
  analysis,
6012
5935
  { file: filePath },
6013
5936
  {
5937
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6014
5938
  extensionRegistry: options?.extensionRegistry,
5939
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6015
5940
  enumSerialization: options?.enumSerialization,
5941
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6016
5942
  metadata: options?.metadata,
5943
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6017
5944
  vendorPrefix: options?.vendorPrefix
6018
5945
  }
6019
5946
  ),
@@ -6038,7 +5965,9 @@ function generateSchemasFromResolvedType(options, skipNamedDeclaration = false,
6038
5965
  typeRegistry,
6039
5966
  /* @__PURE__ */ new Set(),
6040
5967
  options.sourceNode,
5968
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6041
5969
  createAnalyzerMetadataPolicy(options.metadata, options.discriminator),
5970
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6042
5971
  options.extensionRegistry,
6043
5972
  diagnostics
6044
5973
  );
@@ -6087,7 +6016,9 @@ function generateSchemasFromDeclaration(options) {
6087
6016
  options.declaration,
6088
6017
  options.context.checker,
6089
6018
  filePath,
6019
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6090
6020
  options.extensionRegistry,
6021
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6091
6022
  options.metadata,
6092
6023
  options.discriminator
6093
6024
  ),
@@ -6101,7 +6032,9 @@ function generateSchemasFromDeclaration(options) {
6101
6032
  options.declaration,
6102
6033
  options.context.checker,
6103
6034
  filePath,
6035
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6104
6036
  options.extensionRegistry,
6037
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6105
6038
  options.metadata,
6106
6039
  options.discriminator
6107
6040
  ),
@@ -6114,7 +6047,9 @@ function generateSchemasFromDeclaration(options) {
6114
6047
  options.declaration,
6115
6048
  options.context.checker,
6116
6049
  filePath,
6050
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6117
6051
  options.extensionRegistry,
6052
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6118
6053
  options.metadata,
6119
6054
  options.discriminator
6120
6055
  );
@@ -6125,7 +6060,9 @@ function generateSchemasFromDeclaration(options) {
6125
6060
  options.declaration,
6126
6061
  options.context.checker,
6127
6062
  filePath,
6063
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6128
6064
  options.extensionRegistry,
6065
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6129
6066
  options.metadata
6130
6067
  );
6131
6068
  if (aliasRootInfo.diagnostics.length > 0) {
@@ -6180,7 +6117,9 @@ function resolveDeclarationMetadata(options) {
6180
6117
  const analysis = analyzeMetadataForNodeWithChecker2({
6181
6118
  checker: options.context.checker,
6182
6119
  node: options.declaration,
6120
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6183
6121
  metadata: options.metadata,
6122
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6184
6123
  extensions: options.extensionRegistry?.extensions,
6185
6124
  buildContext: options.context
6186
6125
  });
@@ -6217,7 +6156,9 @@ function buildMixedAuthoringSchemas(options) {
6217
6156
  const analysis = analyzeNamedTypeToIR(
6218
6157
  filePath,
6219
6158
  typeName,
6159
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6220
6160
  schemaOptions.extensionRegistry,
6161
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6221
6162
  schemaOptions.metadata,
6222
6163
  schemaOptions.discriminator
6223
6164
  );
@@ -6225,6 +6166,7 @@ function buildMixedAuthoringSchemas(options) {
6225
6166
  const ir = canonicalizeTSDoc(
6226
6167
  composedAnalysis,
6227
6168
  { file: filePath },
6169
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6228
6170
  schemaOptions.metadata !== void 0 ? { metadata: schemaOptions.metadata } : void 0
6229
6171
  );
6230
6172
  return {