@hyperframes/producer 0.2.4 → 0.3.0

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
@@ -100088,8 +100088,30 @@ ${right2.raw}`)
100088
100088
  findings.push({
100089
100089
  code: "gsap_infinite_repeat",
100090
100090
  severity: "error",
100091
- 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.ceil(duration / cycleDuration) - 1`.",
100092
- fixHint: "Replace `repeat: -1` with a finite count, e.g. `repeat: Math.ceil(totalDuration / singleCycleDuration) - 1`.",
100091
+ 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.floor(duration / cycleDuration) - 1`.",
100092
+ fixHint: "Replace `repeat: -1` with a finite count, e.g. `repeat: Math.floor(totalDuration / singleCycleDuration) - 1`. Use Math.floor (not Math.ceil) to ensure the animation fits within the total duration.",
100093
+ snippet: truncateSnippet(snippet)
100094
+ });
100095
+ }
100096
+ }
100097
+ return findings;
100098
+ },
100099
+ // gsap_repeat_ceil_overshoot
100100
+ ({ scripts }) => {
100101
+ const findings = [];
100102
+ for (const script of scripts) {
100103
+ const content = script.content;
100104
+ const pattern = /repeat\s*:\s*Math\.ceil\s*\([^)]+\)\s*-\s*1/g;
100105
+ let match2;
100106
+ while ((match2 = pattern.exec(content)) !== null) {
100107
+ const contextStart = Math.max(0, match2.index - 40);
100108
+ const contextEnd = Math.min(content.length, match2.index + match2[0].length + 40);
100109
+ const snippet = content.slice(contextStart, contextEnd).trim();
100110
+ findings.push({
100111
+ code: "gsap_repeat_ceil_overshoot",
100112
+ severity: "warning",
100113
+ message: "GSAP repeat calculation uses `Math.ceil` which can overshoot the composition duration. For example, Math.ceil(10.5 / 2) - 1 = 5 repeats \u2192 6 cycles \xD7 2s = 12s, exceeding 10.5s.",
100114
+ fixHint: "Use `Math.floor` instead of `Math.ceil` to ensure the animation fits within the duration: `repeat: Math.floor(totalDuration / cycleDuration) - 1`. Math.floor(10.5 / 2) - 1 = 4 repeats \u2192 5 cycles \xD7 2s = 10s \u2713",
100093
100115
  snippet: truncateSnippet(snippet)
100094
100116
  });
100095
100117
  }
@@ -100489,6 +100511,24 @@ var compositionRules = [
100489
100511
  }
100490
100512
  return findings;
100491
100513
  },
100514
+ // root_composition_missing_data_duration
100515
+ ({ rootTag }) => {
100516
+ const findings = [];
100517
+ if (!rootTag) return findings;
100518
+ const compId = readAttr(rootTag.raw, "data-composition-id");
100519
+ if (!compId) return findings;
100520
+ const hasDuration = readAttr(rootTag.raw, "data-duration") !== null;
100521
+ if (!hasDuration) {
100522
+ findings.push({
100523
+ code: "root_composition_missing_data_duration",
100524
+ severity: "warning",
100525
+ message: `Root composition "${compId}" is missing data-duration. Without an explicit duration, the runtime may infer Infinity for compositions with repeating animations, causing playback issues.`,
100526
+ fixHint: 'Add data-duration="X" to the root composition element, where X is the total duration in seconds.',
100527
+ snippet: truncateSnippet(rootTag.raw)
100528
+ });
100529
+ }
100530
+ return findings;
100531
+ },
100492
100532
  // standalone_composition_wrapped_in_template
100493
100533
  ({ rawSource, options }) => {
100494
100534
  const findings = [];
@@ -100505,18 +100545,20 @@ var compositionRules = [
100505
100545
  return findings;
100506
100546
  },
100507
100547
  // root_composition_missing_html_wrapper
100508
- ({ rawSource, options }) => {
100548
+ ({ rawSource, rootTag, options }) => {
100509
100549
  const findings = [];
100510
100550
  if (options.isSubComposition) return findings;
100511
100551
  const trimmed = rawSource.trimStart().toLowerCase();
100552
+ if (trimmed.startsWith("<template")) return findings;
100512
100553
  const hasDoctype = trimmed.startsWith("<!doctype") || trimmed.startsWith("<html");
100513
100554
  const hasComposition = rawSource.includes("data-composition-id");
100514
100555
  if (hasComposition && !hasDoctype) {
100515
100556
  findings.push({
100516
100557
  code: "root_composition_missing_html_wrapper",
100517
- severity: "warning",
100518
- message: "Composition is missing <!DOCTYPE html> and <html> wrapper. The bundler and preview expect a complete HTML document for index.html files.",
100519
- fixHint: 'Wrap the composition in <!DOCTYPE html><html><head><meta charset="UTF-8"></head><body>...</body></html>.'
100558
+ severity: "error",
100559
+ message: "Composition starts with a bare element instead of a proper HTML document. An index.html that contains data-composition-id but no <!DOCTYPE html>, <html>, or <body> is a fragment \u2014 browsers quirks-mode it, the preview server cannot load it, and the bundler will fail to inject runtime scripts.",
100560
+ fixHint: 'Wrap the composition in <!DOCTYPE html><html><head><meta charset="UTF-8"></head><body>...</body></html>.',
100561
+ snippet: rootTag ? truncateSnippet(rootTag.raw) : void 0
100520
100562
  });
100521
100563
  }
100522
100564
  return findings;
@@ -100702,12 +100744,12 @@ function quantizeTimeToFrame(timeSeconds, fps) {
100702
100744
  return frameIndex / safeFps;
100703
100745
  }
100704
100746
 
100705
- // ../../node_modules/.bun/@chenglou+pretext@0.0.3/node_modules/@chenglou/pretext/dist/analysis.js
100747
+ // ../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/analysis.js
100706
100748
  var arabicScriptRe = new RegExp("\\p{Script=Arabic}", "u");
100707
100749
  var combiningMarkRe = new RegExp("\\p{M}", "u");
100708
100750
  var decimalDigitRe = new RegExp("\\p{Nd}", "u");
100709
100751
 
100710
- // ../../node_modules/.bun/@chenglou+pretext@0.0.3/node_modules/@chenglou/pretext/dist/measurement.js
100752
+ // ../../node_modules/.bun/@chenglou+pretext@0.0.5/node_modules/@chenglou/pretext/dist/measurement.js
100711
100753
  var emojiPresentationRe = new RegExp("\\p{Emoji_Presentation}", "u");
100712
100754
 
100713
100755
  // ../engine/src/services/screenshotService.ts