@formspec/build 0.1.0-alpha.41 → 0.1.0-alpha.43

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,6 +1535,66 @@ 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([
1539
+ "$schema",
1540
+ "$ref",
1541
+ "$defs",
1542
+ "$id",
1543
+ "$anchor",
1544
+ "$dynamicRef",
1545
+ "$dynamicAnchor",
1546
+ "$vocabulary",
1547
+ "$comment",
1548
+ "type",
1549
+ "enum",
1550
+ "const",
1551
+ "properties",
1552
+ "patternProperties",
1553
+ "additionalProperties",
1554
+ "required",
1555
+ "items",
1556
+ "prefixItems",
1557
+ "additionalItems",
1558
+ "contains",
1559
+ "allOf",
1560
+ "oneOf",
1561
+ "anyOf",
1562
+ "not",
1563
+ "if",
1564
+ "then",
1565
+ "else",
1566
+ "minimum",
1567
+ "maximum",
1568
+ "exclusiveMinimum",
1569
+ "exclusiveMaximum",
1570
+ "multipleOf",
1571
+ "minLength",
1572
+ "maxLength",
1573
+ "pattern",
1574
+ "minItems",
1575
+ "maxItems",
1576
+ "uniqueItems",
1577
+ "minProperties",
1578
+ "maxProperties",
1579
+ "minContains",
1580
+ "maxContains",
1581
+ "format",
1582
+ "title",
1583
+ "description",
1584
+ "default",
1585
+ "deprecated",
1586
+ "readOnly",
1587
+ "writeOnly",
1588
+ "examples",
1589
+ "dependentRequired",
1590
+ "dependentSchemas",
1591
+ "propertyNames",
1592
+ "unevaluatedItems",
1593
+ "unevaluatedProperties",
1594
+ "contentEncoding",
1595
+ "contentMediaType",
1596
+ "contentSchema"
1597
+ ]);
1538
1598
  function applyCustomConstraint(schema, constraint, ctx) {
1539
1599
  const registration = ctx.extensionRegistry?.findConstraint(constraint.constraintId);
1540
1600
  if (registration === void 0) {
@@ -1542,12 +1602,25 @@ function applyCustomConstraint(schema, constraint, ctx) {
1542
1602
  `Cannot generate JSON Schema for custom constraint "${constraint.constraintId}" without a matching extension registration`
1543
1603
  );
1544
1604
  }
1545
- assignVendorPrefixedExtensionKeywords(
1546
- schema,
1547
- registration.toJsonSchema(constraint.payload, ctx.vendorPrefix),
1548
- ctx.vendorPrefix,
1549
- `custom constraint "${constraint.constraintId}"`
1550
- );
1605
+ const extensionSchema = registration.toJsonSchema(constraint.payload, ctx.vendorPrefix);
1606
+ if (registration.emitsVocabularyKeywords) {
1607
+ const target = schema;
1608
+ for (const [key, value] of Object.entries(extensionSchema)) {
1609
+ if (JSON_SCHEMA_STRUCTURAL_KEYWORDS.has(key)) {
1610
+ throw new Error(
1611
+ `Custom constraint "${constraint.constraintId}" with emitsVocabularyKeywords must not overwrite standard JSON Schema keyword "${key}"`
1612
+ );
1613
+ }
1614
+ target[key] = value;
1615
+ }
1616
+ } else {
1617
+ assignVendorPrefixedExtensionKeywords(
1618
+ schema,
1619
+ extensionSchema,
1620
+ ctx.vendorPrefix,
1621
+ `custom constraint "${constraint.constraintId}"`
1622
+ );
1623
+ }
1551
1624
  }
1552
1625
  function applyCustomAnnotation(schema, annotation, ctx) {
1553
1626
  const registration = ctx.extensionRegistry?.findAnnotation(annotation.annotationId);
@@ -2077,7 +2150,7 @@ import * as path from "path";
2077
2150
  import * as ts3 from "typescript";
2078
2151
  import {
2079
2152
  analyzeMetadataForNodeWithChecker,
2080
- parseCommentBlock as parseCommentBlock2
2153
+ parseCommentBlock
2081
2154
  } from "@formspec/analysis/internal";
2082
2155
 
2083
2156
  // src/analyzer/jsdoc-constraints.ts
@@ -2087,73 +2160,25 @@ import * as ts2 from "typescript";
2087
2160
  import * as ts from "typescript";
2088
2161
  import {
2089
2162
  checkSyntheticTagApplication,
2163
+ choosePreferredPayloadText,
2090
2164
  extractPathTarget as extractSharedPathTarget,
2091
2165
  getTagDefinition as getTagDefinition2,
2092
2166
  hasTypeSemanticCapability,
2093
2167
  normalizeFormSpecTagName as normalizeFormSpecTagName2,
2094
2168
  parseConstraintTagValue,
2095
2169
  parseDefaultValueTagValue,
2170
+ parseTagSyntax,
2171
+ parseUnifiedComment,
2096
2172
  resolveDeclarationPlacement,
2097
2173
  resolvePathTargetType,
2098
- sliceCommentSpan,
2099
- parseCommentBlock,
2100
- parseTagSyntax
2174
+ TAGS_REQUIRING_RAW_TEXT
2101
2175
  } from "@formspec/analysis/internal";
2102
- import {
2103
- TSDocParser,
2104
- TSDocConfiguration,
2105
- TSDocTagDefinition,
2106
- TSDocTagSyntaxKind,
2107
- DocExcerpt,
2108
- DocPlainText,
2109
- DocSoftBreak,
2110
- TextRange
2111
- } from "@microsoft/tsdoc";
2112
2176
  import {
2113
2177
  BUILTIN_CONSTRAINT_DEFINITIONS as BUILTIN_CONSTRAINT_DEFINITIONS2,
2114
2178
  normalizeConstraintTagName as normalizeConstraintTagName2,
2115
2179
  isBuiltinConstraintName
2116
2180
  } from "@formspec/core/internals";
2117
2181
  import "@formspec/core/internals";
2118
- var TAGS_REQUIRING_RAW_TEXT = /* @__PURE__ */ new Set(["pattern", "enumOptions", "defaultValue"]);
2119
- function createFormSpecTSDocConfig(extensionTagNames = []) {
2120
- const config = new TSDocConfiguration();
2121
- for (const tagName of Object.keys(BUILTIN_CONSTRAINT_DEFINITIONS2)) {
2122
- config.addTagDefinition(
2123
- new TSDocTagDefinition({
2124
- tagName: "@" + tagName,
2125
- syntaxKind: TSDocTagSyntaxKind.BlockTag,
2126
- allowMultiple: true
2127
- })
2128
- );
2129
- }
2130
- for (const tagName of ["apiName", "displayName", "format", "placeholder"]) {
2131
- config.addTagDefinition(
2132
- new TSDocTagDefinition({
2133
- tagName: "@" + tagName,
2134
- syntaxKind: TSDocTagSyntaxKind.BlockTag,
2135
- allowMultiple: true
2136
- })
2137
- );
2138
- }
2139
- for (const tagName of extensionTagNames) {
2140
- config.addTagDefinition(
2141
- new TSDocTagDefinition({
2142
- tagName: "@" + tagName,
2143
- syntaxKind: TSDocTagSyntaxKind.BlockTag,
2144
- allowMultiple: true
2145
- })
2146
- );
2147
- }
2148
- return config;
2149
- }
2150
- function sharedCommentSyntaxOptions(options, offset) {
2151
- const extensions = options?.extensionRegistry?.extensions;
2152
- return {
2153
- ...offset !== void 0 ? { offset } : {},
2154
- ...extensions !== void 0 ? { extensions } : {}
2155
- };
2156
- }
2157
2182
  function sharedTagValueOptions(options) {
2158
2183
  return {
2159
2184
  ...options?.extensionRegistry !== void 0 ? { registry: options.extensionRegistry } : {},
@@ -2253,6 +2278,30 @@ function pushUniqueCompilerDiagnostics(target, additions) {
2253
2278
  target.push(diagnostic);
2254
2279
  }
2255
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
+ }
2256
2305
  function renderSyntheticArgumentExpression(valueKind, argumentText) {
2257
2306
  const trimmed = argumentText.trim();
2258
2307
  if (trimmed === "") {
@@ -2538,10 +2587,9 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2538
2587
  )
2539
2588
  ];
2540
2589
  }
2541
- var parserCache = /* @__PURE__ */ new Map();
2542
2590
  var parseResultCache = /* @__PURE__ */ new Map();
2543
- function getParser(options) {
2544
- const extensionTagNames = [
2591
+ function getExtensionTagNames(options) {
2592
+ return [
2545
2593
  ...options?.extensionRegistry?.extensions.flatMap(
2546
2594
  (extension) => (extension.constraintTags ?? []).map((tag) => normalizeFormSpecTagName2(tag.tagName))
2547
2595
  ) ?? [],
@@ -2549,14 +2597,6 @@ function getParser(options) {
2549
2597
  (extension) => (extension.metadataSlots ?? []).map((slot) => normalizeFormSpecTagName2(slot.tagName))
2550
2598
  ) ?? []
2551
2599
  ].sort();
2552
- const cacheKey = extensionTagNames.join("|");
2553
- const existing = parserCache.get(cacheKey);
2554
- if (existing) {
2555
- return existing;
2556
- }
2557
- const parser = new TSDocParser(createFormSpecTSDocConfig(extensionTagNames));
2558
- parserCache.set(cacheKey, parser);
2559
- return parser;
2560
2600
  }
2561
2601
  function getExtensionRegistryCacheKey(registry) {
2562
2602
  if (registry === void 0) {
@@ -2607,13 +2647,13 @@ function parseTSDocTags(node, file = "", options) {
2607
2647
  let placeholder;
2608
2648
  let displayNameProvenance;
2609
2649
  let placeholderProvenance;
2610
- const rawTextTags = [];
2611
2650
  const sourceFile = node.getSourceFile();
2612
2651
  const sourceText = sourceFile.getFullText();
2613
2652
  const extensionTypeNames = getExtensionTypeNames(options?.extensionRegistry);
2614
2653
  const supportingDeclarations = buildSupportingDeclarations(sourceFile, extensionTypeNames);
2615
2654
  const commentRanges = ts.getLeadingCommentRanges(sourceText, node.getFullStart());
2616
2655
  const rawTextFallbacks = collectRawTextFallbacks(node, file);
2656
+ const extensionTagNames = getExtensionTagNames(options);
2617
2657
  if (commentRanges) {
2618
2658
  for (const range of commentRanges) {
2619
2659
  if (range.kind !== ts.SyntaxKind.MultiLineCommentTrivia) {
@@ -2623,38 +2663,18 @@ function parseTSDocTags(node, file = "", options) {
2623
2663
  if (!commentText.startsWith("/**")) {
2624
2664
  continue;
2625
2665
  }
2626
- const parser = getParser(options);
2627
- const parserContext = parser.parseRange(
2628
- TextRange.fromStringRange(sourceText, range.pos, range.end)
2629
- );
2630
- const docComment = parserContext.docComment;
2631
- const parsedComment = parseCommentBlock(
2632
- commentText,
2633
- sharedCommentSyntaxOptions(options, range.pos)
2634
- );
2635
- let parsedTagCursor = 0;
2636
- const nextParsedTag = (normalizedTagName) => {
2637
- while (parsedTagCursor < parsedComment.tags.length) {
2638
- const candidate = parsedComment.tags[parsedTagCursor];
2639
- parsedTagCursor += 1;
2640
- if (candidate?.normalizedTagName === normalizedTagName) {
2641
- return candidate;
2642
- }
2643
- }
2644
- return null;
2645
- };
2646
- for (const parsedTag of parsedComment.tags) {
2647
- if (TAGS_REQUIRING_RAW_TEXT.has(parsedTag.normalizedTagName)) {
2648
- rawTextTags.push({ tag: parsedTag, commentText, commentOffset: range.pos });
2649
- }
2650
- }
2651
- for (const block of docComment.customBlocks) {
2652
- const tagName = normalizeConstraintTagName2(block.blockTag.tagName.substring(1));
2653
- 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;
2654
2674
  if (tagName === "displayName" || tagName === "format" || tagName === "placeholder") {
2655
- const text2 = getBestBlockPayloadText(parsedTag, commentText, range.pos, block);
2675
+ const text2 = tag.resolvedPayloadText;
2656
2676
  if (text2 === "") continue;
2657
- const provenance2 = parsedTag !== null ? provenanceForParsedTag(parsedTag, sourceFile, file) : provenanceForComment(range, sourceFile, file, tagName);
2677
+ const provenance2 = provenanceForParsedTag(tag, sourceFile, file);
2658
2678
  switch (tagName) {
2659
2679
  case "displayName":
2660
2680
  if (!isMemberTargetDisplayName(text2) && displayName === void 0) {
@@ -2679,64 +2699,69 @@ function parseTSDocTags(node, file = "", options) {
2679
2699
  }
2680
2700
  continue;
2681
2701
  }
2682
- if (TAGS_REQUIRING_RAW_TEXT.has(tagName)) continue;
2683
- const text = getBestBlockPayloadText(parsedTag, commentText, range.pos, block);
2684
- const expectedType = isBuiltinConstraintName(tagName) ? BUILTIN_CONSTRAINT_DEFINITIONS2[tagName] : void 0;
2685
- if (text === "" && expectedType !== "boolean") continue;
2686
- const provenance = parsedTag !== null ? provenanceForParsedTag(parsedTag, sourceFile, file) : provenanceForComment(range, sourceFile, file, tagName);
2687
- const compilerDiagnostics = buildCompilerBackedConstraintDiagnostics(
2688
- node,
2689
- sourceFile,
2690
- tagName,
2691
- parsedTag,
2692
- provenance,
2693
- supportingDeclarations,
2694
- options
2695
- );
2696
- if (compilerDiagnostics.length > 0) {
2697
- 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
+ );
2698
2723
  continue;
2699
2724
  }
2700
- 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(
2701
2730
  tagName,
2702
2731
  text,
2732
+ tag,
2703
2733
  provenance,
2704
- sharedTagValueOptions(options)
2734
+ node,
2735
+ sourceFile,
2736
+ supportingDeclarations,
2737
+ options,
2738
+ constraints,
2739
+ diagnostics
2705
2740
  );
2706
- if (constraintNode) {
2707
- constraints.push(constraintNode);
2708
- }
2709
2741
  }
2710
- if (docComment.deprecatedBlock !== void 0) {
2711
- const message = extractBlockText(docComment.deprecatedBlock).trim();
2742
+ if (unified.isDeprecated) {
2712
2743
  annotations.push({
2713
2744
  kind: "annotation",
2714
2745
  annotationKind: "deprecated",
2715
- ...message !== "" && { message },
2746
+ ...unified.deprecationMessage !== "" && { message: unified.deprecationMessage },
2716
2747
  provenance: provenanceForComment(range, sourceFile, file, "deprecated")
2717
2748
  });
2718
2749
  }
2719
- {
2720
- const summary = extractPlainText(docComment.summarySection).trim();
2721
- if (summary !== "") {
2722
- annotations.push({
2723
- kind: "annotation",
2724
- annotationKind: "description",
2725
- value: summary,
2726
- provenance: provenanceForComment(range, sourceFile, file, "summary")
2727
- });
2728
- }
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
+ });
2729
2757
  }
2730
- if (docComment.remarksBlock !== void 0) {
2731
- const remarksText = extractBlockText(docComment.remarksBlock).trim();
2732
- if (remarksText !== "") {
2733
- annotations.push({
2734
- kind: "annotation",
2735
- annotationKind: "remarks",
2736
- value: remarksText,
2737
- provenance: provenanceForComment(range, sourceFile, file, "remarks")
2738
- });
2739
- }
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
+ });
2740
2765
  }
2741
2766
  }
2742
2767
  }
@@ -2756,77 +2781,27 @@ function parseTSDocTags(node, file = "", options) {
2756
2781
  provenance: placeholderProvenance
2757
2782
  });
2758
2783
  }
2759
- if (rawTextTags.length > 0) {
2760
- for (const rawTextTag of rawTextTags) {
2761
- const fallbackQueue = rawTextFallbacks.get(rawTextTag.tag.normalizedTagName);
2762
- const fallback = fallbackQueue?.shift();
2763
- const text = choosePreferredPayloadText(
2764
- getSharedPayloadText(rawTextTag.tag, rawTextTag.commentText, rawTextTag.commentOffset),
2765
- fallback?.text ?? ""
2766
- );
2767
- if (text === "") continue;
2768
- const provenance = provenanceForParsedTag(rawTextTag.tag, sourceFile, file);
2769
- if (rawTextTag.tag.normalizedTagName === "defaultValue") {
2770
- const defaultValueNode = parseDefaultValueTagValue(text, provenance);
2771
- annotations.push(defaultValueNode);
2772
- continue;
2773
- }
2774
- const compilerDiagnostics = buildCompilerBackedConstraintDiagnostics(
2775
- node,
2776
- sourceFile,
2777
- rawTextTag.tag.normalizedTagName,
2778
- rawTextTag.tag,
2779
- provenance,
2780
- supportingDeclarations,
2781
- options
2782
- );
2783
- if (compilerDiagnostics.length > 0) {
2784
- pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2785
- continue;
2786
- }
2787
- const constraintNode = parseConstraintTagValue(
2788
- rawTextTag.tag.normalizedTagName,
2789
- text,
2790
- provenance,
2791
- sharedTagValueOptions(options)
2792
- );
2793
- if (constraintNode) {
2794
- constraints.push(constraintNode);
2795
- }
2796
- }
2797
- }
2798
2784
  for (const [tagName, fallbacks] of rawTextFallbacks) {
2799
2785
  for (const fallback of fallbacks) {
2800
2786
  const text = fallback.text.trim();
2801
2787
  if (text === "") continue;
2802
2788
  const provenance = fallback.provenance;
2803
2789
  if (tagName === "defaultValue") {
2804
- const defaultValueNode = parseDefaultValueTagValue(text, provenance);
2805
- annotations.push(defaultValueNode);
2790
+ annotations.push(parseDefaultValueTagValue(text, provenance));
2806
2791
  continue;
2807
2792
  }
2808
- const compilerDiagnostics = buildCompilerBackedConstraintDiagnostics(
2809
- node,
2810
- sourceFile,
2793
+ processConstraintTag(
2811
2794
  tagName,
2795
+ text,
2812
2796
  null,
2813
2797
  provenance,
2798
+ node,
2799
+ sourceFile,
2814
2800
  supportingDeclarations,
2815
- options
2816
- );
2817
- if (compilerDiagnostics.length > 0) {
2818
- pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2819
- continue;
2820
- }
2821
- const constraintNode = parseConstraintTagValue(
2822
- tagName,
2823
- text,
2824
- provenance,
2825
- sharedTagValueOptions(options)
2801
+ options,
2802
+ constraints,
2803
+ diagnostics
2826
2804
  );
2827
- if (constraintNode) {
2828
- constraints.push(constraintNode);
2829
- }
2830
2805
  }
2831
2806
  }
2832
2807
  const result = { constraints, annotations, diagnostics };
@@ -2844,8 +2819,8 @@ function extractDisplayNameMetadata(node) {
2844
2819
  if (range.kind !== ts.SyntaxKind.MultiLineCommentTrivia) continue;
2845
2820
  const commentText = sourceText.substring(range.pos, range.end);
2846
2821
  if (!commentText.startsWith("/**")) continue;
2847
- const parsed = parseCommentBlock(commentText);
2848
- for (const tag of parsed.tags) {
2822
+ const unified = parseUnifiedComment(commentText);
2823
+ for (const tag of unified.tags) {
2849
2824
  if (tag.normalizedTagName !== "displayName") {
2850
2825
  continue;
2851
2826
  }
@@ -2864,51 +2839,6 @@ function extractDisplayNameMetadata(node) {
2864
2839
  memberDisplayNames
2865
2840
  };
2866
2841
  }
2867
- function extractBlockText(block) {
2868
- return extractPlainText(block.content);
2869
- }
2870
- function extractPlainText(node) {
2871
- let result = "";
2872
- if (node instanceof DocExcerpt) {
2873
- return node.content.toString();
2874
- }
2875
- if (node instanceof DocPlainText) {
2876
- return node.text;
2877
- }
2878
- if (node instanceof DocSoftBreak) {
2879
- return " ";
2880
- }
2881
- if (typeof node.getChildNodes === "function") {
2882
- for (const child of node.getChildNodes()) {
2883
- result += extractPlainText(child);
2884
- }
2885
- }
2886
- return result;
2887
- }
2888
- function choosePreferredPayloadText(primary, fallback) {
2889
- const preferred = primary.trim();
2890
- const alternate = fallback.trim();
2891
- if (preferred === "") return alternate;
2892
- if (alternate === "") return preferred;
2893
- if (alternate.includes("\n")) return alternate;
2894
- if (alternate.length > preferred.length && alternate.startsWith(preferred)) {
2895
- return alternate;
2896
- }
2897
- return preferred;
2898
- }
2899
- function getSharedPayloadText(tag, commentText, commentOffset) {
2900
- if (tag.payloadSpan === null) {
2901
- return "";
2902
- }
2903
- return sliceCommentSpan(commentText, tag.payloadSpan, {
2904
- offset: commentOffset
2905
- }).trim();
2906
- }
2907
- function getBestBlockPayloadText(tag, commentText, commentOffset, block) {
2908
- const sharedText = tag === null ? "" : getSharedPayloadText(tag, commentText, commentOffset);
2909
- const blockText = extractBlockText(block).replace(/\s+/g, " ").trim();
2910
- return choosePreferredPayloadText(sharedText, blockText);
2911
- }
2912
2842
  function collectRawTextFallbacks(node, file) {
2913
2843
  const fallbacks = /* @__PURE__ */ new Map();
2914
2844
  for (const tag of ts.getJSDocTags(node)) {
@@ -3406,7 +3336,7 @@ function getLeadingParsedTags(node) {
3406
3336
  if (!commentText.startsWith("/**")) {
3407
3337
  continue;
3408
3338
  }
3409
- parsedTags.push(...parseCommentBlock2(commentText, { offset: range.pos }).tags);
3339
+ parsedTags.push(...parseCommentBlock(commentText, { offset: range.pos }).tags);
3410
3340
  }
3411
3341
  return parsedTags;
3412
3342
  }
@@ -4558,7 +4488,7 @@ function typeNodeContainsReference(type, targetName) {
4558
4488
  }
4559
4489
  }
4560
4490
  function shouldEmitResolvedObjectProperty(property, declaration) {
4561
- if (property.name.startsWith("__@")) {
4491
+ if (property.name.startsWith("__")) {
4562
4492
  return false;
4563
4493
  }
4564
4494
  if (declaration !== void 0 && "name" in declaration && declaration.name !== void 0) {
@@ -5551,7 +5481,9 @@ function generateSchemasFromClass(options) {
5551
5481
  classDecl,
5552
5482
  ctx.checker,
5553
5483
  options.filePath,
5484
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5554
5485
  options.extensionRegistry,
5486
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5555
5487
  options.metadata,
5556
5488
  options.discriminator
5557
5489
  );
@@ -5559,9 +5491,13 @@ function generateSchemasFromClass(options) {
5559
5491
  analysis,
5560
5492
  { file: options.filePath },
5561
5493
  {
5494
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5562
5495
  extensionRegistry: options.extensionRegistry,
5496
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5563
5497
  metadata: options.metadata,
5498
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5564
5499
  enumSerialization: options.enumSerialization,
5500
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5565
5501
  vendorPrefix: options.vendorPrefix
5566
5502
  }
5567
5503
  );
@@ -5608,7 +5544,12 @@ function generateSchemasDetailedInternal(options) {
5608
5544
  diagnostics: [createProgramContextFailureDiagnostic(options.filePath, error)]
5609
5545
  };
5610
5546
  }
5611
- return generateSchemasFromDetailedProgramContext(ctx, options.filePath, options.typeName, options);
5547
+ return generateSchemasFromDetailedProgramContext(
5548
+ ctx,
5549
+ options.filePath,
5550
+ options.typeName,
5551
+ options
5552
+ );
5612
5553
  }
5613
5554
  function generateSchemasFromProgramDetailed(options) {
5614
5555
  return generateSchemasFromProgram({
@@ -5626,7 +5567,12 @@ function generateSchemasFromProgramDetailedInternal(options) {
5626
5567
  diagnostics: [createProgramContextFailureDiagnostic(options.filePath, error)]
5627
5568
  };
5628
5569
  }
5629
- return generateSchemasFromDetailedProgramContext(ctx, options.filePath, options.typeName, options);
5570
+ return generateSchemasFromDetailedProgramContext(
5571
+ ctx,
5572
+ options.filePath,
5573
+ options.typeName,
5574
+ options
5575
+ );
5630
5576
  }
5631
5577
  function generateSchemasBatch(options) {
5632
5578
  const contextCache = /* @__PURE__ */ new Map();
@@ -5670,13 +5616,27 @@ function generateSchemasBatchFromProgram(options) {
5670
5616
  );
5671
5617
  });
5672
5618
  }
5619
+ function resolveOptions(options) {
5620
+ const configRegistry = options.config?.extensions !== void 0 ? createExtensionRegistry(options.config.extensions) : void 0;
5621
+ return {
5622
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5623
+ extensionRegistry: options.extensionRegistry ?? configRegistry,
5624
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5625
+ vendorPrefix: options.vendorPrefix ?? options.config?.vendorPrefix,
5626
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5627
+ enumSerialization: options.enumSerialization ?? options.config?.enumSerialization,
5628
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5629
+ metadata: options.metadata ?? options.config?.metadata
5630
+ };
5631
+ }
5673
5632
  function generateSchemasFromDetailedProgramContext(ctx, filePath, typeName, options) {
5633
+ const resolved = resolveOptions(options);
5674
5634
  const analysisResult = analyzeNamedTypeToIRFromProgramContextDetailed(
5675
5635
  ctx,
5676
5636
  filePath,
5677
5637
  typeName,
5678
- options.extensionRegistry,
5679
- options.metadata,
5638
+ resolved.extensionRegistry,
5639
+ resolved.metadata,
5680
5640
  options.discriminator
5681
5641
  );
5682
5642
  if (!analysisResult.ok) {
@@ -5689,10 +5649,10 @@ function generateSchemasFromDetailedProgramContext(ctx, filePath, typeName, opti
5689
5649
  analysisResult.analysis,
5690
5650
  { file: filePath },
5691
5651
  {
5692
- extensionRegistry: options.extensionRegistry,
5693
- metadata: options.metadata,
5694
- enumSerialization: options.enumSerialization,
5695
- vendorPrefix: options.vendorPrefix
5652
+ extensionRegistry: resolved.extensionRegistry,
5653
+ metadata: resolved.metadata,
5654
+ enumSerialization: resolved.enumSerialization,
5655
+ vendorPrefix: resolved.vendorPrefix
5696
5656
  }
5697
5657
  );
5698
5658
  }
@@ -5829,6 +5789,7 @@ function omitApiName(metadata) {
5829
5789
  }
5830
5790
  function enforceRequiredMetadata(metadata, declarationKind, logicalName, options) {
5831
5791
  const declarationPolicy = getDeclarationMetadataPolicy(
5792
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5832
5793
  normalizeMetadataPolicy(options.metadata),
5833
5794
  declarationKind
5834
5795
  );
@@ -5903,6 +5864,7 @@ function toStandaloneJsonSchema(root, typeRegistry, options) {
5903
5864
  provenance: syntheticField.provenance
5904
5865
  },
5905
5866
  {
5867
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5906
5868
  policy: normalizeMetadataPolicy(options?.metadata),
5907
5869
  surface: "tsdoc",
5908
5870
  rootLogicalName: root.name
@@ -5911,8 +5873,11 @@ function toStandaloneJsonSchema(root, typeRegistry, options) {
5911
5873
  const schema = generateJsonSchemaFromIR(
5912
5874
  ir,
5913
5875
  {
5876
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5914
5877
  extensionRegistry: options?.extensionRegistry,
5878
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5915
5879
  enumSerialization: options?.enumSerialization,
5880
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5916
5881
  vendorPrefix: options?.vendorPrefix
5917
5882
  }
5918
5883
  );
@@ -5938,9 +5903,13 @@ function generateSchemasFromAnalysis(analysis, filePath, options) {
5938
5903
  analysis,
5939
5904
  { file: filePath },
5940
5905
  {
5906
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5941
5907
  extensionRegistry: options?.extensionRegistry,
5908
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5942
5909
  enumSerialization: options?.enumSerialization,
5910
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5943
5911
  metadata: options?.metadata,
5912
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5944
5913
  vendorPrefix: options?.vendorPrefix
5945
5914
  }
5946
5915
  ),
@@ -5965,7 +5934,9 @@ function generateSchemasFromResolvedType(options, skipNamedDeclaration = false,
5965
5934
  typeRegistry,
5966
5935
  /* @__PURE__ */ new Set(),
5967
5936
  options.sourceNode,
5937
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5968
5938
  createAnalyzerMetadataPolicy(options.metadata, options.discriminator),
5939
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
5969
5940
  options.extensionRegistry,
5970
5941
  diagnostics
5971
5942
  );
@@ -6014,7 +5985,9 @@ function generateSchemasFromDeclaration(options) {
6014
5985
  options.declaration,
6015
5986
  options.context.checker,
6016
5987
  filePath,
5988
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6017
5989
  options.extensionRegistry,
5990
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6018
5991
  options.metadata,
6019
5992
  options.discriminator
6020
5993
  ),
@@ -6028,7 +6001,9 @@ function generateSchemasFromDeclaration(options) {
6028
6001
  options.declaration,
6029
6002
  options.context.checker,
6030
6003
  filePath,
6004
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6031
6005
  options.extensionRegistry,
6006
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6032
6007
  options.metadata,
6033
6008
  options.discriminator
6034
6009
  ),
@@ -6041,7 +6016,9 @@ function generateSchemasFromDeclaration(options) {
6041
6016
  options.declaration,
6042
6017
  options.context.checker,
6043
6018
  filePath,
6019
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6044
6020
  options.extensionRegistry,
6021
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6045
6022
  options.metadata,
6046
6023
  options.discriminator
6047
6024
  );
@@ -6052,7 +6029,9 @@ function generateSchemasFromDeclaration(options) {
6052
6029
  options.declaration,
6053
6030
  options.context.checker,
6054
6031
  filePath,
6032
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6055
6033
  options.extensionRegistry,
6034
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6056
6035
  options.metadata
6057
6036
  );
6058
6037
  if (aliasRootInfo.diagnostics.length > 0) {
@@ -6107,7 +6086,9 @@ function resolveDeclarationMetadata(options) {
6107
6086
  const analysis = analyzeMetadataForNodeWithChecker2({
6108
6087
  checker: options.context.checker,
6109
6088
  node: options.declaration,
6089
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6110
6090
  metadata: options.metadata,
6091
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6111
6092
  extensions: options.extensionRegistry?.extensions,
6112
6093
  buildContext: options.context
6113
6094
  });
@@ -6144,7 +6125,9 @@ function buildMixedAuthoringSchemas(options) {
6144
6125
  const analysis = analyzeNamedTypeToIR(
6145
6126
  filePath,
6146
6127
  typeName,
6128
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6147
6129
  schemaOptions.extensionRegistry,
6130
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6148
6131
  schemaOptions.metadata,
6149
6132
  schemaOptions.discriminator
6150
6133
  );
@@ -6152,6 +6135,7 @@ function buildMixedAuthoringSchemas(options) {
6152
6135
  const ir = canonicalizeTSDoc(
6153
6136
  composedAnalysis,
6154
6137
  { file: filePath },
6138
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
6155
6139
  schemaOptions.metadata !== void 0 ? { metadata: schemaOptions.metadata } : void 0
6156
6140
  );
6157
6141
  return {