@hyperframes/producer 0.9.95 → 0.9.97

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/index.js CHANGED
@@ -370,7 +370,11 @@ import { fileURLToPath as fileURLToPath5 } from "url";
370
370
  // src/services/fileServer.ts
371
371
  import { Hono } from "hono";
372
372
  import { serve } from "@hono/node-server";
373
- import { answerOwnLoopbackHostOnly, settleOnBrowserSafePort } from "@hyperframes/engine";
373
+ import {
374
+ answerOwnLoopbackHostOnly,
375
+ boundedPageText,
376
+ settleOnBrowserSafePort
377
+ } from "@hyperframes/engine";
374
378
  import {
375
379
  existsSync as existsSync2,
376
380
  realpathSync,
@@ -1130,12 +1134,13 @@ function closeFileServerSafely(fileServer, label, log = defaultLogger) {
1130
1134
  });
1131
1135
  }
1132
1136
  }
1137
+ var NO_FILE_AT_NAME = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR", "ENAMETOOLONG"]);
1133
1138
  function openRegularFile(filePath) {
1134
1139
  let fd;
1135
1140
  try {
1136
1141
  fd = openSync(filePath, constants.O_RDONLY | constants.O_NONBLOCK);
1137
1142
  } catch (error) {
1138
- if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
1143
+ if (error instanceof Error && "code" in error && NO_FILE_AT_NAME.has(String(error.code)))
1139
1144
  return null;
1140
1145
  if (!statSync2(filePath, { throwIfNoEntry: false })?.isFile()) return null;
1141
1146
  throw error;
@@ -1198,7 +1203,7 @@ function createFileServer(options) {
1198
1203
  }
1199
1204
  if (!file) {
1200
1205
  if (!/favicon\.ico$/i.test(requestPath)) {
1201
- console.warn(`[FileServer] 404 Not Found: ${terminalText2(requestPath)}`);
1206
+ console.warn(`[FileServer] 404 Not Found: ${terminalText2(boundedPageText(requestPath))}`);
1202
1207
  }
1203
1208
  return c.text("Not found", 404);
1204
1209
  }
@@ -23314,6 +23319,20 @@ function assertRequestOptionScalars(options) {
23314
23319
  throw new Error("Render request outputResolution is invalid");
23315
23320
  }
23316
23321
  }
23322
+ function isRenderRange(value) {
23323
+ if (!isPlainObject(value)) return false;
23324
+ const seconds = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0;
23325
+ const { startSeconds, endSeconds } = value;
23326
+ if (!seconds(startSeconds)) return false;
23327
+ return endSeconds === void 0 || seconds(endSeconds) && Number(endSeconds) > Number(startSeconds);
23328
+ }
23329
+ function assertRequestRange(options) {
23330
+ if (options.range !== void 0 && !isRenderRange(options.range)) {
23331
+ throw new Error(
23332
+ "Render request range must be { startSeconds, endSeconds? } in seconds, end after start"
23333
+ );
23334
+ }
23335
+ }
23317
23336
  function assertRequestOptionObjects(options) {
23318
23337
  validateEngineConfigSnapshot2(options.engineConfig);
23319
23338
  if (options.expectedOutputDimensions !== void 0 && !isExpectedOutputDimensions(options.expectedOutputDimensions)) {
@@ -23340,6 +23359,7 @@ function assertRequestOptions(options) {
23340
23359
  }
23341
23360
  assertRequestOptionScalars(options);
23342
23361
  assertRequestOptionObjects(options);
23362
+ assertRequestRange(options);
23343
23363
  }
23344
23364
  function assertNonEmptyPath(value, field) {
23345
23365
  if (typeof value !== "string" || value.length === 0) {
@@ -23398,6 +23418,8 @@ function distributedConfigFromRequest(request, runtime = {}) {
23398
23418
  const options = request.options;
23399
23419
  const distributed = options.distributed;
23400
23420
  if (!distributed) throw new Error("Render request is missing distributed options");
23421
+ if (options.range)
23422
+ throw new Error("A distributed render takes its range from renderSpan, not the request");
23401
23423
  if (options.format === "gif" || options.format === "hls") {
23402
23424
  throw new Error(`Distributed render does not support ${options.format}`);
23403
23425
  }
@@ -412,7 +412,11 @@ import { fileURLToPath as fileURLToPath5 } from "url";
412
412
  // src/services/fileServer.ts
413
413
  import { Hono } from "hono";
414
414
  import { serve } from "@hono/node-server";
415
- import { answerOwnLoopbackHostOnly, settleOnBrowserSafePort } from "@hyperframes/engine";
415
+ import {
416
+ answerOwnLoopbackHostOnly,
417
+ boundedPageText,
418
+ settleOnBrowserSafePort
419
+ } from "@hyperframes/engine";
416
420
  import {
417
421
  existsSync as existsSync2,
418
422
  realpathSync,
@@ -1172,12 +1176,13 @@ function closeFileServerSafely(fileServer, label, log = defaultLogger) {
1172
1176
  });
1173
1177
  }
1174
1178
  }
1179
+ var NO_FILE_AT_NAME = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR", "ENAMETOOLONG"]);
1175
1180
  function openRegularFile(filePath) {
1176
1181
  let fd;
1177
1182
  try {
1178
1183
  fd = openSync(filePath, constants.O_RDONLY | constants.O_NONBLOCK);
1179
1184
  } catch (error) {
1180
- if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
1185
+ if (error instanceof Error && "code" in error && NO_FILE_AT_NAME.has(String(error.code)))
1181
1186
  return null;
1182
1187
  if (!statSync2(filePath, { throwIfNoEntry: false })?.isFile()) return null;
1183
1188
  throw error;
@@ -1240,7 +1245,7 @@ function createFileServer(options) {
1240
1245
  }
1241
1246
  if (!file) {
1242
1247
  if (!/favicon\.ico$/i.test(requestPath)) {
1243
- console.warn(`[FileServer] 404 Not Found: ${terminalText2(requestPath)}`);
1248
+ console.warn(`[FileServer] 404 Not Found: ${terminalText2(boundedPageText(requestPath))}`);
1244
1249
  }
1245
1250
  return c.text("Not found", 404);
1246
1251
  }
@@ -19140,6 +19145,20 @@ function assertRequestOptionScalars(options) {
19140
19145
  throw new Error("Render request outputResolution is invalid");
19141
19146
  }
19142
19147
  }
19148
+ function isRenderRange(value) {
19149
+ if (!isPlainObject(value)) return false;
19150
+ const seconds = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0;
19151
+ const { startSeconds, endSeconds } = value;
19152
+ if (!seconds(startSeconds)) return false;
19153
+ return endSeconds === void 0 || seconds(endSeconds) && Number(endSeconds) > Number(startSeconds);
19154
+ }
19155
+ function assertRequestRange(options) {
19156
+ if (options.range !== void 0 && !isRenderRange(options.range)) {
19157
+ throw new Error(
19158
+ "Render request range must be { startSeconds, endSeconds? } in seconds, end after start"
19159
+ );
19160
+ }
19161
+ }
19143
19162
  function assertRequestOptionObjects(options) {
19144
19163
  validateEngineConfigSnapshot2(options.engineConfig);
19145
19164
  if (options.expectedOutputDimensions !== void 0 && !isExpectedOutputDimensions(options.expectedOutputDimensions)) {
@@ -19166,6 +19185,7 @@ function assertRequestOptions(options) {
19166
19185
  }
19167
19186
  assertRequestOptionScalars(options);
19168
19187
  assertRequestOptionObjects(options);
19188
+ assertRequestRange(options);
19169
19189
  }
19170
19190
  function assertNonEmptyPath(value, field) {
19171
19191
  if (typeof value !== "string" || value.length === 0) {
@@ -3,6 +3,7 @@ import { type EngineConfig, type ProresProfile, type VideoFrameFormat } from "@h
3
3
  import { type CanvasResolution, type Fps } from "@hyperframes/core";
4
4
  import type { ProducerLogger } from "./logger.js";
5
5
  import type { RenderConfig } from "./services/renderOrchestrator.js";
6
+ import type { RenderRange } from "./services/render/frameWindow.js";
6
7
  import type { DistributedRenderConfig } from "./services/distributed/plan.js";
7
8
  import { type SerializableDistributedRenderConfig } from "./services/distributed/renderConfigValidation.js";
8
9
  export declare const RENDER_REQUEST_VERSION: 1;
@@ -47,6 +48,7 @@ export interface RenderRequestOptions {
47
48
  hdrMode?: RenderConfig["hdrMode"];
48
49
  chromaSubsampling?: RenderConfig["chromaSubsampling"];
49
50
  pageMotionBlur?: RenderConfig["pageMotionBlur"];
51
+ range?: RenderRange;
50
52
  variables?: Record<string, unknown>;
51
53
  strictVariables?: boolean;
52
54
  expectedOutputDimensions?: ExpectedOutputDimensions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.9.95",
3
+ "version": "0.9.97",
4
4
  "description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,11 +35,11 @@
35
35
  "postcss": "^8.4.0",
36
36
  "puppeteer": "~25.13.0",
37
37
  "puppeteer-core": "^25.13.0",
38
- "@hyperframes/core": "0.9.95",
39
- "@hyperframes/engine": "0.9.95",
40
- "@hyperframes/lint": "0.9.95",
41
- "@hyperframes/studio-server": "0.9.95",
42
- "@hyperframes/parsers": "0.9.95"
38
+ "@hyperframes/engine": "0.9.97",
39
+ "@hyperframes/parsers": "0.9.97",
40
+ "@hyperframes/core": "0.9.97",
41
+ "@hyperframes/studio-server": "0.9.97",
42
+ "@hyperframes/lint": "0.9.97"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^25.0.10",
@@ -48,7 +48,7 @@
48
48
  "tsx": "^4.21.0",
49
49
  "typescript": "^5.7.2",
50
50
  "vitest": "^4.1.12",
51
- "@hyperframes/aws-lambda": "0.9.95"
51
+ "@hyperframes/aws-lambda": "0.9.97"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"