@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.
@@ -921,6 +921,16 @@ function buildSupportingDeclarations(sourceFile, extensionTypeNames) {
921
921
  return true;
922
922
  }).map((statement) => statement.getText(sourceFile));
923
923
  }
924
+ function pushUniqueCompilerDiagnostics(target, additions) {
925
+ for (const diagnostic of additions) {
926
+ if ((diagnostic.code === "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" || diagnostic.code === "SYNTHETIC_SETUP_FAILURE") && target.some(
927
+ (existing) => existing.code === diagnostic.code && existing.message === diagnostic.message
928
+ )) {
929
+ continue;
930
+ }
931
+ target.push(diagnostic);
932
+ }
933
+ }
924
934
  function renderSyntheticArgumentExpression(valueKind, argumentText) {
925
935
  const trimmed = argumentText.trim();
926
936
  if (trimmed === "") {
@@ -1187,6 +1197,16 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
1187
1197
  if (result.diagnostics.length === 0) {
1188
1198
  return [];
1189
1199
  }
1200
+ const setupDiagnostic = result.diagnostics.find((diagnostic) => diagnostic.kind !== "typescript");
1201
+ if (setupDiagnostic !== void 0) {
1202
+ return [
1203
+ makeDiagnostic(
1204
+ setupDiagnostic.kind === "unsupported-custom-type-override" ? "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" : "SYNTHETIC_SETUP_FAILURE",
1205
+ setupDiagnostic.message,
1206
+ provenance
1207
+ )
1208
+ ];
1209
+ }
1190
1210
  const expectedLabel = definition.valueKind === null ? "compatible argument" : capabilityLabel(definition.valueKind);
1191
1211
  return [
1192
1212
  makeDiagnostic(
@@ -1352,7 +1372,7 @@ function parseTSDocTags(node, file = "", options) {
1352
1372
  options
1353
1373
  );
1354
1374
  if (compilerDiagnostics.length > 0) {
1355
- diagnostics.push(...compilerDiagnostics);
1375
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
1356
1376
  continue;
1357
1377
  }
1358
1378
  const constraintNode = (0, import_internal.parseConstraintTagValue)(
@@ -1439,7 +1459,7 @@ function parseTSDocTags(node, file = "", options) {
1439
1459
  options
1440
1460
  );
1441
1461
  if (compilerDiagnostics.length > 0) {
1442
- diagnostics.push(...compilerDiagnostics);
1462
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
1443
1463
  continue;
1444
1464
  }
1445
1465
  const constraintNode = (0, import_internal.parseConstraintTagValue)(
@@ -1473,7 +1493,7 @@ function parseTSDocTags(node, file = "", options) {
1473
1493
  options
1474
1494
  );
1475
1495
  if (compilerDiagnostics.length > 0) {
1476
- diagnostics.push(...compilerDiagnostics);
1496
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
1477
1497
  continue;
1478
1498
  }
1479
1499
  const constraintNode = (0, import_internal.parseConstraintTagValue)(