@hyperframes/core 0.7.13 → 0.7.15

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.
Files changed (238) hide show
  1. package/dist/compiler/staticGuard.js +1 -1
  2. package/dist/compiler/staticGuard.js.map +1 -1
  3. package/dist/core.types.d.ts +2 -369
  4. package/dist/core.types.d.ts.map +1 -1
  5. package/dist/core.types.js +1 -84
  6. package/dist/core.types.js.map +1 -1
  7. package/dist/generators/hyperframes.d.ts +1 -1
  8. package/dist/generators/hyperframes.d.ts.map +1 -1
  9. package/dist/generators/hyperframes.js +1 -1
  10. package/dist/generators/hyperframes.js.map +1 -1
  11. package/dist/index.d.ts +5 -7
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +7 -4
  14. package/dist/index.js.map +1 -1
  15. package/dist/lint/index.d.ts +2 -2
  16. package/dist/lint/index.d.ts.map +1 -1
  17. package/dist/lint/index.js +2 -1
  18. package/dist/lint/index.js.map +1 -1
  19. package/dist/parsers/gsapConstants.d.ts +2 -12
  20. package/dist/parsers/gsapConstants.d.ts.map +1 -1
  21. package/dist/parsers/gsapConstants.js +2 -110
  22. package/dist/parsers/gsapConstants.js.map +1 -1
  23. package/dist/parsers/gsapParserAcorn.d.ts +2 -48
  24. package/dist/parsers/gsapParserAcorn.d.ts.map +1 -1
  25. package/dist/parsers/gsapParserAcorn.js +2 -1057
  26. package/dist/parsers/gsapParserAcorn.js.map +1 -1
  27. package/dist/parsers/gsapParserExports.d.ts +2 -20
  28. package/dist/parsers/gsapParserExports.d.ts.map +1 -1
  29. package/dist/parsers/gsapParserExports.js +2 -8
  30. package/dist/parsers/gsapParserExports.js.map +1 -1
  31. package/dist/parsers/gsapWriterAcorn.d.ts +2 -90
  32. package/dist/parsers/gsapWriterAcorn.d.ts.map +1 -1
  33. package/dist/parsers/gsapWriterAcorn.js +2 -2016
  34. package/dist/parsers/gsapWriterAcorn.js.map +1 -1
  35. package/dist/parsers/hfIds.d.ts +2 -16
  36. package/dist/parsers/hfIds.d.ts.map +1 -1
  37. package/dist/parsers/hfIds.js +2 -127
  38. package/dist/parsers/hfIds.js.map +1 -1
  39. package/dist/parsers/springEase.d.ts +2 -28
  40. package/dist/parsers/springEase.d.ts.map +1 -1
  41. package/dist/parsers/springEase.js +2 -69
  42. package/dist/parsers/springEase.js.map +1 -1
  43. package/dist/slideshow/index.d.ts +1 -0
  44. package/dist/slideshow/index.d.ts.map +1 -1
  45. package/dist/slideshow/index.js +1 -0
  46. package/dist/slideshow/index.js.map +1 -1
  47. package/dist/studio-api/helpers/draftMarkers.d.ts +2 -10
  48. package/dist/studio-api/helpers/draftMarkers.d.ts.map +1 -1
  49. package/dist/studio-api/helpers/draftMarkers.js +2 -10
  50. package/dist/studio-api/helpers/draftMarkers.js.map +1 -1
  51. package/dist/studio-api/helpers/finiteMutation.d.ts +2 -10
  52. package/dist/studio-api/helpers/finiteMutation.d.ts.map +1 -1
  53. package/dist/studio-api/helpers/finiteMutation.js +2 -20
  54. package/dist/studio-api/helpers/finiteMutation.js.map +1 -1
  55. package/dist/studio-api/helpers/manualEditsRenderScript.d.ts +2 -12
  56. package/dist/studio-api/helpers/manualEditsRenderScript.d.ts.map +1 -1
  57. package/dist/studio-api/helpers/manualEditsRenderScript.js +2 -632
  58. package/dist/studio-api/helpers/manualEditsRenderScript.js.map +1 -1
  59. package/dist/studio-api/helpers/screenshotClip.d.ts +2 -7
  60. package/dist/studio-api/helpers/screenshotClip.d.ts.map +1 -1
  61. package/dist/studio-api/helpers/screenshotClip.js +2 -21
  62. package/dist/studio-api/helpers/screenshotClip.js.map +1 -1
  63. package/dist/studio-api/helpers/studioMotionRenderScript.d.ts +2 -8
  64. package/dist/studio-api/helpers/studioMotionRenderScript.d.ts.map +1 -1
  65. package/dist/studio-api/helpers/studioMotionRenderScript.js +2 -207
  66. package/dist/studio-api/helpers/studioMotionRenderScript.js.map +1 -1
  67. package/dist/studio-api/index.d.ts +2 -9
  68. package/dist/studio-api/index.d.ts.map +1 -1
  69. package/dist/studio-api/index.js +2 -8
  70. package/dist/studio-api/index.js.map +1 -1
  71. package/package.json +16 -18
  72. package/dist/generated/runtime-inline.js +0 -11
  73. package/dist/hyperframe.manifest.json +0 -22
  74. package/dist/hyperframe.runtime.mjs +0 -325
  75. package/dist/lint/context.d.ts +0 -17
  76. package/dist/lint/context.d.ts.map +0 -1
  77. package/dist/lint/context.js +0 -37
  78. package/dist/lint/context.js.map +0 -1
  79. package/dist/lint/hyperframeLinter.d.ts +0 -14
  80. package/dist/lint/hyperframeLinter.d.ts.map +0 -1
  81. package/dist/lint/hyperframeLinter.js +0 -132
  82. package/dist/lint/hyperframeLinter.js.map +0 -1
  83. package/dist/lint/rules/adapters.d.ts +0 -3
  84. package/dist/lint/rules/adapters.d.ts.map +0 -1
  85. package/dist/lint/rules/adapters.js +0 -40
  86. package/dist/lint/rules/adapters.js.map +0 -1
  87. package/dist/lint/rules/captions.d.ts +0 -3
  88. package/dist/lint/rules/captions.d.ts.map +0 -1
  89. package/dist/lint/rules/captions.js +0 -242
  90. package/dist/lint/rules/captions.js.map +0 -1
  91. package/dist/lint/rules/composition.d.ts +0 -5
  92. package/dist/lint/rules/composition.d.ts.map +0 -1
  93. package/dist/lint/rules/composition.js +0 -694
  94. package/dist/lint/rules/composition.js.map +0 -1
  95. package/dist/lint/rules/core.d.ts +0 -3
  96. package/dist/lint/rules/core.d.ts.map +0 -1
  97. package/dist/lint/rules/core.js +0 -432
  98. package/dist/lint/rules/core.js.map +0 -1
  99. package/dist/lint/rules/fonts.d.ts +0 -3
  100. package/dist/lint/rules/fonts.d.ts.map +0 -1
  101. package/dist/lint/rules/fonts.js +0 -205
  102. package/dist/lint/rules/fonts.js.map +0 -1
  103. package/dist/lint/rules/gsap.d.ts +0 -4
  104. package/dist/lint/rules/gsap.d.ts.map +0 -1
  105. package/dist/lint/rules/gsap.js +0 -1039
  106. package/dist/lint/rules/gsap.js.map +0 -1
  107. package/dist/lint/rules/media.d.ts +0 -3
  108. package/dist/lint/rules/media.d.ts.map +0 -1
  109. package/dist/lint/rules/media.js +0 -491
  110. package/dist/lint/rules/media.js.map +0 -1
  111. package/dist/lint/rules/slideshow.d.ts +0 -4
  112. package/dist/lint/rules/slideshow.d.ts.map +0 -1
  113. package/dist/lint/rules/slideshow.js +0 -74
  114. package/dist/lint/rules/slideshow.js.map +0 -1
  115. package/dist/lint/rules/textures.d.ts +0 -3
  116. package/dist/lint/rules/textures.d.ts.map +0 -1
  117. package/dist/lint/rules/textures.js +0 -192
  118. package/dist/lint/rules/textures.js.map +0 -1
  119. package/dist/lint/types.d.ts +0 -36
  120. package/dist/lint/types.d.ts.map +0 -1
  121. package/dist/lint/types.js +0 -2
  122. package/dist/lint/types.js.map +0 -1
  123. package/dist/lint/utils.d.ts +0 -55
  124. package/dist/lint/utils.d.ts.map +0 -1
  125. package/dist/lint/utils.js +0 -264
  126. package/dist/lint/utils.js.map +0 -1
  127. package/dist/parsers/gsapInline.d.ts +0 -47
  128. package/dist/parsers/gsapInline.d.ts.map +0 -1
  129. package/dist/parsers/gsapInline.js +0 -513
  130. package/dist/parsers/gsapInline.js.map +0 -1
  131. package/dist/parsers/gsapParser.d.ts +0 -158
  132. package/dist/parsers/gsapParser.d.ts.map +0 -1
  133. package/dist/parsers/gsapParser.js +0 -2634
  134. package/dist/parsers/gsapParser.js.map +0 -1
  135. package/dist/parsers/gsapParser.test-helpers.d.ts +0 -49
  136. package/dist/parsers/gsapParser.test-helpers.d.ts.map +0 -1
  137. package/dist/parsers/gsapParser.test-helpers.js +0 -97
  138. package/dist/parsers/gsapParser.test-helpers.js.map +0 -1
  139. package/dist/parsers/gsapSerialize.d.ts +0 -191
  140. package/dist/parsers/gsapSerialize.d.ts.map +0 -1
  141. package/dist/parsers/gsapSerialize.js +0 -410
  142. package/dist/parsers/gsapSerialize.js.map +0 -1
  143. package/dist/parsers/gsapUnroll.d.ts +0 -7
  144. package/dist/parsers/gsapUnroll.d.ts.map +0 -1
  145. package/dist/parsers/gsapUnroll.js +0 -137
  146. package/dist/parsers/gsapUnroll.js.map +0 -1
  147. package/dist/parsers/htmlParser.d.ts +0 -27
  148. package/dist/parsers/htmlParser.d.ts.map +0 -1
  149. package/dist/parsers/htmlParser.js +0 -731
  150. package/dist/parsers/htmlParser.js.map +0 -1
  151. package/dist/studio-api/createStudioApi.d.ts +0 -10
  152. package/dist/studio-api/createStudioApi.d.ts.map +0 -1
  153. package/dist/studio-api/createStudioApi.js +0 -32
  154. package/dist/studio-api/createStudioApi.js.map +0 -1
  155. package/dist/studio-api/helpers/backupJournal.d.ts +0 -9
  156. package/dist/studio-api/helpers/backupJournal.d.ts.map +0 -1
  157. package/dist/studio-api/helpers/backupJournal.js +0 -81
  158. package/dist/studio-api/helpers/backupJournal.js.map +0 -1
  159. package/dist/studio-api/helpers/hfIdPersist.d.ts +0 -11
  160. package/dist/studio-api/helpers/hfIdPersist.d.ts.map +0 -1
  161. package/dist/studio-api/helpers/hfIdPersist.js +0 -39
  162. package/dist/studio-api/helpers/hfIdPersist.js.map +0 -1
  163. package/dist/studio-api/helpers/mediaValidation.d.ts +0 -20
  164. package/dist/studio-api/helpers/mediaValidation.d.ts.map +0 -1
  165. package/dist/studio-api/helpers/mediaValidation.js +0 -56
  166. package/dist/studio-api/helpers/mediaValidation.js.map +0 -1
  167. package/dist/studio-api/helpers/mime.d.ts +0 -4
  168. package/dist/studio-api/helpers/mime.d.ts.map +0 -1
  169. package/dist/studio-api/helpers/mime.js +0 -39
  170. package/dist/studio-api/helpers/mime.js.map +0 -1
  171. package/dist/studio-api/helpers/previewAdapter.d.ts +0 -43
  172. package/dist/studio-api/helpers/previewAdapter.d.ts.map +0 -1
  173. package/dist/studio-api/helpers/previewAdapter.js +0 -118
  174. package/dist/studio-api/helpers/previewAdapter.js.map +0 -1
  175. package/dist/studio-api/helpers/projectSignature.d.ts +0 -5
  176. package/dist/studio-api/helpers/projectSignature.d.ts.map +0 -1
  177. package/dist/studio-api/helpers/projectSignature.js +0 -154
  178. package/dist/studio-api/helpers/projectSignature.js.map +0 -1
  179. package/dist/studio-api/helpers/safePath.d.ts +0 -12
  180. package/dist/studio-api/helpers/safePath.d.ts.map +0 -1
  181. package/dist/studio-api/helpers/safePath.js +0 -38
  182. package/dist/studio-api/helpers/safePath.js.map +0 -1
  183. package/dist/studio-api/helpers/sourceMutation.d.ts +0 -28
  184. package/dist/studio-api/helpers/sourceMutation.d.ts.map +0 -1
  185. package/dist/studio-api/helpers/sourceMutation.js +0 -339
  186. package/dist/studio-api/helpers/sourceMutation.js.map +0 -1
  187. package/dist/studio-api/helpers/subComposition.d.ts +0 -20
  188. package/dist/studio-api/helpers/subComposition.d.ts.map +0 -1
  189. package/dist/studio-api/helpers/subComposition.js +0 -289
  190. package/dist/studio-api/helpers/subComposition.js.map +0 -1
  191. package/dist/studio-api/helpers/waveform.d.ts +0 -4
  192. package/dist/studio-api/helpers/waveform.d.ts.map +0 -1
  193. package/dist/studio-api/helpers/waveform.js +0 -80
  194. package/dist/studio-api/helpers/waveform.js.map +0 -1
  195. package/dist/studio-api/routes/files.d.ts +0 -4
  196. package/dist/studio-api/routes/files.d.ts.map +0 -1
  197. package/dist/studio-api/routes/files.js +0 -1200
  198. package/dist/studio-api/routes/files.js.map +0 -1
  199. package/dist/studio-api/routes/fonts.d.ts +0 -3
  200. package/dist/studio-api/routes/fonts.d.ts.map +0 -1
  201. package/dist/studio-api/routes/fonts.js +0 -157
  202. package/dist/studio-api/routes/fonts.js.map +0 -1
  203. package/dist/studio-api/routes/lint.d.ts +0 -4
  204. package/dist/studio-api/routes/lint.d.ts.map +0 -1
  205. package/dist/studio-api/routes/lint.js +0 -29
  206. package/dist/studio-api/routes/lint.js.map +0 -1
  207. package/dist/studio-api/routes/preview.d.ts +0 -4
  208. package/dist/studio-api/routes/preview.d.ts.map +0 -1
  209. package/dist/studio-api/routes/preview.js +0 -331
  210. package/dist/studio-api/routes/preview.js.map +0 -1
  211. package/dist/studio-api/routes/projects.d.ts +0 -4
  212. package/dist/studio-api/routes/projects.d.ts.map +0 -1
  213. package/dist/studio-api/routes/projects.js +0 -45
  214. package/dist/studio-api/routes/projects.js.map +0 -1
  215. package/dist/studio-api/routes/registry.d.ts +0 -4
  216. package/dist/studio-api/routes/registry.d.ts.map +0 -1
  217. package/dist/studio-api/routes/registry.js +0 -31
  218. package/dist/studio-api/routes/registry.js.map +0 -1
  219. package/dist/studio-api/routes/render.d.ts +0 -4
  220. package/dist/studio-api/routes/render.d.ts.map +0 -1
  221. package/dist/studio-api/routes/render.js +0 -269
  222. package/dist/studio-api/routes/render.js.map +0 -1
  223. package/dist/studio-api/routes/storyboard.d.ts +0 -4
  224. package/dist/studio-api/routes/storyboard.d.ts.map +0 -1
  225. package/dist/studio-api/routes/storyboard.js +0 -65
  226. package/dist/studio-api/routes/storyboard.js.map +0 -1
  227. package/dist/studio-api/routes/thumbnail.d.ts +0 -4
  228. package/dist/studio-api/routes/thumbnail.d.ts.map +0 -1
  229. package/dist/studio-api/routes/thumbnail.js +0 -107
  230. package/dist/studio-api/routes/thumbnail.js.map +0 -1
  231. package/dist/studio-api/routes/waveform.d.ts +0 -4
  232. package/dist/studio-api/routes/waveform.d.ts.map +0 -1
  233. package/dist/studio-api/routes/waveform.js +0 -41
  234. package/dist/studio-api/routes/waveform.js.map +0 -1
  235. package/dist/studio-api/types.d.ts +0 -120
  236. package/dist/studio-api/types.d.ts.map +0 -1
  237. package/dist/studio-api/types.js +0 -2
  238. package/dist/studio-api/types.js.map +0 -1
@@ -1,331 +0,0 @@
1
- import { existsSync, readFileSync, statSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { injectScriptsIntoHtml, stripEmbeddedRuntimeScripts } from "../../compiler/htmlDocument.js";
4
- import { resolveWithinProject } from "../helpers/safePath.js";
5
- import { getMimeType } from "../helpers/mime.js";
6
- import { buildSubCompositionHtml } from "../helpers/subComposition.js";
7
- import { createProjectSignature } from "../helpers/projectSignature.js";
8
- import { createStudioMotionRenderBodyScript, STUDIO_MOTION_PATH, } from "../helpers/studioMotionRenderScript.js";
9
- import { ensureHfIds } from "../../parsers/hfIds.js";
10
- import { persistHfIdsIfNeeded } from "../helpers/hfIdPersist.js";
11
- const PROJECT_SIGNATURE_META = "hyperframes-project-signature";
12
- const GSAP_CDN_VERSION = "3.15.0";
13
- const GSAP_CDN_SCRIPT = `<script src="https://cdn.jsdelivr.net/npm/gsap@${GSAP_CDN_VERSION}/dist/gsap.min.js"></script>`;
14
- const GSAP_CUSTOM_EASE_CDN_SCRIPT = `<script src="https://cdn.jsdelivr.net/npm/gsap@${GSAP_CDN_VERSION}/dist/CustomEase.min.js"></script>`;
15
- const GSAP_MOTION_PATH_CDN_SCRIPT = `<script src="https://cdn.jsdelivr.net/npm/gsap@${GSAP_CDN_VERSION}/dist/MotionPathPlugin.min.js"></script>`;
16
- function resolveProjectSignature(adapter, projectDir) {
17
- return adapter.getProjectSignature?.(projectDir) ?? createProjectSignature(projectDir);
18
- }
19
- function injectProjectSignature(html, signature) {
20
- const tag = `<meta name="${PROJECT_SIGNATURE_META}" content="${signature}">`;
21
- if (html.includes(`name="${PROJECT_SIGNATURE_META}"`)) {
22
- return html.replace(new RegExp(`<meta\\s+name=["']${PROJECT_SIGNATURE_META}["'][^>]*>`, "i"), tag);
23
- }
24
- if (html.includes("</head>"))
25
- return html.replace("</head>", `${tag}\n</head>`);
26
- return `${tag}\n${html}`;
27
- }
28
- function readStudioMotionManifestContent(projectDir) {
29
- const manifestPath = join(projectDir, STUDIO_MOTION_PATH);
30
- if (!existsSync(manifestPath))
31
- return "";
32
- try {
33
- return readFileSync(manifestPath, "utf-8");
34
- }
35
- catch {
36
- return "";
37
- }
38
- }
39
- function parseStudioMotionManifestContent(content) {
40
- try {
41
- const parsed = JSON.parse(content);
42
- const motions = Array.isArray(parsed.motions) ? parsed.motions : [];
43
- return {
44
- hasMotion: motions.length > 0,
45
- hasCustomEase: motions.some((motion) => Boolean(motion?.customEase)),
46
- };
47
- }
48
- catch {
49
- return { hasMotion: false, hasCustomEase: false };
50
- }
51
- }
52
- function injectScriptTagIntoHead(html, scriptTag) {
53
- if (html.includes("</head>"))
54
- return html.replace("</head>", `${scriptTag}\n</head>`);
55
- return `${scriptTag}\n${html}`;
56
- }
57
- function htmlHasGsap(html) {
58
- // Only match GSAP references outside <template> elements — scripts inside
59
- // templates are inert when cloned and don't make GSAP globally available.
60
- const outsideTemplates = html.replace(/<template\b[^>]*>[\s\S]*?<\/template>/gi, "");
61
- return (/<script\b[^>]*src=["'][^"']*gsap/i.test(outsideTemplates) ||
62
- /\/\*\s*inlined:.*gsap/i.test(outsideTemplates) ||
63
- /\b(GreenSock|_gsScope)\b/.test(outsideTemplates) ||
64
- /\bgsap\.(config|defaults|registerPlugin|version)\b/.test(outsideTemplates));
65
- }
66
- function htmlHasCustomEase(html) {
67
- return (/<script\b[^>]*src=["'][^"']*CustomEase/i.test(html) ||
68
- /\bwindow\.CustomEase\b/.test(html) ||
69
- /\bCustomEase\s*=\s*/.test(html));
70
- }
71
- // A composition that drives motion via GSAP's `motionPath` (e.g. a studio-created
72
- // motion path written into the single-source timeline) needs MotionPathPlugin
73
- // registered before the timeline first renders — otherwise the initial seek
74
- // throws "Invalid property motionPath ... Missing plugin?". Detect it anywhere in
75
- // the bundle (the plugin registers globally, so sub-composition usage counts too).
76
- function htmlUsesMotionPath(html) {
77
- return /motionPath\s*[:{]/.test(html);
78
- }
79
- function htmlHasMotionPathPlugin(html) {
80
- return (/<script\b[^>]*src=["'][^"']*MotionPathPlugin/i.test(html) ||
81
- /\bwindow\.MotionPathPlugin\b/.test(html) ||
82
- /\bMotionPathPlugin\s*=\s*/.test(html));
83
- }
84
- function injectMotionPathPluginIfNeeded(html) {
85
- if (!htmlUsesMotionPath(html) || htmlHasMotionPathPlugin(html))
86
- return html;
87
- // The plugin registers onto an already-loaded gsap, so it must come AFTER the
88
- // core gsap script — which often lives at body-end, not <head>. Insert it
89
- // directly after the gsap script tag; only fall back to <head> if none is found
90
- // (e.g. gsap is inlined).
91
- const gsapScript = /<script\b[^>]*\bsrc=["'][^"']*\/gsap(\.min)?\.js["'][^>]*>\s*<\/script>/i;
92
- const match = html.match(gsapScript);
93
- if (match) {
94
- // Match the plugin version to the composition's own gsap so the plugin
95
- // registers cleanly (a minor-version skew triggers a GSAP compatibility warning).
96
- const version = match[0].match(/gsap@([\d.]+)/)?.[1] ?? GSAP_CDN_VERSION;
97
- const pluginTag = `<script src="https://cdn.jsdelivr.net/npm/gsap@${version}/dist/MotionPathPlugin.min.js"></script>`;
98
- const end = html.indexOf(match[0]) + match[0].length;
99
- return html.slice(0, end) + "\n" + pluginTag + html.slice(end);
100
- }
101
- return injectScriptTagIntoHead(html, GSAP_MOTION_PATH_CDN_SCRIPT);
102
- }
103
- function injectStudioMotionDependencies(html, manifestContent) {
104
- const manifest = parseStudioMotionManifestContent(manifestContent);
105
- if (!manifest.hasMotion)
106
- return html;
107
- let next = html;
108
- if (!htmlHasGsap(next))
109
- next = injectScriptTagIntoHead(next, GSAP_CDN_SCRIPT);
110
- if (manifest.hasCustomEase && !htmlHasCustomEase(next)) {
111
- next = injectScriptTagIntoHead(next, GSAP_CUSTOM_EASE_CDN_SCRIPT);
112
- }
113
- return next;
114
- }
115
- function injectStudioMotionScript(html, projectDir, activeCompositionPath) {
116
- const manifestContent = readStudioMotionManifestContent(projectDir);
117
- const script = createStudioMotionRenderBodyScript(manifestContent, {
118
- activeCompositionPath,
119
- });
120
- if (!script)
121
- return html;
122
- return injectScriptsIntoHtml(injectStudioMotionDependencies(html, manifestContent), [], [script], false);
123
- }
124
- const GSAP_CDN_FALLBACK_SCRIPT = `<script data-hf-gsap-fallback>
125
- (function(){
126
- var cdnBase="https://cdn.jsdelivr.net/npm/gsap@${GSAP_CDN_VERSION}/dist/";
127
- var loaded={};
128
- function loadFallback(file){
129
- if(loaded[file])return loaded[file];
130
- return loaded[file]=new Promise(function(ok,fail){
131
- var s=document.createElement("script");
132
- s.src=cdnBase+file;s.onload=ok;s.onerror=fail;
133
- document.head.appendChild(s);
134
- });
135
- }
136
- document.addEventListener("error",function(e){
137
- var t=e.target;
138
- if(!t||t.tagName!=="SCRIPT"||!t.src)return;
139
- var m=t.src.match(/gsap[^/]*\\/dist\\/(.+\\.js)/);
140
- if(m)loadFallback(m[1]);
141
- },true);
142
- })();
143
- </script>`;
144
- function injectGsapCdnFallback(html) {
145
- if (html.includes("data-hf-gsap-fallback"))
146
- return html;
147
- if (html.includes("<head>"))
148
- return html.replace("<head>", "<head>" + GSAP_CDN_FALLBACK_SCRIPT);
149
- return GSAP_CDN_FALLBACK_SCRIPT + html;
150
- }
151
- function injectStudioPreviewAugmentations(html, adapter, projectDir, activeCompositionPath) {
152
- return injectStudioMotionScript(injectMotionPathPluginIfNeeded(injectGsapCdnFallback(injectProjectSignature(html, resolveProjectSignature(adapter, projectDir)))), projectDir, activeCompositionPath);
153
- }
154
- async function transformPreviewHtml(html, adapter, project, activeCompositionPath) {
155
- if (!adapter.transformPreviewHtml)
156
- return html;
157
- try {
158
- return await adapter.transformPreviewHtml({
159
- html,
160
- project,
161
- activeCompositionPath,
162
- });
163
- }
164
- catch (err) {
165
- console.warn("[Studio] preview transform failed, using original HTML:", err);
166
- return html;
167
- }
168
- }
169
- function resolveProjectMainHtml(projectDir, projectId) {
170
- const indexPath = join(projectDir, "index.html");
171
- if (existsSync(indexPath)) {
172
- return { html: readFileSync(indexPath, "utf-8"), compositionPath: "index.html" };
173
- }
174
- const blockHtmlPath = join(projectDir, `${projectId}.html`);
175
- if (existsSync(blockHtmlPath)) {
176
- return { html: readFileSync(blockHtmlPath, "utf-8"), compositionPath: `${projectId}.html` };
177
- }
178
- return null;
179
- }
180
- export function registerPreviewRoutes(api, adapter) {
181
- const previewCacheHeaders = (etag) => ({
182
- "Cache-Control": "private, no-cache",
183
- ETag: etag,
184
- });
185
- // Bundled composition preview
186
- // fallow-ignore-next-line complexity
187
- api.get("/projects/:id/preview", async (c) => {
188
- const project = await adapter.resolveProject(c.req.param("id"));
189
- if (!project)
190
- return c.json({ error: "not found" }, 404);
191
- const signature = resolveProjectSignature(adapter, project.dir);
192
- const etag = `"preview:${signature}"`;
193
- const ifNoneMatch = c.req.header("If-None-Match");
194
- if (ifNoneMatch === etag) {
195
- return new Response(null, { status: 304, headers: previewCacheHeaders(etag) });
196
- }
197
- // Normalize + persist data-hf-id to disk before bundle reads it. Idempotent.
198
- const diskMain = resolveProjectMainHtml(project.dir, project.id);
199
- const normalizedDisk = diskMain
200
- ? persistHfIdsIfNeeded(join(project.dir, diskMain.compositionPath), diskMain.html)
201
- : null;
202
- try {
203
- let bundled = await adapter.bundle(project.dir);
204
- let mainCompositionPath = "index.html";
205
- if (!bundled) {
206
- if (!diskMain)
207
- return c.text("not found", 404);
208
- // Disk HTML may carry a baked inline runtime from a prior export; strip
209
- // it so the preview runtime injected below isn't double-loaded (the
210
- // bundled path already strips via htmlBundler). Idempotent if absent.
211
- bundled = stripEmbeddedRuntimeScripts(normalizedDisk ?? diskMain.html);
212
- mainCompositionPath = diskMain.compositionPath;
213
- }
214
- // Inject runtime if not already present (check URL pattern and bundler attribute)
215
- if (!bundled.includes("hyperframe.runtime") &&
216
- !bundled.includes("hyperframes-preview-runtime")) {
217
- const runtimeTag = `<script src="${adapter.runtimeUrl}"></script>`;
218
- bundled = bundled.includes("</body>")
219
- ? bundled.replace("</body>", `${runtimeTag}\n</body>`)
220
- : bundled + `\n${runtimeTag}`;
221
- }
222
- // Inject <base> for relative asset resolution
223
- const baseHref = `/api/projects/${project.id}/preview/`;
224
- if (!bundled.includes("<base")) {
225
- bundled = bundled.replace(/<head>/i, `<head><base href="${baseHref}">`);
226
- }
227
- // ensureHfIds runs after transformPreviewHtml in case the adapter injected
228
- // new elements. On the no-bundle path bundled=normalizedDisk (already tagged)
229
- // so this is idempotent. On the bundled path the bundler may return untagged
230
- // HTML (stale cache); because ids are content-keyed the minted ids will match
231
- // the ids already written to disk by persistHfIdsIfNeeded above.
232
- bundled = injectStudioPreviewAugmentations(ensureHfIds(await transformPreviewHtml(bundled, adapter, project, mainCompositionPath)), adapter, project.dir, mainCompositionPath);
233
- return c.html(bundled, 200, previewCacheHeaders(etag));
234
- }
235
- catch {
236
- // Re-read disk on bundle failure so we serve the latest file content,
237
- // not the pre-request snapshot that may have been saved over.
238
- const fallback = resolveProjectMainHtml(project.dir, project.id);
239
- if (fallback) {
240
- const fallbackHtml = persistHfIdsIfNeeded(join(project.dir, fallback.compositionPath), fallback.html);
241
- return c.html(injectStudioPreviewAugmentations(await transformPreviewHtml(fallbackHtml, adapter, project, fallback.compositionPath), adapter, project.dir, fallback.compositionPath), 200, previewCacheHeaders(etag));
242
- }
243
- return c.text("not found", 404);
244
- }
245
- });
246
- // Sub-composition preview
247
- api.get("/projects/:id/preview/comp/*", async (c) => {
248
- const project = await adapter.resolveProject(c.req.param("id"));
249
- if (!project)
250
- return c.json({ error: "not found" }, 404);
251
- const signature = resolveProjectSignature(adapter, project.dir);
252
- const compPath = decodeURIComponent(c.req.path.replace(`/projects/${project.id}/preview/comp/`, "").split("?")[0] ?? "");
253
- const compFile = resolveWithinProject(project.dir, compPath);
254
- if (!compFile || !existsSync(compFile) || !statSync(compFile).isFile()) {
255
- return c.text("not found", 404);
256
- }
257
- const etag = `"comp:${compPath}:${signature}"`;
258
- const ifNoneMatch = c.req.header("If-None-Match");
259
- if (ifNoneMatch === etag) {
260
- return new Response(null, { status: 304, headers: previewCacheHeaders(etag) });
261
- }
262
- const baseHref = `/api/projects/${project.id}/preview/`;
263
- let html = buildSubCompositionHtml(project.dir, compPath, adapter.runtimeUrl, baseHref);
264
- if (!html)
265
- return c.text("not found", 404);
266
- html = ensureHfIds(await transformPreviewHtml(html, adapter, project, compPath));
267
- return c.html(injectStudioPreviewAugmentations(html, adapter, project.dir, compPath), 200, previewCacheHeaders(etag));
268
- });
269
- // Static asset serving (with range request support for audio/video seeking)
270
- // fallow-ignore-next-line complexity
271
- api.get("/projects/:id/preview/*", async (c) => {
272
- const project = await adapter.resolveProject(c.req.param("id"));
273
- if (!project)
274
- return c.json({ error: "not found" }, 404);
275
- const subPath = decodeURIComponent(c.req.path.replace(`/projects/${project.id}/preview/`, "").split("?")[0] ?? "");
276
- const file = resolveWithinProject(project.dir, subPath);
277
- if (!file) {
278
- return c.text("not found", 404);
279
- }
280
- const stat = existsSync(file) ? statSync(file) : null;
281
- if (!stat?.isFile()) {
282
- return c.text("not found", 404);
283
- }
284
- const contentType = getMimeType(subPath);
285
- const isText = /\.(html|css|js|json|svg|txt|md|cube)$/i.test(subPath);
286
- const etag = `"${stat.mtimeMs.toString(36)}-${stat.size.toString(36)}"`;
287
- const cacheHeaders = isText
288
- ? { "Cache-Control": "no-store" }
289
- : { "Cache-Control": "private, max-age=3600, must-revalidate", ETag: etag };
290
- if (!isText) {
291
- const ifNoneMatch = c.req.header("If-None-Match");
292
- if (ifNoneMatch === etag) {
293
- return new Response(null, { status: 304, headers: cacheHeaders });
294
- }
295
- }
296
- const buffer = isText
297
- ? Buffer.from(readFileSync(file, "utf-8"), "utf-8")
298
- : readFileSync(file);
299
- const totalSize = buffer.length;
300
- // Support byte-range requests so browsers can seek audio/video elements.
301
- const rangeHeader = c.req.header("Range");
302
- if (rangeHeader) {
303
- const match = /bytes=(\d+)-(\d*)/.exec(rangeHeader);
304
- if (match) {
305
- const start = parseInt(match[1], 10);
306
- const end = match[2] ? parseInt(match[2], 10) : totalSize - 1;
307
- const safeEnd = Math.min(end, totalSize - 1);
308
- const chunkSize = safeEnd - start + 1;
309
- return new Response(new Uint8Array(buffer.slice(start, safeEnd + 1)), {
310
- status: 206,
311
- headers: {
312
- ...cacheHeaders,
313
- "Content-Type": contentType,
314
- "Content-Range": `bytes ${start}-${safeEnd}/${totalSize}`,
315
- "Accept-Ranges": "bytes",
316
- "Content-Length": String(chunkSize),
317
- },
318
- });
319
- }
320
- }
321
- return new Response(new Uint8Array(buffer), {
322
- headers: {
323
- ...cacheHeaders,
324
- "Content-Type": contentType,
325
- "Accept-Ranges": "bytes",
326
- "Content-Length": String(totalSize),
327
- },
328
- });
329
- });
330
- }
331
- //# sourceMappingURL=preview.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../src/studio-api/routes/preview.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAEpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EACL,kCAAkC,EAClC,kBAAkB,GACnB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,sBAAsB,GAAG,+BAA+B,CAAC;AAC/D,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,eAAe,GAAG,kDAAkD,gBAAgB,8BAA8B,CAAC;AACzH,MAAM,2BAA2B,GAAG,kDAAkD,gBAAgB,oCAAoC,CAAC;AAC3I,MAAM,2BAA2B,GAAG,kDAAkD,gBAAgB,0CAA0C,CAAC;AAEjJ,SAAS,uBAAuB,CAAC,OAAyB,EAAE,UAAkB;IAC5E,OAAO,OAAO,CAAC,mBAAmB,EAAE,CAAC,UAAU,CAAC,IAAI,sBAAsB,CAAC,UAAU,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAY,EAAE,SAAiB;IAC7D,MAAM,GAAG,GAAG,eAAe,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CAAC,CAAC;gBACtC,OAAO,IAAI,QAAQ,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE;oBACpE,MAAM,EAAE,GAAG;oBACX,OAAO,EAAE;wBACP,GAAG,YAAY;wBACf,cAAc,EAAE,WAAW;wBAC3B,eAAe,EAAE,SAAS,KAAK,IAAI,OAAO,IAAI,SAAS,EAAE;wBACzD,eAAe,EAAE,OAAO;wBACxB,gBAAgB,EAAE,MAAM,CAAC,SAAS,CAAC;qBACpC;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,IAAI,QAAQ,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;YAC1C,OAAO,EAAE;gBACP,GAAG,YAAY;gBACf,cAAc,EAAE,WAAW;gBAC3B,eAAe,EAAE,OAAO;gBACxB,gBAAgB,EAAE,MAAM,CAAC,SAAS,CAAC;aACpC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { Hono } from "hono";
2
- import type { StudioApiAdapter } from "../types.js";
3
- export declare function registerProjectRoutes(api: Hono, adapter: StudioApiAdapter): void;
4
- //# sourceMappingURL=projects.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../../src/studio-api/routes/projects.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAoBpD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CA0BhF"}
@@ -1,45 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { isInHiddenOrVendorDir, walkDir } from "../helpers/safePath.js";
4
- const COMPOSITION_ID_RE = /data-composition-id\s*=/;
5
- async function filterCompositionFiles(projectDir, files) {
6
- const htmlFiles = files.filter((f) => f.endsWith(".html") && !isInHiddenOrVendorDir(f));
7
- const checks = await Promise.all(htmlFiles.map(async (f) => {
8
- try {
9
- const content = await readFile(join(projectDir, f), "utf-8");
10
- return COMPOSITION_ID_RE.test(content);
11
- }
12
- catch {
13
- return false;
14
- }
15
- }));
16
- return htmlFiles.filter((_, i) => checks[i]);
17
- }
18
- export function registerProjectRoutes(api, adapter) {
19
- // List all projects
20
- api.get("/projects", async (c) => {
21
- const projects = await adapter.listProjects();
22
- return c.json({ projects });
23
- });
24
- // Resolve session to project (multi-project mode)
25
- api.get("/resolve-session/:sessionId", async (c) => {
26
- if (!adapter.resolveSession) {
27
- return c.json({ error: "not available" }, 404);
28
- }
29
- const { sessionId } = c.req.param();
30
- const result = await adapter.resolveSession(sessionId);
31
- if (!result)
32
- return c.json({ error: "Session not found" }, 404);
33
- return c.json(result);
34
- });
35
- // Project file tree
36
- api.get("/projects/:id", async (c) => {
37
- const project = await adapter.resolveProject(c.req.param("id"));
38
- if (!project)
39
- return c.json({ error: "not found" }, 404);
40
- const files = walkDir(project.dir);
41
- const compositions = await filterCompositionFiles(project.dir, files);
42
- return c.json({ id: project.id, dir: project.dir, title: project.title, files, compositions });
43
- });
44
- }
45
- //# sourceMappingURL=projects.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../../src/studio-api/routes/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAExE,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD,KAAK,UAAU,sBAAsB,CAAC,UAAkB,EAAE,KAAe;IACvE,MAAM,SAAS,GAAG,KAAK,CAAC,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K,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAAE,GAAG,CAAC,CAAC;QAChE,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,oBAAoB;IACpB,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,OAAO;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,GAAG,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,YAAY,GAAG,MAAM,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { Hono } from "hono";
2
- import type { StudioApiAdapter } from "../types.js";
3
- export declare function registerRegistryRoutes(api: Hono, adapter: StudioApiAdapter): void;
4
- //# sourceMappingURL=registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/studio-api/routes/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CA8BjF"}
@@ -1,31 +0,0 @@
1
- export function registerRegistryRoutes(api, adapter) {
2
- api.get("/registry/blocks", async (c) => {
3
- if (!adapter.listRegistryCatalog) {
4
- return c.json({ error: "Registry not available" }, 501);
5
- }
6
- const items = await adapter.listRegistryCatalog();
7
- return c.json(items);
8
- });
9
- // fallow-ignore-next-line complexity
10
- api.post("/projects/:id/registry/install", async (c) => {
11
- if (!adapter.installRegistryBlock) {
12
- return c.json({ error: "Registry install not available" }, 501);
13
- }
14
- const project = await adapter.resolveProject(c.req.param("id"));
15
- if (!project)
16
- return c.json({ error: "Project not found" }, 404);
17
- const body = await c.req.json().catch(() => null);
18
- if (!body?.blockName) {
19
- return c.json({ error: "blockName is required" }, 400);
20
- }
21
- try {
22
- const result = await adapter.installRegistryBlock({ project, blockName: body.blockName });
23
- return c.json(result);
24
- }
25
- catch (err) {
26
- const message = err instanceof Error ? err.message : "Install failed";
27
- return c.json({ error: message }, 500);
28
- }
29
- });
30
- }
31
- //# sourceMappingURL=registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/studio-api/routes/registry.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,sBAAsB,CAAC,GAAS,EAAE,OAAyB;IACzE,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC;YACjC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,wBAAwB,EAAE,EAAE,GAAG,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,mBAA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KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { Hono } from "hono";
2
- import type { StudioApiAdapter } from "../types.js";
3
- export declare function registerRenderRoutes(api: Hono, adapter: StudioApiAdapter): void;
4
- //# sourceMappingURL=render.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/studio-api/routes/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAIjC,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,aAAa,CAAC;AAMpE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CA0R/E"}