@hyperframes/lint 0.7.70 → 0.7.71

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/browser.js CHANGED
@@ -2426,8 +2426,12 @@ ${right.raw}`)
2426
2426
  return findings;
2427
2427
  },
2428
2428
  // gsap_infinite_repeat
2429
- ({ scripts }) => {
2429
+ ({ scripts, rootTag }) => {
2430
2430
  const findings = [];
2431
+ const declaredDuration = Number.parseFloat(
2432
+ rootTag ? readAttr(rootTag.raw, "data-duration") ?? "" : ""
2433
+ );
2434
+ const hasFiniteCompositionWindow = Number.isFinite(declaredDuration) && declaredDuration > 0;
2431
2435
  const pattern = /repeat\s*:\s*-1(?!\d)/g;
2432
2436
  for (const { snippet } of scanScriptsForRegexMatches(scripts, pattern, {
2433
2437
  stripComments: true,
@@ -2436,9 +2440,9 @@ ${right.raw}`)
2436
2440
  })) {
2437
2441
  findings.push({
2438
2442
  code: "gsap_infinite_repeat",
2439
- severity: "error",
2440
- message: "GSAP tween uses `repeat: -1` (infinite). Infinite repeats break the deterministic capture engine which seeks to exact frame times. Use a finite repeat count calculated from the composition duration: `repeat: Math.max(0, Math.floor(duration / cycleDuration) - 1)`.",
2441
- fixHint: "Replace `repeat: -1` with a finite count, e.g. `repeat: Math.max(0, Math.floor(totalDuration / singleCycleDuration) - 1)`. Use Math.floor (not Math.ceil) so the animation fits, and clamp at zero so a short composition cannot evaluate to -1.",
2443
+ severity: hasFiniteCompositionWindow ? "warning" : "error",
2444
+ message: hasFiniteCompositionWindow ? `GSAP tween uses \`repeat: -1\` (infinite), but the composition declares a finite ${declaredDuration}s window. HyperFrames clips deterministic seeking and export to that explicit duration.` : "GSAP tween uses `repeat: -1` (infinite) without a finite composition `data-duration`. The timeline can report an unbounded duration and make render planning fail.",
2445
+ fixHint: hasFiniteCompositionWindow ? "Keep the explicit finite composition `data-duration`. Use a finite repeat count only when the loop itself must end before the composition does." : "Add a finite composition `data-duration`, or replace `repeat: -1` with `repeat: Math.max(0, Math.floor(totalDuration / singleCycleDuration) - 1)`.",
2442
2446
  snippet: truncateSnippet(snippet)
2443
2447
  });
2444
2448
  }