@hyperframes/studio-server 0.9.21 → 0.9.23

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  probeAudioTrack
3
- } from "./chunk-Y6EZUBYR.js";
3
+ } from "./chunk-IMOR42OE.js";
4
4
  import {
5
5
  resolveWithinProject
6
6
  } from "./chunk-QF7MFJJU.js";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  PROXY_PARAMS_VERSION,
3
3
  resolveProxy
4
- } from "./chunk-46USOJVM.js";
4
+ } from "./chunk-POKRV543.js";
5
5
  import {
6
6
  createMediaCodecProbeCache,
7
7
  proxyVariantFor,
8
8
  recordProxyPrewarm,
9
9
  scanProjectMedia,
10
10
  shouldPrewarmProxy
11
- } from "./chunk-JBIB7WJP.js";
11
+ } from "./chunk-UBOFRR6H.js";
12
12
 
13
13
  // src/helpers/mediaProxyPreview.ts
14
14
  import { resolve } from "path";
15
15
  import { formatPreviewProxyBox } from "@hyperframes/core";
16
- import { insertBeforeCloseTag } from "@hyperframes/core/compiler/html-document";
16
+ import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
17
17
  function isAutoProxyEnabled(adapter) {
18
18
  return adapter.autoProxy !== false;
19
19
  }
@@ -52,9 +52,7 @@ async function injectMediaCodecMapIntoHtml(html, projectDir, htmlSources, probeC
52
52
  `window.__HF_MEDIA_SOURCE_FACTS__=${safeJson(sourceFacts)};`
53
53
  ];
54
54
  const tag = `<script data-hf-media-codec-map>${assignments.join("")}</script>`;
55
- return insertBeforeCloseTag(html, "head", `${tag}
56
- `) ?? `${tag}
57
- ${html}`;
55
+ return injectTagsAtHeadStart(html, tag);
58
56
  }
59
57
  async function injectMediaCodecMap(html, adapter, projectDir, compSrcPath, probeCache) {
60
58
  if (!isAutoProxyEnabled(adapter)) return html;
@@ -110,11 +110,22 @@ function bitDepthOf(stream) {
110
110
  function sourceFactsOf(stream, formatBitrate) {
111
111
  if (!stream?.width || !stream.height) return void 0;
112
112
  const bitrate = Number(stream.bit_rate ?? formatBitrate);
113
+ const rate = (raw) => {
114
+ const [numerator, denominator = "1"] = (raw ?? "0").split("/");
115
+ const value = Number(numerator) / Number(denominator);
116
+ return Number.isFinite(value) && value > 0 ? value : 0;
117
+ };
118
+ const nominal = rate(stream.r_frame_rate);
119
+ const average = rate(stream.avg_frame_rate);
113
120
  return {
114
121
  width: stream.width,
115
122
  height: stream.height,
116
123
  bitDepth: bitDepthOf(stream),
117
- bitrate: Number.isFinite(bitrate) ? bitrate : 0
124
+ bitrate: Number.isFinite(bitrate) ? bitrate : 0,
125
+ ...nominal > 0 ? {
126
+ frameRate: nominal,
127
+ variableFrameRate: average > 0 && Math.abs(nominal - average) / Math.max(nominal, average) > 0.1
128
+ } : {}
118
129
  };
119
130
  }
120
131
  var STREAM_SUMMARY_MAX = 12;
@@ -174,7 +185,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
174
185
  "-v",
175
186
  "error",
176
187
  "-show_entries",
177
- "stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample,width,height,bit_rate:stream_disposition:stream_tags=alpha_mode:format=duration,bit_rate",
188
+ "stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample,width,height,bit_rate,r_frame_rate,avg_frame_rate:stream_disposition:stream_tags=alpha_mode:format=duration,bit_rate",
178
189
  "-of",
179
190
  "json",
180
191
  "--",
@@ -2,11 +2,11 @@ import {
2
2
  PROXY_STILL_EXTENSION,
3
3
  PROXY_VARIANT_CONFIG,
4
4
  ffmpegHasHdrFilters
5
- } from "./chunk-JBIB7WJP.js";
5
+ } from "./chunk-UBOFRR6H.js";
6
6
  import {
7
7
  probeFirstFrameColour,
8
8
  probeMediaMetadata
9
- } from "./chunk-Y6EZUBYR.js";
9
+ } from "./chunk-IMOR42OE.js";
10
10
  import {
11
11
  mkdirWithinProject,
12
12
  realProjectRoot,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  probeMediaMetadata
3
- } from "./chunk-Y6EZUBYR.js";
3
+ } from "./chunk-IMOR42OE.js";
4
4
  import {
5
5
  realpath
6
6
  } from "./chunk-QF7MFJJU.js";
@@ -12,8 +12,8 @@ import {
12
12
  requiredFfmpeg,
13
13
  resolveLocalAudioPath,
14
14
  updateAudioVolume
15
- } from "../chunk-NEGQQZNI.js";
16
- import "../chunk-Y6EZUBYR.js";
15
+ } from "../chunk-6NHWQWUJ.js";
16
+ import "../chunk-IMOR42OE.js";
17
17
  import "../chunk-QF7MFJJU.js";
18
18
  import "../chunk-SVQFE44C.js";
19
19
  import "../chunk-L3HJVTQE.js";
@@ -15,8 +15,8 @@ import {
15
15
  scanProjectMedia,
16
16
  scanProjectMediaCodecMap,
17
17
  shouldPrewarmProxy
18
- } from "../chunk-JBIB7WJP.js";
19
- import "../chunk-Y6EZUBYR.js";
18
+ } from "../chunk-UBOFRR6H.js";
19
+ import "../chunk-IMOR42OE.js";
20
20
  import "../chunk-QF7MFJJU.js";
21
21
  import "../chunk-SVQFE44C.js";
22
22
  import "../chunk-L3HJVTQE.js";
@@ -4,10 +4,10 @@ import {
4
4
  isAutoProxyEnabled,
5
5
  proxyEtagSalt,
6
6
  resolvePreviewMediaCodecProbeCache
7
- } from "../chunk-YN43WVB3.js";
8
- import "../chunk-46USOJVM.js";
9
- import "../chunk-JBIB7WJP.js";
10
- import "../chunk-Y6EZUBYR.js";
7
+ } from "../chunk-E3XVPMTD.js";
8
+ import "../chunk-POKRV543.js";
9
+ import "../chunk-UBOFRR6H.js";
10
+ import "../chunk-IMOR42OE.js";
11
11
  import "../chunk-QF7MFJJU.js";
12
12
  import "../chunk-SVQFE44C.js";
13
13
  import "../chunk-L3HJVTQE.js";
@@ -22,9 +22,9 @@ import {
22
22
  retryProxyCopy,
23
23
  sourceFolderKind,
24
24
  waitForProxy
25
- } from "../chunk-46USOJVM.js";
26
- import "../chunk-JBIB7WJP.js";
27
- import "../chunk-Y6EZUBYR.js";
25
+ } from "../chunk-POKRV543.js";
26
+ import "../chunk-UBOFRR6H.js";
27
+ import "../chunk-IMOR42OE.js";
28
28
  import "../chunk-QF7MFJJU.js";
29
29
  import "../chunk-SVQFE44C.js";
30
30
  import "../chunk-L3HJVTQE.js";
package/dist/index.js CHANGED
@@ -85,13 +85,13 @@ import {
85
85
  requestedProjectPath,
86
86
  requiredFfmpeg,
87
87
  resolveLocalAudioPath
88
- } from "./chunk-NEGQQZNI.js";
88
+ } from "./chunk-6NHWQWUJ.js";
89
89
  import {
90
90
  injectMediaCodecMap,
91
91
  isAutoProxyEnabled,
92
92
  proxyEtagSalt,
93
93
  resolvePreviewMediaCodecProbeCache
94
- } from "./chunk-YN43WVB3.js";
94
+ } from "./chunk-E3XVPMTD.js";
95
95
  import {
96
96
  CACHE_DIR_NAME,
97
97
  PROXY_PENDING_RETRY_AFTER_SECONDS,
@@ -105,7 +105,7 @@ import {
105
105
  resolveStill,
106
106
  retryProxyCopy,
107
107
  waitForProxy
108
- } from "./chunk-46USOJVM.js";
108
+ } from "./chunk-POKRV543.js";
109
109
  import {
110
110
  PROXY_VARIANT_CONFIG,
111
111
  decideMediaProxyEligibility,
@@ -113,11 +113,11 @@ import {
113
113
  probeAssetCodec,
114
114
  recordProxyRequest,
115
115
  resolveProxyVariantRequest
116
- } from "./chunk-JBIB7WJP.js";
116
+ } from "./chunk-UBOFRR6H.js";
117
117
  import {
118
118
  probeAudioTrack,
119
119
  probeMediaMetadata
120
- } from "./chunk-Y6EZUBYR.js";
120
+ } from "./chunk-IMOR42OE.js";
121
121
  import {
122
122
  folderGone,
123
123
  isInHiddenOrVendorDir,
@@ -4207,7 +4207,7 @@ function parseStudioMotionManifestContent(content) {
4207
4207
  }
4208
4208
  function withPreviewRuntime(html, runtimeUrl) {
4209
4209
  const tag = `<script ${RUNTIME_BOOTSTRAP_ATTR2}="1" src="${runtimeUrl}"></script>`;
4210
- return insertRuntimeTag(stripEmbeddedRuntimeScripts2(html), tag);
4210
+ return insertRuntimeTag(stripEmbeddedRuntimeScripts2(html), tag, true);
4211
4211
  }
4212
4212
  function injectScriptTagIntoHead(html, scriptTag) {
4213
4213
  return insertBeforeCloseTag3(html, "head", `${scriptTag}
@@ -4593,7 +4593,7 @@ ${etag}`;
4593
4593
  gsapBaseUrl
4594
4594
  );
4595
4595
  if (!html) return c.text("not found", 404);
4596
- html = withRootImportMap(html, baseHref);
4596
+ html = withPreviewRuntime(withRootImportMap(html, baseHref), adapter.runtimeUrl);
4597
4597
  recordPreviewReferences(project.dir, html);
4598
4598
  html = ensureHfIds2(await transformPreviewHtml(html, adapter, project, compPath));
4599
4599
  html = injectStudioPreviewAugmentations(html, adapter, signature, project.dir, compPath, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio-server",
3
- "version": "0.9.21",
3
+ "version": "0.9.23",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -88,8 +88,8 @@
88
88
  "linkedom": "^0.18.12",
89
89
  "postcss": "^8.5.8",
90
90
  "postcss-selector-parser": "^7.1.2",
91
- "@hyperframes/core": "0.9.21",
92
- "@hyperframes/parsers": "0.9.21"
91
+ "@hyperframes/parsers": "0.9.23",
92
+ "@hyperframes/core": "0.9.23"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@types/node": "^25.0.10",