@hyperframes/producer 0.4.13-alpha.1 → 0.4.13-alpha.3
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/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +5 -5
- package/dist/index.js +17 -3
- package/dist/index.js.map +2 -2
- package/dist/public-server.js +17 -3
- package/dist/public-server.js.map +2 -2
- package/dist/services/htmlCompiler.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/public-server.js
CHANGED
|
@@ -102925,9 +102925,10 @@ ${right2.raw}`)
|
|
|
102925
102925
|
return findings;
|
|
102926
102926
|
},
|
|
102927
102927
|
// missing_gsap_script
|
|
102928
|
-
({ scripts }) => {
|
|
102928
|
+
({ scripts, rawSource, options }) => {
|
|
102929
102929
|
const allScriptTexts = scripts.filter((s) => !/\bsrc\s*=/.test(s.attrs)).map((s) => s.content);
|
|
102930
102930
|
const allScriptSrcs = scripts.map((s) => readAttr(`<script ${s.attrs}>`, "src") || "").filter(Boolean);
|
|
102931
|
+
const canInheritGsapFromHost = options.isSubComposition || rawSource.trimStart().toLowerCase().startsWith("<template");
|
|
102931
102932
|
const usesGsap = allScriptTexts.some(
|
|
102932
102933
|
(t) => /gsap\.(to|from|fromTo|timeline|set|registerPlugin)\b/.test(t)
|
|
102933
102934
|
);
|
|
@@ -102935,7 +102936,7 @@ ${right2.raw}`)
|
|
|
102935
102936
|
const hasInlineGsap = allScriptTexts.some(
|
|
102936
102937
|
(t) => /\/\*\s*inlined:.*gsap/i.test(t) || /\b_gsScope\b/.test(t) || /\bGreenSock\b/.test(t) || /\bgsap\.(config|defaults|version)\b/.test(t) || t.length > 5e3 && /\bgsap\b/i.test(t)
|
|
102937
102938
|
);
|
|
102938
|
-
if (!usesGsap || hasGsapScript || hasInlineGsap) return [];
|
|
102939
|
+
if (!usesGsap || hasGsapScript || hasInlineGsap || canInheritGsapFromHost) return [];
|
|
102939
102940
|
return [
|
|
102940
102941
|
{
|
|
102941
102942
|
code: "missing_gsap_script",
|
|
@@ -108634,9 +108635,20 @@ function dedupeElementsById(elements) {
|
|
|
108634
108635
|
return Array.from(deduped.values());
|
|
108635
108636
|
}
|
|
108636
108637
|
var INLINE_SCRIPT_PATTERN = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
|
|
108638
|
+
var COMPILER_MOUNT_BLOCK_START = "/* __HF_COMPILER_MOUNT_START__ */";
|
|
108639
|
+
var COMPILER_MOUNT_BLOCK_END = "/* __HF_COMPILER_MOUNT_END__ */";
|
|
108637
108640
|
function stripJsComments(source2) {
|
|
108638
108641
|
return source2.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
108639
108642
|
}
|
|
108643
|
+
function stripCompilerMountBootstrap(source2) {
|
|
108644
|
+
return source2.replace(
|
|
108645
|
+
new RegExp(
|
|
108646
|
+
`${COMPILER_MOUNT_BLOCK_START.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}[\\s\\S]*?${COMPILER_MOUNT_BLOCK_END.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`,
|
|
108647
|
+
"g"
|
|
108648
|
+
),
|
|
108649
|
+
""
|
|
108650
|
+
);
|
|
108651
|
+
}
|
|
108640
108652
|
function detectRenderModeHints(html) {
|
|
108641
108653
|
const reasons = [];
|
|
108642
108654
|
const { document: document2 } = parseHTML(html);
|
|
@@ -108651,7 +108663,7 @@ function detectRenderModeHints(html) {
|
|
|
108651
108663
|
while ((scriptMatch = scriptPattern.exec(html)) !== null) {
|
|
108652
108664
|
const attrs = scriptMatch[1] || "";
|
|
108653
108665
|
if (/\bsrc\s*=/i.test(attrs)) continue;
|
|
108654
|
-
const content = stripJsComments(scriptMatch[2] || "");
|
|
108666
|
+
const content = stripJsComments(stripCompilerMountBootstrap(scriptMatch[2] || ""));
|
|
108655
108667
|
if (!/requestAnimationFrame\s*\(/.test(content)) continue;
|
|
108656
108668
|
reasons.push({
|
|
108657
108669
|
code: "requestAnimationFrame",
|
|
@@ -109023,6 +109035,7 @@ function inlineSubCompositions(html, subCompositions, projectDir) {
|
|
|
109023
109035
|
}
|
|
109024
109036
|
};
|
|
109025
109037
|
if (!__compId) { __run(); return; }
|
|
109038
|
+
${COMPILER_MOUNT_BLOCK_START}
|
|
109026
109039
|
var __selector = '[data-composition-id="' + (__compId + '').replace(/"/g, '\\\\"') + '"]';
|
|
109027
109040
|
var __attempt = 0;
|
|
109028
109041
|
var __tryRun = function() {
|
|
@@ -109031,6 +109044,7 @@ function inlineSubCompositions(html, subCompositions, projectDir) {
|
|
|
109031
109044
|
requestAnimationFrame(__tryRun);
|
|
109032
109045
|
};
|
|
109033
109046
|
__tryRun();
|
|
109047
|
+
${COMPILER_MOUNT_BLOCK_END}
|
|
109034
109048
|
})()`);
|
|
109035
109049
|
}
|
|
109036
109050
|
scriptEl.remove();
|