@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.js CHANGED
@@ -2147,6 +2147,16 @@ function buildSupportingDeclarations(sourceFile, extensionTypeNames) {
2147
2147
  return true;
2148
2148
  }).map((statement) => statement.getText(sourceFile));
2149
2149
  }
2150
+ function pushUniqueCompilerDiagnostics(target, additions) {
2151
+ for (const diagnostic of additions) {
2152
+ if ((diagnostic.code === "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" || diagnostic.code === "SYNTHETIC_SETUP_FAILURE") && target.some(
2153
+ (existing) => existing.code === diagnostic.code && existing.message === diagnostic.message
2154
+ )) {
2155
+ continue;
2156
+ }
2157
+ target.push(diagnostic);
2158
+ }
2159
+ }
2150
2160
  function renderSyntheticArgumentExpression(valueKind, argumentText) {
2151
2161
  const trimmed = argumentText.trim();
2152
2162
  if (trimmed === "") {
@@ -2413,6 +2423,16 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2413
2423
  if (result.diagnostics.length === 0) {
2414
2424
  return [];
2415
2425
  }
2426
+ const setupDiagnostic = result.diagnostics.find((diagnostic) => diagnostic.kind !== "typescript");
2427
+ if (setupDiagnostic !== void 0) {
2428
+ return [
2429
+ makeDiagnostic(
2430
+ setupDiagnostic.kind === "unsupported-custom-type-override" ? "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" : "SYNTHETIC_SETUP_FAILURE",
2431
+ setupDiagnostic.message,
2432
+ provenance
2433
+ )
2434
+ ];
2435
+ }
2416
2436
  const expectedLabel = definition.valueKind === null ? "compatible argument" : capabilityLabel(definition.valueKind);
2417
2437
  return [
2418
2438
  makeDiagnostic(
@@ -2578,7 +2598,7 @@ function parseTSDocTags(node, file = "", options) {
2578
2598
  options
2579
2599
  );
2580
2600
  if (compilerDiagnostics.length > 0) {
2581
- diagnostics.push(...compilerDiagnostics);
2601
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2582
2602
  continue;
2583
2603
  }
2584
2604
  const constraintNode = parseConstraintTagValue(
@@ -2665,7 +2685,7 @@ function parseTSDocTags(node, file = "", options) {
2665
2685
  options
2666
2686
  );
2667
2687
  if (compilerDiagnostics.length > 0) {
2668
- diagnostics.push(...compilerDiagnostics);
2688
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2669
2689
  continue;
2670
2690
  }
2671
2691
  const constraintNode = parseConstraintTagValue(
@@ -2699,7 +2719,7 @@ function parseTSDocTags(node, file = "", options) {
2699
2719
  options
2700
2720
  );
2701
2721
  if (compilerDiagnostics.length > 0) {
2702
- diagnostics.push(...compilerDiagnostics);
2722
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2703
2723
  continue;
2704
2724
  }
2705
2725
  const constraintNode = parseConstraintTagValue(