@hyperframes/producer 0.1.9 → 0.1.10
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 +71 -0
- package/dist/index.js.map +3 -3
- package/dist/public-server.js +71 -0
- package/dist/public-server.js.map +3 -3
- package/package.json +3 -3
package/dist/public-server.js
CHANGED
|
@@ -102379,6 +102379,76 @@ ${right2.raw}`)
|
|
|
102379
102379
|
});
|
|
102380
102380
|
}
|
|
102381
102381
|
}
|
|
102382
|
+
for (const script of scripts) {
|
|
102383
|
+
const templateLiteralSelectorPattern = /(?:querySelector|querySelectorAll)\s*\(\s*`[^`]*\$\{[^}]+\}[^`]*`\s*\)/g;
|
|
102384
|
+
let tlMatch;
|
|
102385
|
+
while ((tlMatch = templateLiteralSelectorPattern.exec(script.content)) !== null) {
|
|
102386
|
+
pushFinding({
|
|
102387
|
+
code: "template_literal_selector",
|
|
102388
|
+
severity: "error",
|
|
102389
|
+
message: "querySelector uses a template literal variable (e.g. `${compId}`). The HTML bundler's CSS parser crashes on these. Use a hardcoded string instead.",
|
|
102390
|
+
file: filePath,
|
|
102391
|
+
fixHint: "Replace the template literal variable with a hardcoded string. The bundler's CSS parser cannot handle interpolated variables in script content.",
|
|
102392
|
+
snippet: truncateSnippet(tlMatch[0])
|
|
102393
|
+
});
|
|
102394
|
+
}
|
|
102395
|
+
}
|
|
102396
|
+
{
|
|
102397
|
+
const cssTranslateSelectors = /* @__PURE__ */ new Map();
|
|
102398
|
+
const cssScaleSelectors = /* @__PURE__ */ new Map();
|
|
102399
|
+
for (const style of styles) {
|
|
102400
|
+
for (const [, selector, body] of style.content.matchAll(
|
|
102401
|
+
/([#.][a-zA-Z0-9_-]+)\s*\{([^}]+)\}/g
|
|
102402
|
+
)) {
|
|
102403
|
+
const tMatch = body?.match(/transform\s*:\s*([^;]+)/);
|
|
102404
|
+
if (!tMatch || !tMatch[1]) continue;
|
|
102405
|
+
const transformVal = tMatch[1].trim();
|
|
102406
|
+
if (/translate/i.test(transformVal)) {
|
|
102407
|
+
cssTranslateSelectors.set((selector ?? "").trim(), transformVal);
|
|
102408
|
+
}
|
|
102409
|
+
if (/scale/i.test(transformVal)) {
|
|
102410
|
+
cssScaleSelectors.set((selector ?? "").trim(), transformVal);
|
|
102411
|
+
}
|
|
102412
|
+
}
|
|
102413
|
+
}
|
|
102414
|
+
if (cssTranslateSelectors.size > 0 || cssScaleSelectors.size > 0) {
|
|
102415
|
+
for (const script of scripts) {
|
|
102416
|
+
if (!/gsap\.timeline/.test(script.content)) continue;
|
|
102417
|
+
const windows = extractGsapWindows(script.content);
|
|
102418
|
+
const conflicts = /* @__PURE__ */ new Map();
|
|
102419
|
+
for (const win of windows) {
|
|
102420
|
+
if (win.method === "fromTo") continue;
|
|
102421
|
+
const sel = win.targetSelector;
|
|
102422
|
+
const cssKey = sel.startsWith("#") || sel.startsWith(".") ? sel : `#${sel}`;
|
|
102423
|
+
const translateProps = win.properties.filter(
|
|
102424
|
+
(p) => ["x", "y", "xPercent", "yPercent"].includes(p)
|
|
102425
|
+
);
|
|
102426
|
+
const scaleProps = win.properties.filter((p) => p === "scale");
|
|
102427
|
+
const cssFromTranslate = translateProps.length > 0 ? cssTranslateSelectors.get(cssKey) : void 0;
|
|
102428
|
+
const cssFromScale = scaleProps.length > 0 ? cssScaleSelectors.get(cssKey) : void 0;
|
|
102429
|
+
if (!cssFromTranslate && !cssFromScale) continue;
|
|
102430
|
+
const existing = conflicts.get(sel) ?? {
|
|
102431
|
+
cssTransform: [cssFromTranslate, cssFromScale].filter(Boolean).join(" "),
|
|
102432
|
+
props: /* @__PURE__ */ new Set(),
|
|
102433
|
+
raw: win.raw
|
|
102434
|
+
};
|
|
102435
|
+
for (const p of [...translateProps, ...scaleProps]) existing.props.add(p);
|
|
102436
|
+
conflicts.set(sel, existing);
|
|
102437
|
+
}
|
|
102438
|
+
for (const [sel, { cssTransform, props, raw: raw2 }] of conflicts) {
|
|
102439
|
+
const propList = [...props].join("/");
|
|
102440
|
+
pushFinding({
|
|
102441
|
+
code: "gsap_css_transform_conflict",
|
|
102442
|
+
severity: "warning",
|
|
102443
|
+
message: `"${sel}" has CSS \`transform: ${cssTransform}\` and a GSAP tween animates ${propList}. GSAP will overwrite the full CSS transform, discarding any translateX(-50%) centering or CSS scale value.`,
|
|
102444
|
+
selector: sel,
|
|
102445
|
+
fixHint: `Remove the transform from CSS and use tl.fromTo('${sel}', { xPercent: -50, x: -1000 }, { xPercent: -50, x: 0 }) so GSAP owns the full transform state. tl.fromTo is exempt from this rule.`,
|
|
102446
|
+
snippet: truncateSnippet(raw2)
|
|
102447
|
+
});
|
|
102448
|
+
}
|
|
102449
|
+
}
|
|
102450
|
+
}
|
|
102451
|
+
}
|
|
102382
102452
|
const errorCount = findings.filter((finding) => finding.severity === "error").length;
|
|
102383
102453
|
const warningCount = findings.length - errorCount;
|
|
102384
102454
|
return {
|
|
@@ -102522,6 +102592,7 @@ function extractGsapWindows(script) {
|
|
|
102522
102592
|
end: animation.position + meta.effectiveDuration,
|
|
102523
102593
|
properties: meta.properties.length > 0 ? meta.properties : Object.keys(animation.properties),
|
|
102524
102594
|
overwriteAuto: meta.overwriteAuto,
|
|
102595
|
+
method: match2[1] ?? "to",
|
|
102525
102596
|
raw: raw2
|
|
102526
102597
|
});
|
|
102527
102598
|
}
|