@hyperframes/parsers 0.7.63 → 0.7.65

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
@@ -2356,14 +2356,26 @@ function resolveStart(expression, rawStart, options, diagnostics) {
2356
2356
  }
2357
2357
  return Math.max(0, referencedEnd + expression.offset);
2358
2358
  }
2359
+ var DERIVED_END_EQUALITY_EPSILON_SECONDS = 1e-9;
2360
+ function derivedEndsAreConsistent(parsedEnd, canonicalEnd) {
2361
+ return Math.abs(parsedEnd - canonicalEnd) <= DERIVED_END_EQUALITY_EPSILON_SECONDS;
2362
+ }
2359
2363
  function diagnoseDerivedEnd(rawEnd, canonicalEnd, diagnostics) {
2360
- pushDiagnostic(diagnostics, "deprecated-end", COMPOSITION_ATTRIBUTES.derivedEnd, rawEnd);
2361
2364
  const parsedEnd = parseNumeric(rawEnd);
2362
2365
  if (parsedEnd == null) {
2366
+ pushDiagnostic(diagnostics, "deprecated-end", COMPOSITION_ATTRIBUTES.derivedEnd, rawEnd);
2363
2367
  pushDiagnostic(diagnostics, "invalid-end", COMPOSITION_ATTRIBUTES.derivedEnd, rawEnd);
2364
- } else if (canonicalEnd != null && parsedEnd !== canonicalEnd) {
2365
- pushDiagnostic(diagnostics, "conflicting-end", COMPOSITION_ATTRIBUTES.derivedEnd, rawEnd);
2368
+ return;
2369
+ }
2370
+ if (canonicalEnd == null) {
2371
+ pushDiagnostic(diagnostics, "deprecated-end", COMPOSITION_ATTRIBUTES.derivedEnd, rawEnd);
2372
+ return;
2373
+ }
2374
+ if (derivedEndsAreConsistent(parsedEnd, canonicalEnd)) {
2375
+ return;
2366
2376
  }
2377
+ pushDiagnostic(diagnostics, "deprecated-end", COMPOSITION_ATTRIBUTES.derivedEnd, rawEnd);
2378
+ pushDiagnostic(diagnostics, "conflicting-end", COMPOSITION_ATTRIBUTES.derivedEnd, rawEnd);
2367
2379
  }
2368
2380
  function readCanonicalDuration(rawDuration, start, diagnostics) {
2369
2381
  const duration = parseNumeric(rawDuration);