@formspec/build 0.1.0-alpha.37 → 0.1.0-alpha.38

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.cjs CHANGED
@@ -2166,6 +2166,16 @@ function buildSupportingDeclarations(sourceFile, extensionTypeNames) {
2166
2166
  return true;
2167
2167
  }).map((statement) => statement.getText(sourceFile));
2168
2168
  }
2169
+ function pushUniqueCompilerDiagnostics(target, additions) {
2170
+ for (const diagnostic of additions) {
2171
+ if ((diagnostic.code === "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" || diagnostic.code === "SYNTHETIC_SETUP_FAILURE") && target.some(
2172
+ (existing) => existing.code === diagnostic.code && existing.message === diagnostic.message
2173
+ )) {
2174
+ continue;
2175
+ }
2176
+ target.push(diagnostic);
2177
+ }
2178
+ }
2169
2179
  function renderSyntheticArgumentExpression(valueKind, argumentText) {
2170
2180
  const trimmed = argumentText.trim();
2171
2181
  if (trimmed === "") {
@@ -2432,6 +2442,16 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2432
2442
  if (result.diagnostics.length === 0) {
2433
2443
  return [];
2434
2444
  }
2445
+ const setupDiagnostic = result.diagnostics.find((diagnostic) => diagnostic.kind !== "typescript");
2446
+ if (setupDiagnostic !== void 0) {
2447
+ return [
2448
+ makeDiagnostic(
2449
+ setupDiagnostic.kind === "unsupported-custom-type-override" ? "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" : "SYNTHETIC_SETUP_FAILURE",
2450
+ setupDiagnostic.message,
2451
+ provenance
2452
+ )
2453
+ ];
2454
+ }
2435
2455
  const expectedLabel = definition.valueKind === null ? "compatible argument" : capabilityLabel(definition.valueKind);
2436
2456
  return [
2437
2457
  makeDiagnostic(
@@ -2597,7 +2617,7 @@ function parseTSDocTags(node, file = "", options) {
2597
2617
  options
2598
2618
  );
2599
2619
  if (compilerDiagnostics.length > 0) {
2600
- diagnostics.push(...compilerDiagnostics);
2620
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2601
2621
  continue;
2602
2622
  }
2603
2623
  const constraintNode = (0, import_internal2.parseConstraintTagValue)(
@@ -2684,7 +2704,7 @@ function parseTSDocTags(node, file = "", options) {
2684
2704
  options
2685
2705
  );
2686
2706
  if (compilerDiagnostics.length > 0) {
2687
- diagnostics.push(...compilerDiagnostics);
2707
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2688
2708
  continue;
2689
2709
  }
2690
2710
  const constraintNode = (0, import_internal2.parseConstraintTagValue)(
@@ -2718,7 +2738,7 @@ function parseTSDocTags(node, file = "", options) {
2718
2738
  options
2719
2739
  );
2720
2740
  if (compilerDiagnostics.length > 0) {
2721
- diagnostics.push(...compilerDiagnostics);
2741
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2722
2742
  continue;
2723
2743
  }
2724
2744
  const constraintNode = (0, import_internal2.parseConstraintTagValue)(