@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/internals.js CHANGED
@@ -897,6 +897,16 @@ function buildSupportingDeclarations(sourceFile, extensionTypeNames) {
897
897
  return true;
898
898
  }).map((statement) => statement.getText(sourceFile));
899
899
  }
900
+ function pushUniqueCompilerDiagnostics(target, additions) {
901
+ for (const diagnostic of additions) {
902
+ if ((diagnostic.code === "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" || diagnostic.code === "SYNTHETIC_SETUP_FAILURE") && target.some(
903
+ (existing) => existing.code === diagnostic.code && existing.message === diagnostic.message
904
+ )) {
905
+ continue;
906
+ }
907
+ target.push(diagnostic);
908
+ }
909
+ }
900
910
  function renderSyntheticArgumentExpression(valueKind, argumentText) {
901
911
  const trimmed = argumentText.trim();
902
912
  if (trimmed === "") {
@@ -1163,6 +1173,16 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
1163
1173
  if (result.diagnostics.length === 0) {
1164
1174
  return [];
1165
1175
  }
1176
+ const setupDiagnostic = result.diagnostics.find((diagnostic) => diagnostic.kind !== "typescript");
1177
+ if (setupDiagnostic !== void 0) {
1178
+ return [
1179
+ makeDiagnostic(
1180
+ setupDiagnostic.kind === "unsupported-custom-type-override" ? "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" : "SYNTHETIC_SETUP_FAILURE",
1181
+ setupDiagnostic.message,
1182
+ provenance
1183
+ )
1184
+ ];
1185
+ }
1166
1186
  const expectedLabel = definition.valueKind === null ? "compatible argument" : capabilityLabel(definition.valueKind);
1167
1187
  return [
1168
1188
  makeDiagnostic(
@@ -1328,7 +1348,7 @@ function parseTSDocTags(node, file = "", options) {
1328
1348
  options
1329
1349
  );
1330
1350
  if (compilerDiagnostics.length > 0) {
1331
- diagnostics.push(...compilerDiagnostics);
1351
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
1332
1352
  continue;
1333
1353
  }
1334
1354
  const constraintNode = parseConstraintTagValue(
@@ -1415,7 +1435,7 @@ function parseTSDocTags(node, file = "", options) {
1415
1435
  options
1416
1436
  );
1417
1437
  if (compilerDiagnostics.length > 0) {
1418
- diagnostics.push(...compilerDiagnostics);
1438
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
1419
1439
  continue;
1420
1440
  }
1421
1441
  const constraintNode = parseConstraintTagValue(
@@ -1449,7 +1469,7 @@ function parseTSDocTags(node, file = "", options) {
1449
1469
  options
1450
1470
  );
1451
1471
  if (compilerDiagnostics.length > 0) {
1452
- diagnostics.push(...compilerDiagnostics);
1472
+ pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
1453
1473
  continue;
1454
1474
  }
1455
1475
  const constraintNode = parseConstraintTagValue(