@hyperframes/producer 0.9.2 → 0.9.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.
@@ -144,6 +144,7 @@ import { join, extname, resolve as resolve2, sep } from "node:path";
144
144
  import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
145
145
  import { fpsToNumber } from "@hyperframes/core";
146
146
  import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
147
+ import { openRangeEnd } from "@hyperframes/studio-server/media-range";
147
148
 
148
149
  // src/services/hyperframeRuntimeLoader.ts
149
150
  import { createHash } from "node:crypto";
@@ -262,7 +263,7 @@ var MIME_TYPES = {
262
263
  ".ttf": "font/ttf",
263
264
  ".otf": "font/otf"
264
265
  };
265
- function parseRangeHeader(header, size) {
266
+ function parseRangeHeader(header, size, contentType = "application/octet-stream") {
266
267
  if (!header) return { kind: "absent" };
267
268
  const match = /^\s*bytes\s*=\s*(.*?)\s*$/i.exec(header);
268
269
  if (!match) return { kind: "absent" };
@@ -287,7 +288,7 @@ function parseRangeHeader(header, size) {
287
288
  if (!Number.isFinite(start)) return { kind: "absent" };
288
289
  if (rawEnd === "") {
289
290
  if (start >= size) return { kind: "unsatisfiable" };
290
- return { kind: "satisfiable", start, end: size - 1 };
291
+ return { kind: "satisfiable", start, end: openRangeEnd(start, size - 1, contentType) };
291
292
  }
292
293
  if (!/^\d+$/.test(rawEnd)) return { kind: "absent" };
293
294
  const requestedEnd = Number(rawEnd);
@@ -755,7 +756,7 @@ function createFileServer(options) {
755
756
  }
756
757
  const totalSize = stat.size;
757
758
  const rangeHeader = c.req.header("range");
758
- const rangeRequest = parseRangeHeader(rangeHeader, totalSize);
759
+ const rangeRequest = parseRangeHeader(rangeHeader, totalSize, contentType);
759
760
  if (rangeRequest.kind === "unsatisfiable") {
760
761
  return new Response(null, {
761
762
  status: 416,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "4ae5b623a0c1465e561a5be44a15a686bc7b345ee10a0459989b0cf5f39e8d82",
4
+ "sha256": "98ba439ed1d4e221a76ce5f44b2bde5464ed099195c9939f5760301e50b6b0cc",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"