@hyperframes/studio-server 0.8.91 → 0.8.92

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
@@ -153,7 +153,7 @@ import {
153
153
  existsSync as existsSync3,
154
154
  lstatSync as lstatSync2,
155
155
  openSync,
156
- readFileSync as readFileSync4,
156
+ readFileSync as readFileSync3,
157
157
  readlinkSync,
158
158
  writeFileSync as writeFileSync4,
159
159
  writeSync,
@@ -591,7 +591,8 @@ import { parseHTML as parseHTML2 } from "linkedom";
591
591
  import { ensureHfIds } from "@hyperframes/parsers/hf-ids";
592
592
 
593
593
  // src/helpers/compositionInsertion.ts
594
- import { existsSync as existsSync2, readFileSync as readFileSync3 } from "fs";
594
+ import { existsSync as existsSync2 } from "fs";
595
+ import { readProjectFile } from "@hyperframes/parsers/asset-resolution";
595
596
  import { randomUUID } from "crypto";
596
597
  import { dirname as dirname2, relative as relative2, resolve, sep } from "path";
597
598
  import { parseHTML } from "linkedom";
@@ -637,6 +638,16 @@ function canonicalProjectPath(projectDir, candidate) {
637
638
  }
638
639
  return canonical;
639
640
  }
641
+ function readCompositionSource(file) {
642
+ const read = readProjectFile(file);
643
+ if (read.kind === "folder") {
644
+ throw new CompositionInsertionError("Composition source is a folder, not an HTML file", 400);
645
+ }
646
+ if (read.kind === "missing") {
647
+ throw new CompositionInsertionError("Composition source was not found", 404);
648
+ }
649
+ return read.text;
650
+ }
640
651
  function validateSourcePath(sourcePath) {
641
652
  if (!sourcePath.trim() || sourcePath.includes("\0") || /^[a-z]+:/i.test(sourcePath)) {
642
653
  throw new CompositionInsertionError("Invalid composition source path", 400);
@@ -665,7 +676,7 @@ function validateDependencyGraph(projectDir, targetAbs, sourceAbs) {
665
676
  }
666
677
  if (visited.has(file)) return;
667
678
  visiting.add(file);
668
- const source = readFileSync3(file, "utf-8");
679
+ const source = readCompositionSource(file);
669
680
  const { document } = compositionRoot(source);
670
681
  for (const host of descendants(document, "[data-composition-src]")) {
671
682
  const dependency = host.getAttribute("data-composition-src");
@@ -729,7 +740,7 @@ function insertCompositionIntoSource(input) {
729
740
  const targetAbs = canonicalProjectFile(input.projectDir, input.targetPath);
730
741
  const sourceAbs = canonicalProjectFile(input.projectDir, input.sourcePath);
731
742
  validateDependencyGraph(input.projectDir, targetAbs, sourceAbs);
732
- const source = readFileSync3(sourceAbs, "utf-8");
743
+ const source = readCompositionSource(sourceAbs);
733
744
  const sourceComposition = compositionRoot(source).root;
734
745
  const duration = positiveAttribute(
735
746
  sourceComposition,
@@ -972,7 +983,7 @@ function foldAndCommitElementPatchBatches(projectDir, batches, writeFile, reques
972
983
  resolvedPaths.add(absPath);
973
984
  let before;
974
985
  try {
975
- before = readFileSync4(absPath, "utf-8");
986
+ before = readFileSync3(absPath, "utf-8");
976
987
  } catch {
977
988
  return { error: "not-found", sourceFile: batch.sourceFile };
978
989
  }
@@ -1028,7 +1039,7 @@ function commitElementPatchBatchesWithReceipts(c, projectDir, batches) {
1028
1039
  );
1029
1040
  }
1030
1041
  function writeFileWithReceipt(c, filePath, absPath, html) {
1031
- const overwrote = readFileSync4(absPath);
1042
+ const overwrote = readFileSync3(absPath);
1032
1043
  replaceFileAtomically(absPath, html, statSync3(absPath).mode);
1033
1044
  const version = fileContentVersion(html);
1034
1045
  const writeToken = createWriteToken(c.req.header("X-Hyperframes-Write-Token"));
@@ -1038,7 +1049,7 @@ function writeFileWithReceipt(c, filePath, absPath, html) {
1038
1049
  function writeMutationResult(c, projectDir, filePath, absPath, html, original) {
1039
1050
  const backup = snapshotBeforeWrite(projectDir, absPath);
1040
1051
  if (backup.error) return c.json({ error: `backup failed: ${backup.error}` }, 500);
1041
- if (readFileSync4(absPath, "utf-8") !== original) {
1052
+ if (readFileSync3(absPath, "utf-8") !== original) {
1042
1053
  return c.json({ error: "file changed", conflict: true, path: filePath }, 409);
1043
1054
  }
1044
1055
  const { version } = writeFileWithReceipt(c, filePath, absPath, html);
@@ -1121,7 +1132,7 @@ function updateReferences(projectDir, oldPath, newPath) {
1121
1132
  let updatedCount = 0;
1122
1133
  for (const file of textFiles) {
1123
1134
  if (!isSafePath(projectDir, file)) continue;
1124
- const content = readFileSync4(file, "utf-8");
1135
+ const content = readFileSync3(file, "utf-8");
1125
1136
  if (!content.includes(oldPath)) continue;
1126
1137
  const updated = content.split(oldPath).join(newPath);
1127
1138
  if (updated !== content) {
@@ -1395,7 +1406,7 @@ function containsRawGsapExpression(value) {
1395
1406
  return Object.values(value).some(containsRawGsapExpression);
1396
1407
  }
1397
1408
  async function prepareGsapMutationScript(c, res, firstMutation) {
1398
- const beforeHtml = readFileSync4(res.absPath, "utf-8");
1409
+ const beforeHtml = readFileSync3(res.absPath, "utf-8");
1399
1410
  let html = beforeHtml;
1400
1411
  let block = extractGsapScriptBlock(html);
1401
1412
  if (!block && (firstMutation.type === "add" || firstMutation.type === "add-with-keyframes")) {
@@ -1462,7 +1473,7 @@ async function applyGsapMutations(c, res, mutations) {
1462
1473
  const changed = block.scriptText !== initialScript;
1463
1474
  const newHtml = changed ? block.replaceScript(block.scriptText) : html;
1464
1475
  let backupPath = null;
1465
- if (readFileSync4(res.absPath, "utf-8") !== beforeHtml) {
1476
+ if (readFileSync3(res.absPath, "utf-8") !== beforeHtml) {
1466
1477
  return c.json({ error: "file changed during GSAP mutation", conflict: true }, 409);
1467
1478
  }
1468
1479
  if (changed) {
@@ -2299,7 +2310,7 @@ function registerFileRoutes(api, adapter) {
2299
2310
  if (stat2.size > MAX_TEXT_READ_BYTES) {
2300
2311
  return c.json({ error: "too large to read as text", why: "too_large" }, 413);
2301
2312
  }
2302
- const content = readFileSync4(fd);
2313
+ const content = readFileSync3(fd);
2303
2314
  const version = fileContentVersion(content);
2304
2315
  c.header("ETag", version);
2305
2316
  if (content.subarray(0, GIT_BINARY_SNIFF_BYTES).includes(0)) {
@@ -2324,7 +2335,7 @@ function registerFileRoutes(api, adapter) {
2324
2335
  if (expectedVersion === null && !createOnly) {
2325
2336
  let currentContent = null;
2326
2337
  try {
2327
- currentContent = readFileSync4(res.absPath);
2338
+ currentContent = readFileSync3(res.absPath);
2328
2339
  } catch (error) {
2329
2340
  if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
2330
2341
  throw error;
@@ -2351,7 +2362,7 @@ function registerFileRoutes(api, adapter) {
2351
2362
  if (!error || typeof error !== "object" || !("code" in error) || error.code !== "EEXIST") {
2352
2363
  throw error;
2353
2364
  }
2354
- const currentContent = readFileSync4(res.absPath);
2365
+ const currentContent = readFileSync3(res.absPath);
2355
2366
  return c.json(
2356
2367
  {
2357
2368
  error: "file conflict",
@@ -2386,7 +2397,7 @@ function registerFileRoutes(api, adapter) {
2386
2397
  );
2387
2398
  }
2388
2399
  try {
2389
- const currentContent = readFileSync4(fd);
2400
+ const currentContent = readFileSync3(fd);
2390
2401
  overwrote = currentContent;
2391
2402
  const currentVersion = fileContentVersion(currentContent);
2392
2403
  if (expectedVersion !== currentVersion) {
@@ -2462,7 +2473,7 @@ function registerFileRoutes(api, adapter) {
2462
2473
  }
2463
2474
  let before;
2464
2475
  try {
2465
- before = readFileSync4(ctx.absPath, "utf-8");
2476
+ before = readFileSync3(ctx.absPath, "utf-8");
2466
2477
  } catch (error) {
2467
2478
  if (!error || typeof error !== "object" || !("code" in error) || error.code !== "ENOENT") {
2468
2479
  throw error;
@@ -2491,7 +2502,7 @@ function registerFileRoutes(api, adapter) {
2491
2502
  }
2492
2503
  const backup = snapshotBeforeWrite(ctx.project.dir, ctx.absPath);
2493
2504
  if (backup.error) return c.json({ error: `backup failed: ${backup.error}` }, 500);
2494
- const current = readFileSync4(ctx.absPath, "utf-8");
2505
+ const current = readFileSync3(ctx.absPath, "utf-8");
2495
2506
  if (current !== before) {
2496
2507
  const currentVersion2 = fileContentVersion(current);
2497
2508
  return c.json({ error: "file conflict", currentVersion: currentVersion2, currentContent: current }, 409);
@@ -2524,7 +2535,7 @@ function registerFileRoutes(api, adapter) {
2524
2535
  }
2525
2536
  const parsed = await parseMutationBody(c);
2526
2537
  if ("error" in parsed) return parsed.error;
2527
- const originalContent = readFileSync4(ctx.absPath, "utf-8");
2538
+ const originalContent = readFileSync3(ctx.absPath, "utf-8");
2528
2539
  return writeIfChanged(
2529
2540
  c,
2530
2541
  ctx.project.dir,
@@ -2545,7 +2556,7 @@ function registerFileRoutes(api, adapter) {
2545
2556
  if (!Array.isArray(targets) || targets.length === 0) {
2546
2557
  return c.json({ error: "targets required" }, 400);
2547
2558
  }
2548
- const originalContent = readFileSync4(ctx.absPath, "utf-8");
2559
+ const originalContent = readFileSync3(ctx.absPath, "utf-8");
2549
2560
  let next = originalContent;
2550
2561
  for (const target of targets) {
2551
2562
  next = removeElementFromHtml(next, target);
@@ -2578,7 +2589,7 @@ function registerFileRoutes(api, adapter) {
2578
2589
  seen.add(absPath);
2579
2590
  let before;
2580
2591
  try {
2581
- before = readFileSync4(absPath, "utf-8");
2592
+ before = readFileSync3(absPath, "utf-8");
2582
2593
  } catch {
2583
2594
  return c.json({ error: `not found: ${file.path}` }, 404);
2584
2595
  }
@@ -2605,7 +2616,7 @@ function registerFileRoutes(api, adapter) {
2605
2616
  prepared.push(folded);
2606
2617
  }
2607
2618
  for (const file of prepared) {
2608
- const current = readFileSync4(file.absPath, "utf-8");
2619
+ const current = readFileSync3(file.absPath, "utf-8");
2609
2620
  if (current !== file.before) {
2610
2621
  return c.json(
2611
2622
  {
@@ -2648,7 +2659,7 @@ function registerFileRoutes(api, adapter) {
2648
2659
  const conflicts = [];
2649
2660
  for (const file of written.reverse()) {
2650
2661
  try {
2651
- const current = readFileSync4(file.absPath, "utf-8");
2662
+ const current = readFileSync3(file.absPath, "utf-8");
2652
2663
  if (current !== file.after) {
2653
2664
  conflicts.push(file.path);
2654
2665
  continue;
@@ -2696,7 +2707,7 @@ function registerFileRoutes(api, adapter) {
2696
2707
  const fallbackTiming = typeof parsed.body.elementStart === "number" && typeof parsed.body.elementDuration === "number" ? { start: parsed.body.elementStart, duration: parsed.body.elementDuration } : void 0;
2697
2708
  let originalContent;
2698
2709
  try {
2699
- originalContent = readFileSync4(ctx.absPath, "utf-8");
2710
+ originalContent = readFileSync3(ctx.absPath, "utf-8");
2700
2711
  } catch {
2701
2712
  return c.json({ error: "not found" }, 404);
2702
2713
  }
@@ -2754,7 +2765,7 @@ function registerFileRoutes(api, adapter) {
2754
2765
  for (let attempt = 1; ; attempt += 1) {
2755
2766
  let originalContent;
2756
2767
  try {
2757
- originalContent = readFileSync4(ctx.absPath, "utf-8");
2768
+ originalContent = readFileSync3(ctx.absPath, "utf-8");
2758
2769
  } catch {
2759
2770
  return c.json({ error: "not found" }, 404);
2760
2771
  }
@@ -2860,7 +2871,7 @@ function registerFileRoutes(api, adapter) {
2860
2871
  }
2861
2872
  let originalContent;
2862
2873
  try {
2863
- originalContent = readFileSync4(ctx.absPath, "utf-8");
2874
+ originalContent = readFileSync3(ctx.absPath, "utf-8");
2864
2875
  } catch {
2865
2876
  return c.json({ error: "not found" }, 404);
2866
2877
  }
@@ -2916,7 +2927,7 @@ function registerFileRoutes(api, adapter) {
2916
2927
  ).map((entry) => ({ target: entry.target, track: entry.track }));
2917
2928
  let originalContent;
2918
2929
  try {
2919
- originalContent = readFileSync4(ctx.absPath, "utf-8");
2930
+ originalContent = readFileSync3(ctx.absPath, "utf-8");
2920
2931
  } catch {
2921
2932
  return c.json({ error: "not found" }, 404);
2922
2933
  }
@@ -2945,7 +2956,7 @@ function registerFileRoutes(api, adapter) {
2945
2956
  if ("error" in parsed) return parsed.error;
2946
2957
  let content;
2947
2958
  try {
2948
- content = readFileSync4(ctx.absPath, "utf-8");
2959
+ content = readFileSync3(ctx.absPath, "utf-8");
2949
2960
  } catch {
2950
2961
  return c.json({ exists: false });
2951
2962
  }
@@ -2989,7 +3000,7 @@ function registerFileRoutes(api, adapter) {
2989
3000
  }
2990
3001
  ensureDir(project.dir, destAbs);
2991
3002
  try {
2992
- writeFileSync4(destAbs, readFileSync4(srcAbs), { flag: "wx" });
3003
+ writeFileSync4(destAbs, readFileSync3(srcAbs), { flag: "wx" });
2993
3004
  } catch (error) {
2994
3005
  if (!error || typeof error !== "object" || !("code" in error) || error.code !== "EEXIST") {
2995
3006
  throw error;
@@ -3033,7 +3044,7 @@ function registerFileRoutes(api, adapter) {
3033
3044
  mustExist: true
3034
3045
  });
3035
3046
  if ("error" in res) return res.error;
3036
- const html = readFileSync4(res.absPath, "utf-8");
3047
+ const html = readFileSync3(res.absPath, "utf-8");
3037
3048
  const block = extractGsapScriptBlock(html);
3038
3049
  if (!block) {
3039
3050
  return c.json({
@@ -3089,7 +3100,7 @@ function registerFileRoutes(api, adapter) {
3089
3100
  if (!body || typeof body.expected !== "string" || typeof body.restore !== "string") {
3090
3101
  return c.json({ error: "expected and restore contents required" }, 400);
3091
3102
  }
3092
- const current = readFileSync4(res.absPath, "utf-8");
3103
+ const current = readFileSync3(res.absPath, "utf-8");
3093
3104
  if (current !== body.expected) {
3094
3105
  return c.json({ ok: true, restored: false, conflict: true });
3095
3106
  }
@@ -3099,7 +3110,7 @@ function registerFileRoutes(api, adapter) {
3099
3110
  }
3100
3111
 
3101
3112
  // src/routes/preview.ts
3102
- import { createReadStream, existsSync as existsSync5, readFileSync as readFileSync6, statSync as statSync4 } from "fs";
3113
+ import { createReadStream, existsSync as existsSync5, readFileSync as readFileSync5, statSync as statSync4 } from "fs";
3103
3114
  import { Readable } from "stream";
3104
3115
  import { join as join8, resolve as resolve4 } from "path";
3105
3116
  import { createHash } from "crypto";
@@ -3114,7 +3125,7 @@ import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document"
3114
3125
  import { isWithinProjectRoot } from "@hyperframes/parsers/asset-resolution";
3115
3126
 
3116
3127
  // src/helpers/subComposition.ts
3117
- import { existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
3128
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
3118
3129
  import { join as join6 } from "path";
3119
3130
  import { parseHTML as parseHTML3 } from "linkedom";
3120
3131
  import {
@@ -3224,7 +3235,7 @@ function tagRootCompositionFile(bodyHtml, compPath) {
3224
3235
  function buildSubCompositionHtml(projectDir, compPath, runtimeUrl, baseHref, rawOverride) {
3225
3236
  const compFile = join6(projectDir, compPath);
3226
3237
  if (!existsSync4(compFile)) return null;
3227
- const rawComp = rawOverride ?? readFileSync5(compFile, "utf-8");
3238
+ const rawComp = rawOverride ?? readFileSync4(compFile, "utf-8");
3228
3239
  let compHeadContent = "";
3229
3240
  let rewrittenContent;
3230
3241
  let htmlAttrs = "";
@@ -3257,7 +3268,7 @@ function buildSubCompositionHtml(projectDir, compPath, runtimeUrl, baseHref, raw
3257
3268
  const indexPath = join6(projectDir, "index.html");
3258
3269
  let headContent = "";
3259
3270
  if (existsSync4(indexPath)) {
3260
- const indexHtml = readFileSync5(indexPath, "utf-8");
3271
+ const indexHtml = readFileSync4(indexPath, "utf-8");
3261
3272
  const headMatch = indexHtml.match(/<head[^>]*>([\s\S]*?)<\/head>/i);
3262
3273
  headContent = headMatch?.[1] ?? "";
3263
3274
  }
@@ -3445,7 +3456,7 @@ function readStudioMotionManifestContent(projectDir) {
3445
3456
  const manifestPath = join8(projectDir, STUDIO_MOTION_PATH);
3446
3457
  if (!existsSync5(manifestPath)) return "";
3447
3458
  try {
3448
- return readFileSync6(manifestPath, "utf-8");
3459
+ return readFileSync5(manifestPath, "utf-8");
3449
3460
  } catch {
3450
3461
  return "";
3451
3462
  }
@@ -3596,13 +3607,13 @@ function resolveProjectMainHtml(projectDir, projectId) {
3596
3607
  recordPreviewRead(projectDir, blockHtmlPath);
3597
3608
  if (existsSync5(indexPath)) {
3598
3609
  return {
3599
- html: readFileSync6(indexPath, "utf-8"),
3610
+ html: readFileSync5(indexPath, "utf-8"),
3600
3611
  compositionPath: "index.html"
3601
3612
  };
3602
3613
  }
3603
3614
  if (existsSync5(blockHtmlPath)) {
3604
3615
  return {
3605
- html: readFileSync6(blockHtmlPath, "utf-8"),
3616
+ html: readFileSync5(blockHtmlPath, "utf-8"),
3606
3617
  compositionPath: `${projectId}.html`
3607
3618
  };
3608
3619
  }
@@ -3737,7 +3748,7 @@ ${etag}`;
3737
3748
  function pinSubCompHfIds(compFile, compPath) {
3738
3749
  if (!/\.html?$/i.test(compPath)) return void 0;
3739
3750
  try {
3740
- return ensureHfIds2(readFileSync6(compFile, "utf-8"));
3751
+ return ensureHfIds2(readFileSync5(compFile, "utf-8"));
3741
3752
  } catch {
3742
3753
  return null;
3743
3754
  }
@@ -3848,7 +3859,7 @@ ${etag}`;
3848
3859
  recordProxyRequest();
3849
3860
  servedContentType = PROXY_VARIANT_CONFIG[proxyVariant].contentType;
3850
3861
  }
3851
- const textBuffer = isText ? Buffer.from(readFileSync6(file, "utf-8"), "utf-8") : null;
3862
+ const textBuffer = isText ? Buffer.from(readFileSync5(file, "utf-8"), "utf-8") : null;
3852
3863
  const totalSize = textBuffer ? textBuffer.length : statSync4(servedPath).size;
3853
3864
  const bodyFor = (start, end) => textBuffer ? new Uint8Array(textBuffer.subarray(start, end + 1)) : (
3854
3865
  // Node's web stream type and the DOM one do not overlap for tsc on
@@ -3892,7 +3903,7 @@ ${etag}`;
3892
3903
  }
3893
3904
 
3894
3905
  // src/routes/lint.ts
3895
- import { readFileSync as readFileSync7 } from "fs";
3906
+ import { readFileSync as readFileSync6 } from "fs";
3896
3907
  import { join as join9 } from "path";
3897
3908
  async function collectProjectFindings(adapter, projectDir) {
3898
3909
  const findings = [];
@@ -3911,7 +3922,7 @@ async function lintUncoveredHtml(adapter, projectDir, htmlFiles, coveredFiles) {
3911
3922
  const findings = [];
3912
3923
  for (const file of htmlFiles) {
3913
3924
  if (coveredFiles.has(file)) continue;
3914
- const content = readFileSync7(join9(projectDir, file), "utf-8");
3925
+ const content = readFileSync6(join9(projectDir, file), "utf-8");
3915
3926
  const result = await adapter.lint(content, { filePath: file, isSubComposition: true });
3916
3927
  for (const finding of result?.findings ?? []) {
3917
3928
  findings.push({ ...finding, file });
@@ -3944,7 +3955,7 @@ function registerLintRoutes(api, adapter) {
3944
3955
 
3945
3956
  // src/routes/render.ts
3946
3957
  import { streamSSE } from "hono/streaming";
3947
- import { existsSync as existsSync6, readFileSync as readFileSync8, unlinkSync as unlinkSync3, readdirSync as readdirSync3, statSync as statSync5 } from "fs";
3958
+ import { existsSync as existsSync6, readFileSync as readFileSync7, unlinkSync as unlinkSync3, readdirSync as readdirSync3, statSync as statSync5 } from "fs";
3948
3959
  import { join as join10 } from "path";
3949
3960
  import { VALID_CANVAS_RESOLUTIONS } from "@hyperframes/parsers";
3950
3961
  import { formatRenderOutputTimestamp, parseFps } from "@hyperframes/core";
@@ -4083,7 +4094,7 @@ function registerRenderRoutes(api, adapter) {
4083
4094
  }
4084
4095
  const contentType = renderContentType(job.outputPath);
4085
4096
  const filename = job.outputPath.split("/").pop() ?? `render.mp4`;
4086
- const content = readFileSync8(job.outputPath);
4097
+ const content = readFileSync7(job.outputPath);
4087
4098
  return new Response(content, {
4088
4099
  headers: {
4089
4100
  "Content-Type": contentType,
@@ -4101,7 +4112,7 @@ function registerRenderRoutes(api, adapter) {
4101
4112
  }
4102
4113
  const contentType = renderContentType(job.outputPath);
4103
4114
  const filename = job.outputPath.split("/").pop() ?? `render.mp4`;
4104
- const content = readFileSync8(job.outputPath);
4115
+ const content = readFileSync7(job.outputPath);
4105
4116
  return new Response(content, {
4106
4117
  headers: {
4107
4118
  "Content-Type": contentType,
@@ -4134,7 +4145,7 @@ function registerRenderRoutes(api, adapter) {
4134
4145
  if (!fp) return c.json({ error: "forbidden" }, 403);
4135
4146
  if (!existsSync6(fp)) return c.json({ error: "not found" }, 404);
4136
4147
  const contentType = renderContentType(fp);
4137
- const content = readFileSync8(fp);
4148
+ const content = readFileSync7(fp);
4138
4149
  return new Response(content, {
4139
4150
  headers: {
4140
4151
  "Content-Type": contentType,
@@ -4158,7 +4169,7 @@ function registerRenderRoutes(api, adapter) {
4158
4169
  let durationMs;
4159
4170
  if (existsSync6(metaPath)) {
4160
4171
  try {
4161
- const meta = JSON.parse(readFileSync8(metaPath, "utf-8"));
4172
+ const meta = JSON.parse(readFileSync7(metaPath, "utf-8"));
4162
4173
  if (meta.status === "failed" && !existsSync6(fp)) status = "failed";
4163
4174
  if (meta.durationMs) durationMs = meta.durationMs;
4164
4175
  } catch {
@@ -4404,7 +4415,7 @@ import {
4404
4415
  closeSync as closeSync2,
4405
4416
  fstatSync as fstatSync2,
4406
4417
  openSync as openSync2,
4407
- readFileSync as readFileSync10,
4418
+ readFileSync as readFileSync9,
4408
4419
  readdirSync as readdirSync4,
4409
4420
  renameSync as renameSync3,
4410
4421
  rmSync as rmSync4,
@@ -4416,7 +4427,7 @@ import { join as join11 } from "path";
4416
4427
  import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
4417
4428
 
4418
4429
  // src/helpers/compositionInputs.ts
4419
- import { readFileSync as readFileSync9 } from "fs";
4430
+ import { readFileSync as readFileSync8 } from "fs";
4420
4431
  var ROOT_COMPOSITION = "index.html";
4421
4432
  var COMPOSITION_SRC = /\bdata-composition-src\s*=\s*(["'])(.*?)\1/g;
4422
4433
  function projectReader(projectDir) {
@@ -4426,7 +4437,7 @@ function projectReader(projectDir) {
4426
4437
  const file = resolveWithinProject(projectDir, compPath);
4427
4438
  let source = null;
4428
4439
  try {
4429
- source = file ? readFileSync9(file, "utf-8") : null;
4440
+ source = file ? readFileSync8(file, "utf-8") : null;
4430
4441
  } catch {
4431
4442
  }
4432
4443
  sources.set(compPath, source);
@@ -4538,7 +4549,7 @@ function readFileOnce(file) {
4538
4549
  try {
4539
4550
  const stat2 = fstatSync2(fd);
4540
4551
  if (!stat2.isFile()) return "not-a-file";
4541
- return { data: readFileSync10(fd), mtimeMs: stat2.mtimeMs };
4552
+ return { data: readFileSync9(fd), mtimeMs: stat2.mtimeMs };
4542
4553
  } finally {
4543
4554
  closeSync2(fd);
4544
4555
  }
@@ -4676,7 +4687,7 @@ function registerThumbnailRoutes(api, adapter) {
4676
4687
  }
4677
4688
 
4678
4689
  // src/routes/waveform.ts
4679
- import { existsSync as existsSync7, readFileSync as readFileSync11, statSync as statSync7 } from "fs";
4690
+ import { existsSync as existsSync7, readFileSync as readFileSync10, statSync as statSync7 } from "fs";
4680
4691
  import { join as join12, resolve as resolve5 } from "path";
4681
4692
  import { isWithinProjectRoot as isWithinProjectRoot2 } from "@hyperframes/parsers/asset-resolution";
4682
4693
  function registerWaveformRoutes(api, adapter) {
@@ -4694,7 +4705,7 @@ function registerWaveformRoutes(api, adapter) {
4694
4705
  const cachePath = join12(cacheDir, buildWaveformCacheKey(assetPath, stats));
4695
4706
  try {
4696
4707
  if (isWaveformCacheDirectory(cacheDir) && existsSync7(cachePath)) {
4697
- const peaks2 = JSON.parse(readFileSync11(cachePath, "utf-8"));
4708
+ const peaks2 = JSON.parse(readFileSync10(cachePath, "utf-8"));
4698
4709
  return c.json({ peaks: peaks2 });
4699
4710
  }
4700
4711
  } catch {
@@ -5194,14 +5205,14 @@ function registerMediaRoutes(api, adapter, options = {}) {
5194
5205
  }
5195
5206
 
5196
5207
  // src/routes/globalAssets.ts
5197
- import { existsSync as existsSync9, readFileSync as readFileSync12 } from "fs";
5208
+ import { existsSync as existsSync9, readFileSync as readFileSync11 } from "fs";
5198
5209
  import { homedir } from "os";
5199
5210
  import { join as join14 } from "path";
5200
5211
  function readGlobalAssets(home = homedir()) {
5201
5212
  const manifestPath = join14(home, ".media", "manifest.jsonl");
5202
5213
  if (!existsSync9(manifestPath)) return [];
5203
5214
  const out = [];
5204
- for (const line of readFileSync12(manifestPath, "utf8").split("\n")) {
5215
+ for (const line of readFileSync11(manifestPath, "utf8").split("\n")) {
5205
5216
  if (!line.trim()) continue;
5206
5217
  try {
5207
5218
  const rec = JSON.parse(line);
@@ -5450,7 +5461,7 @@ function numericAttribute(element, name) {
5450
5461
 
5451
5462
  // src/helpers/previewDocumentStore.ts
5452
5463
  import { createHash as createHash4 } from "crypto";
5453
- import { readFileSync as readFileSync13, readdirSync as readdirSync5, rmSync as rmSync5 } from "fs";
5464
+ import { readFileSync as readFileSync12, readdirSync as readdirSync5, rmSync as rmSync5 } from "fs";
5454
5465
  import { join as join15 } from "path";
5455
5466
  function createPreviewDocumentStore(projectDir, salt) {
5456
5467
  const dir = join15(projectDir, ".hyperframes", "preview");
@@ -5459,7 +5470,7 @@ ${key}`).digest("hex").slice(0, 32)}.html`);
5459
5470
  return {
5460
5471
  read(key) {
5461
5472
  try {
5462
- return readFileSync13(fileFor(key), "utf-8");
5473
+ return readFileSync12(fileFor(key), "utf-8");
5463
5474
  } catch {
5464
5475
  return null;
5465
5476
  }