hyperframes 0.4.13-alpha.2 → 0.4.13-alpha.4

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/cli.js CHANGED
@@ -54,7 +54,7 @@ var VERSION;
54
54
  var init_version = __esm({
55
55
  "src/version.ts"() {
56
56
  "use strict";
57
- VERSION = true ? "0.4.13-alpha.2" : "0.0.0-dev";
57
+ VERSION = true ? "0.4.13-alpha.4" : "0.0.0-dev";
58
58
  }
59
59
  });
60
60
 
@@ -5001,9 +5001,10 @@ ${right.raw}`)
5001
5001
  return findings;
5002
5002
  },
5003
5003
  // missing_gsap_script
5004
- ({ scripts }) => {
5004
+ ({ scripts, rawSource, options }) => {
5005
5005
  const allScriptTexts = scripts.filter((s2) => !/\bsrc\s*=/.test(s2.attrs)).map((s2) => s2.content);
5006
5006
  const allScriptSrcs = scripts.map((s2) => readAttr(`<script ${s2.attrs}>`, "src") || "").filter(Boolean);
5007
+ const canInheritGsapFromHost = options.isSubComposition || rawSource.trimStart().toLowerCase().startsWith("<template");
5007
5008
  const usesGsap = allScriptTexts.some(
5008
5009
  (t3) => /gsap\.(to|from|fromTo|timeline|set|registerPlugin)\b/.test(t3)
5009
5010
  );
@@ -5011,7 +5012,7 @@ ${right.raw}`)
5011
5012
  const hasInlineGsap = allScriptTexts.some(
5012
5013
  (t3) => /\/\*\s*inlined:.*gsap/i.test(t3) || /\b_gsScope\b/.test(t3) || /\bGreenSock\b/.test(t3) || /\bgsap\.(config|defaults|version)\b/.test(t3) || t3.length > 5e3 && /\bgsap\b/i.test(t3)
5013
5014
  );
5014
- if (!usesGsap || hasGsapScript || hasInlineGsap) return [];
5015
+ if (!usesGsap || hasGsapScript || hasInlineGsap || canInheritGsapFromHost) return [];
5015
5016
  return [
5016
5017
  {
5017
5018
  code: "missing_gsap_script",
@@ -31300,6 +31301,15 @@ function dedupeElementsById(elements) {
31300
31301
  function stripJsComments(source) {
31301
31302
  return source.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
31302
31303
  }
31304
+ function stripCompilerMountBootstrap(source) {
31305
+ return source.replace(
31306
+ new RegExp(
31307
+ `${COMPILER_MOUNT_BLOCK_START.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}[\\s\\S]*?${COMPILER_MOUNT_BLOCK_END.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`,
31308
+ "g"
31309
+ ),
31310
+ ""
31311
+ );
31312
+ }
31303
31313
  function detectRenderModeHints(html) {
31304
31314
  const reasons = [];
31305
31315
  const { document: document2 } = parseHTML(html);
@@ -31314,7 +31324,7 @@ function detectRenderModeHints(html) {
31314
31324
  while ((scriptMatch = scriptPattern.exec(html)) !== null) {
31315
31325
  const attrs = scriptMatch[1] || "";
31316
31326
  if (/\bsrc\s*=/i.test(attrs)) continue;
31317
- const content = stripJsComments(scriptMatch[2] || "");
31327
+ const content = stripJsComments(stripCompilerMountBootstrap(scriptMatch[2] || ""));
31318
31328
  if (!/requestAnimationFrame\s*\(/.test(content)) continue;
31319
31329
  reasons.push({
31320
31330
  code: "requestAnimationFrame",
@@ -31686,6 +31696,7 @@ function inlineSubCompositions(html, subCompositions, projectDir) {
31686
31696
  }
31687
31697
  };
31688
31698
  if (!__compId) { __run(); return; }
31699
+ ${COMPILER_MOUNT_BLOCK_START}
31689
31700
  var __selector = '[data-composition-id="' + (__compId + '').replace(/"/g, '\\\\"') + '"]';
31690
31701
  var __attempt = 0;
31691
31702
  var __tryRun = function() {
@@ -31694,6 +31705,7 @@ function inlineSubCompositions(html, subCompositions, projectDir) {
31694
31705
  requestAnimationFrame(__tryRun);
31695
31706
  };
31696
31707
  __tryRun();
31708
+ ${COMPILER_MOUNT_BLOCK_END}
31697
31709
  })()`);
31698
31710
  }
31699
31711
  scriptEl.remove();
@@ -32057,7 +32069,7 @@ async function recompileWithResolutions(compiled, resolutions, projectDir, downl
32057
32069
  renderModeHints: compiled.renderModeHints
32058
32070
  };
32059
32071
  }
32060
- var INLINE_SCRIPT_PATTERN;
32072
+ var INLINE_SCRIPT_PATTERN, COMPILER_MOUNT_BLOCK_START, COMPILER_MOUNT_BLOCK_END;
32061
32073
  var init_htmlCompiler2 = __esm({
32062
32074
  "../producer/src/services/htmlCompiler.ts"() {
32063
32075
  "use strict";
@@ -32069,6 +32081,8 @@ var init_htmlCompiler2 = __esm({
32069
32081
  init_urlDownloader2();
32070
32082
  init_deterministicFonts();
32071
32083
  INLINE_SCRIPT_PATTERN = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
32084
+ COMPILER_MOUNT_BLOCK_START = "/* __HF_COMPILER_MOUNT_START__ */";
32085
+ COMPILER_MOUNT_BLOCK_END = "/* __HF_COMPILER_MOUNT_END__ */";
32072
32086
  }
32073
32087
  });
32074
32088