@hyperframes/studio-server 0.8.193 → 0.8.194
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/{chunk-JPKAFJIJ.js → chunk-4HP26XV4.js} +74 -21
- package/dist/history/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +66 -31
- package/package.json +3 -3
|
@@ -512,14 +512,41 @@ async function cloneOrCopy(from, to, beforeReplace) {
|
|
|
512
512
|
throw error;
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
+
var listDir = (path) => readdir(path, { withFileTypes: true }).catch((error) => {
|
|
516
|
+
if (error.code === "ENOENT") return [];
|
|
517
|
+
throw error;
|
|
518
|
+
});
|
|
515
519
|
async function openBlobStore(dir) {
|
|
516
520
|
const sizes = /* @__PURE__ */ new Map();
|
|
521
|
+
const asideDir = join2(dirname(dir), "aside");
|
|
522
|
+
const asideSizes = /* @__PURE__ */ new Map();
|
|
523
|
+
const holds = /* @__PURE__ */ new Map();
|
|
517
524
|
await mkdir(dir, { recursive: true });
|
|
518
|
-
for (const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
525
|
+
for (const [root, found] of [
|
|
526
|
+
[dir, sizes],
|
|
527
|
+
[asideDir, asideSizes]
|
|
528
|
+
])
|
|
529
|
+
for (const shard of await listDir(root)) {
|
|
530
|
+
if (!shard.isDirectory()) {
|
|
531
|
+
if (shard.name.startsWith("incoming-")) await rm(join2(root, shard.name), { force: true });
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
for (const hash of await listDir(join2(root, shard.name)))
|
|
535
|
+
found.set(hash.name, (await stat(join2(root, shard.name, hash.name))).size);
|
|
536
|
+
}
|
|
537
|
+
for (const hash of asideSizes.keys()) holds.set(hash, /* @__PURE__ */ new Set(["*"]));
|
|
538
|
+
const pathOf = (hash) => blobPath(sizes.has(hash) ? dir : asideDir, hash);
|
|
522
539
|
let total = [...sizes.values()].reduce((sum, size) => sum + size, 0);
|
|
540
|
+
const forget = async (hash) => {
|
|
541
|
+
await rm(blobPath(dir, hash), { force: true });
|
|
542
|
+
total -= sizes.get(hash) ?? 0;
|
|
543
|
+
sizes.delete(hash);
|
|
544
|
+
};
|
|
545
|
+
const forgetAside = async (hash) => {
|
|
546
|
+
await rm(blobPath(asideDir, hash), { force: true });
|
|
547
|
+
asideSizes.delete(hash);
|
|
548
|
+
holds.delete(hash);
|
|
549
|
+
};
|
|
523
550
|
return {
|
|
524
551
|
async put(absPath) {
|
|
525
552
|
const temp = join2(dir, `incoming-${randomUUID3()}`);
|
|
@@ -533,35 +560,55 @@ async function openBlobStore(dir) {
|
|
|
533
560
|
await rm(temp, { force: true });
|
|
534
561
|
return hash;
|
|
535
562
|
}
|
|
536
|
-
await mkdir(dirname(
|
|
563
|
+
await mkdir(dirname(blobPath(dir, hash)), { recursive: true });
|
|
537
564
|
const size = (await stat(temp)).size;
|
|
538
|
-
await rename(temp,
|
|
565
|
+
await rename(temp, blobPath(dir, hash));
|
|
539
566
|
sizes.set(hash, size);
|
|
540
567
|
total += size;
|
|
541
568
|
return hash;
|
|
542
569
|
},
|
|
543
570
|
reference: (absPath) => hashFile(absPath),
|
|
544
|
-
has: (hash) => sizes.has(hash),
|
|
545
|
-
read:
|
|
571
|
+
has: (hash) => sizes.has(hash) || asideSizes.has(hash),
|
|
572
|
+
read: (hash) => readFile(pathOf(hash)),
|
|
546
573
|
writeTo: async (hash, absPath, beforeReplace) => cloneOrCopy(pathOf(hash), absPath, beforeReplace),
|
|
574
|
+
async release(held) {
|
|
575
|
+
for (const [hash, path] of held) {
|
|
576
|
+
holds.get(hash)?.delete(path);
|
|
577
|
+
if (holds.get(hash)?.size === 0) await forgetAside(hash);
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
async keep(path, absPath, remove) {
|
|
581
|
+
const hash = await hashFile(absPath);
|
|
582
|
+
if (sizes.has(hash)) return;
|
|
583
|
+
if (asideSizes.has(hash)) {
|
|
584
|
+
holds.get(hash).add(path);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
const to = blobPath(asideDir, hash);
|
|
588
|
+
await mkdir(dirname(to), { recursive: true });
|
|
589
|
+
const moved = remove && await rename(absPath, to).then(
|
|
590
|
+
() => true,
|
|
591
|
+
() => false
|
|
592
|
+
);
|
|
593
|
+
if (!moved) {
|
|
594
|
+
const temp = join2(asideDir, `incoming-${randomUUID3()}`);
|
|
595
|
+
await cloneOrStream(absPath, temp).catch(async (error) => {
|
|
596
|
+
await rm(temp, { force: true });
|
|
597
|
+
throw error;
|
|
598
|
+
});
|
|
599
|
+
await rename(temp, to);
|
|
600
|
+
}
|
|
601
|
+
asideSizes.set(hash, (await stat(to)).size);
|
|
602
|
+
holds.set(hash, /* @__PURE__ */ new Set([path]));
|
|
603
|
+
},
|
|
547
604
|
bytes: () => total,
|
|
548
605
|
size: (hash) => sizes.get(hash) ?? 0,
|
|
549
606
|
async drop(hashes) {
|
|
550
|
-
for (const hash of hashes)
|
|
551
|
-
const size = sizes.get(hash);
|
|
552
|
-
if (size === void 0) continue;
|
|
553
|
-
await rm(pathOf(hash), { force: true });
|
|
554
|
-
sizes.delete(hash);
|
|
555
|
-
total -= size;
|
|
556
|
-
}
|
|
607
|
+
for (const hash of hashes) if (sizes.has(hash)) await forget(hash);
|
|
557
608
|
},
|
|
558
609
|
async prune(keep) {
|
|
559
|
-
for (const
|
|
560
|
-
|
|
561
|
-
await rm(pathOf(hash), { force: true });
|
|
562
|
-
sizes.delete(hash);
|
|
563
|
-
total -= size;
|
|
564
|
-
}
|
|
610
|
+
for (const hash of [...sizes.keys()]) if (!keep.has(hash)) await forget(hash);
|
|
611
|
+
for (const hash of [...asideSizes.keys()]) if (!keep.has(hash)) await forgetAside(hash);
|
|
565
612
|
}
|
|
566
613
|
};
|
|
567
614
|
}
|
|
@@ -2309,6 +2356,9 @@ var Engine = class {
|
|
|
2309
2356
|
this.windows.push(group);
|
|
2310
2357
|
try {
|
|
2311
2358
|
for (const [path, hash] of changes) await this.writeProjectFile(path, hash);
|
|
2359
|
+
await this.blobs.release(
|
|
2360
|
+
changes.flatMap(([path, hash]) => hash ? [[hash, path]] : [])
|
|
2361
|
+
);
|
|
2312
2362
|
await this.sweep();
|
|
2313
2363
|
} finally {
|
|
2314
2364
|
this.windows = this.windows.filter((open) => open !== group);
|
|
@@ -2324,6 +2374,9 @@ var Engine = class {
|
|
|
2324
2374
|
const version = hash === null ? DELETED_VERSION : hashVersion(hash);
|
|
2325
2375
|
recordFileWriteReceipt(absPath, { path, version, writeToken });
|
|
2326
2376
|
}
|
|
2377
|
+
const standing = lstatSync4(absPath, { throwIfNoEntry: false });
|
|
2378
|
+
if (standing?.isFile() && isUncopied(path, standing.size))
|
|
2379
|
+
await this.blobs.keep(path, absPath, hash === null);
|
|
2327
2380
|
if (hash === null) {
|
|
2328
2381
|
this.assertWritable();
|
|
2329
2382
|
rmSync3(absPath, { force: true });
|
package/dist/history/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -188,7 +188,7 @@ declare const consumeFileWriteReceipt: typeof identifyFileWrite;
|
|
|
188
188
|
* by last-write-wins script execution order — this is intentional so the
|
|
189
189
|
* composition can pin a specific version.
|
|
190
190
|
*/
|
|
191
|
-
declare function buildSubCompositionHtml(projectDir: string, compPath: string, runtimeUrl: string, baseHref?: string, rawOverride?: string): string | null;
|
|
191
|
+
declare function buildSubCompositionHtml(projectDir: string, compPath: string, runtimeUrl: string, baseHref?: string, rawOverride?: string, gsapBaseUrl?: string): string | null;
|
|
192
192
|
|
|
193
193
|
interface ThumbnailOutputDimensions {
|
|
194
194
|
width: number;
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
resolveProjectSignature,
|
|
63
63
|
retainSnapshotOutput,
|
|
64
64
|
settledFileTag
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-4HP26XV4.js";
|
|
66
66
|
import {
|
|
67
67
|
clearElementScreenshotIsolation,
|
|
68
68
|
getElementScreenshotClip
|
|
@@ -367,7 +367,7 @@ function tagRootCompositionFile(bodyHtml, compPath) {
|
|
|
367
367
|
function rootHeadContent(rootHtml) {
|
|
368
368
|
return rootHtml.match(/<head[^>]*>([\s\S]*?)<\/head>/i)?.[1] ?? "";
|
|
369
369
|
}
|
|
370
|
-
function buildSubCompositionHtml(projectDir, compPath, runtimeUrl, baseHref, rawOverride) {
|
|
370
|
+
function buildSubCompositionHtml(projectDir, compPath, runtimeUrl, baseHref, rawOverride, gsapBaseUrl) {
|
|
371
371
|
const compFile = join2(projectDir, compPath);
|
|
372
372
|
if (!existsSync(compFile)) return null;
|
|
373
373
|
const rawComp = rawOverride ?? readFileSync(compFile, "utf-8");
|
|
@@ -419,7 +419,7 @@ ${compHeadContent}`;
|
|
|
419
419
|
<script ${RUNTIME_BOOTSTRAP_ATTR}="1" src="${runtimeUrl}"></script>`;
|
|
420
420
|
if (!headContent.includes("gsap")) {
|
|
421
421
|
headContent += `
|
|
422
|
-
<script src="${gsapCdnDist()}gsap.min.js"></script>`;
|
|
422
|
+
<script src="${gsapCdnDist(void 0, gsapBaseUrl).replace(/&/g, "&")}gsap.min.js"></script>`;
|
|
423
423
|
}
|
|
424
424
|
const htmlOpen = htmlAttrs ? `<html ${htmlAttrs}>` : "<html>";
|
|
425
425
|
const bodyOpen = bodyAttrs ? `<body ${bodyAttrs}>` : "<body>";
|
|
@@ -3838,7 +3838,12 @@ import {
|
|
|
3838
3838
|
STUDIO_PREVIEW_ERRORS
|
|
3839
3839
|
} from "@hyperframes/core/studio-preview-mark";
|
|
3840
3840
|
import { PREVIEW_PROXY_BOX_PARAM, parsePreviewProxyBox } from "@hyperframes/core";
|
|
3841
|
-
import {
|
|
3841
|
+
import {
|
|
3842
|
+
GSAP_BASE_URL_META,
|
|
3843
|
+
gsapCdnDist as gsapCdnDist2,
|
|
3844
|
+
motionPathPluginUrl,
|
|
3845
|
+
normalizeGsapBaseUrl
|
|
3846
|
+
} from "@hyperframes/core/gsap-cdn";
|
|
3842
3847
|
import { findStartTags as findStartTags2, injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
|
|
3843
3848
|
import { isWithinProjectRoot } from "@hyperframes/parsers/asset-resolution";
|
|
3844
3849
|
import { ensureHfIds as ensureHfIds2 } from "@hyperframes/parsers/hf-ids";
|
|
@@ -4003,9 +4008,12 @@ function lazyPreviewImages(html) {
|
|
|
4003
4008
|
|
|
4004
4009
|
// src/routes/preview.ts
|
|
4005
4010
|
var PROJECT_SIGNATURE_META = "hyperframes-project-signature";
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4011
|
+
function escapeGsapUrl(url) {
|
|
4012
|
+
return url.replace(/&/g, "&").replace(/"/g, """);
|
|
4013
|
+
}
|
|
4014
|
+
function gsapScriptTag(file, baseUrl) {
|
|
4015
|
+
return `<script src="${escapeGsapUrl(gsapCdnDist2(void 0, baseUrl) + file)}"></script>`;
|
|
4016
|
+
}
|
|
4009
4017
|
function injectProjectSignature(html, signature) {
|
|
4010
4018
|
const tag = `<meta name="${PROJECT_SIGNATURE_META}" content="${signature}">`;
|
|
4011
4019
|
if (html.includes(`name="${PROJECT_SIGNATURE_META}"`)) {
|
|
@@ -4061,16 +4069,16 @@ function htmlUsesMotionPath(html) {
|
|
|
4061
4069
|
function htmlHasMotionPathPlugin(html) {
|
|
4062
4070
|
return /<script\b[^>]*src=["'][^"']*MotionPathPlugin/i.test(html) || /\bwindow\.MotionPathPlugin\b/.test(html) || /\bMotionPathPlugin\s*=\s*/.test(html);
|
|
4063
4071
|
}
|
|
4064
|
-
function injectMotionPathPluginIfNeeded(html) {
|
|
4072
|
+
function injectMotionPathPluginIfNeeded(html, baseUrl) {
|
|
4065
4073
|
if (!htmlUsesMotionPath(html) || htmlHasMotionPathPlugin(html)) return html;
|
|
4066
4074
|
const gsap = findGsapCoreScript(html);
|
|
4067
4075
|
if (gsap) {
|
|
4068
4076
|
const version = gsap.src.match(/gsap@([\d.]+)/)?.[1];
|
|
4069
4077
|
const ordering = `${gsap.type ? ` type="${gsap.type}"` : ""}${gsap.defer ? " defer" : ""}`;
|
|
4070
|
-
const pluginTag = `<script${ordering} src="${motionPathPluginUrl(version)}"></script>`;
|
|
4078
|
+
const pluginTag = `<script${ordering} src="${escapeGsapUrl(motionPathPluginUrl(version, baseUrl))}"></script>`;
|
|
4071
4079
|
return html.slice(0, gsap.end) + "\n" + pluginTag + html.slice(gsap.end);
|
|
4072
4080
|
}
|
|
4073
|
-
return injectScriptTagIntoHead(html,
|
|
4081
|
+
return injectScriptTagIntoHead(html, gsapScriptTag("MotionPathPlugin.min.js", baseUrl));
|
|
4074
4082
|
}
|
|
4075
4083
|
function isGsapCoreUrl(src) {
|
|
4076
4084
|
const base = "http://localhost/";
|
|
@@ -4103,30 +4111,32 @@ function scriptCloseEnd(html, start) {
|
|
|
4103
4111
|
const closeAt = close.exec(html)?.index;
|
|
4104
4112
|
return closeAt === void 0 ? 0 : html.indexOf(">", closeAt) + 1;
|
|
4105
4113
|
}
|
|
4106
|
-
function injectStudioMotionDependencies(html, manifestContent) {
|
|
4114
|
+
function injectStudioMotionDependencies(html, manifestContent, baseUrl) {
|
|
4107
4115
|
const manifest = parseStudioMotionManifestContent(manifestContent);
|
|
4108
4116
|
if (!manifest.hasMotion) return html;
|
|
4109
4117
|
let next = html;
|
|
4110
|
-
if (!htmlHasGsap(next))
|
|
4118
|
+
if (!htmlHasGsap(next))
|
|
4119
|
+
next = injectScriptTagIntoHead(next, gsapScriptTag("gsap.min.js", baseUrl));
|
|
4111
4120
|
if (manifest.hasCustomEase && !htmlHasCustomEase(next)) {
|
|
4112
|
-
next = injectScriptTagIntoHead(next,
|
|
4121
|
+
next = injectScriptTagIntoHead(next, gsapScriptTag("CustomEase.min.js", baseUrl));
|
|
4113
4122
|
}
|
|
4114
4123
|
return next;
|
|
4115
4124
|
}
|
|
4116
|
-
function injectStudioMotionScript(html, projectDir, activeCompositionPath) {
|
|
4125
|
+
function injectStudioMotionScript(html, projectDir, activeCompositionPath, baseUrl) {
|
|
4117
4126
|
const manifestContent = readStudioMotionManifestContent(projectDir);
|
|
4118
4127
|
const script = createStudioMotionRenderBodyScript(manifestContent, {
|
|
4119
4128
|
activeCompositionPath
|
|
4120
4129
|
});
|
|
4121
4130
|
if (!script) return html;
|
|
4122
|
-
const withDependencies = injectStudioMotionDependencies(html, manifestContent);
|
|
4131
|
+
const withDependencies = injectStudioMotionDependencies(html, manifestContent, baseUrl);
|
|
4123
4132
|
const tag = `<script type="${AFTER_FONTS_SCRIPT_TYPE}">${script.replace(/<\/script/gi, "<\\/script")}</script>`;
|
|
4124
4133
|
return insertBeforeCloseTag2(withDependencies, "body", tag) ?? `${withDependencies}${tag}`;
|
|
4125
4134
|
}
|
|
4126
4135
|
var GSAP_FALLBACK_ATTR = "data-hf-gsap-fallback";
|
|
4127
|
-
|
|
4136
|
+
function gsapCdnFallbackScript(baseUrl) {
|
|
4137
|
+
return `<script ${GSAP_FALLBACK_ATTR}>
|
|
4128
4138
|
(function(){
|
|
4129
|
-
var cdnBase
|
|
4139
|
+
var cdnBase=${JSON.stringify(gsapCdnDist2(void 0, baseUrl)).replace(/</g, "\\u003c")};
|
|
4130
4140
|
var loaded={};
|
|
4131
4141
|
function loadFallback(file){
|
|
4132
4142
|
if(loaded[file])return loaded[file];
|
|
@@ -4146,10 +4156,12 @@ var GSAP_CDN_FALLBACK_SCRIPT = `<script ${GSAP_FALLBACK_ATTR}>
|
|
|
4146
4156
|
},true);
|
|
4147
4157
|
})();
|
|
4148
4158
|
</script>`;
|
|
4149
|
-
|
|
4159
|
+
}
|
|
4160
|
+
function injectGsapCdnFallback(html, baseUrl) {
|
|
4150
4161
|
if (html.includes(GSAP_FALLBACK_ATTR)) return html;
|
|
4151
|
-
if (html.includes("<head>"))
|
|
4152
|
-
|
|
4162
|
+
if (html.includes("<head>"))
|
|
4163
|
+
return html.replace("<head>", "<head>" + gsapCdnFallbackScript(baseUrl));
|
|
4164
|
+
return gsapCdnFallbackScript(baseUrl) + html;
|
|
4153
4165
|
}
|
|
4154
4166
|
function parsePreviewVariablesParam(raw) {
|
|
4155
4167
|
if (raw === void 0 || raw === "") return { ok: true, values: null };
|
|
@@ -4176,8 +4188,8 @@ function previewVariablesFromRequest(rawVariables) {
|
|
|
4176
4188
|
var PREVIEW_CAPTURE_PARAM = "hf-capture";
|
|
4177
4189
|
var EARLY_ERRORS_SCRIPT = `<script>(function(){var seen=window.${STUDIO_PREVIEW_ERRORS}=[];
|
|
4178
4190
|
addEventListener("error",function(e){seen.push(e.message||String(e))});})();</script>`;
|
|
4179
|
-
function injectStudioPreviewAugmentations(html, adapter, projectDir, activeCompositionPath,
|
|
4180
|
-
const marked = capture ? injectTagsAtHeadStart(
|
|
4191
|
+
function injectStudioPreviewAugmentations(html, adapter, projectDir, activeCompositionPath, options) {
|
|
4192
|
+
const marked = options.capture ? injectTagsAtHeadStart(
|
|
4181
4193
|
html,
|
|
4182
4194
|
`<meta name="${STUDIO_PREVIEW_MARK_META}" content="${STUDIO_PREVIEW_CAPTURE_MODE}">`
|
|
4183
4195
|
) : injectTagsAtHeadStart(
|
|
@@ -4187,11 +4199,20 @@ function injectStudioPreviewAugmentations(html, adapter, projectDir, activeCompo
|
|
|
4187
4199
|
return injectStudioMotionScript(
|
|
4188
4200
|
injectMotionPathPluginIfNeeded(
|
|
4189
4201
|
injectGsapCdnFallback(
|
|
4190
|
-
injectProjectSignature(
|
|
4191
|
-
|
|
4202
|
+
injectProjectSignature(
|
|
4203
|
+
injectTagsAtHeadStart(
|
|
4204
|
+
marked,
|
|
4205
|
+
`<meta name="${GSAP_BASE_URL_META}" content="${escapeGsapUrl(options.gsapBaseUrl)}">`
|
|
4206
|
+
),
|
|
4207
|
+
resolveProjectSignature(adapter, projectDir)
|
|
4208
|
+
),
|
|
4209
|
+
options.gsapBaseUrl
|
|
4210
|
+
),
|
|
4211
|
+
options.gsapBaseUrl
|
|
4192
4212
|
),
|
|
4193
4213
|
projectDir,
|
|
4194
|
-
activeCompositionPath
|
|
4214
|
+
activeCompositionPath,
|
|
4215
|
+
options.gsapBaseUrl
|
|
4195
4216
|
);
|
|
4196
4217
|
}
|
|
4197
4218
|
async function transformPreviewHtml(html, adapter, project, activeCompositionPath) {
|
|
@@ -4235,6 +4256,16 @@ var PREVIEW_BUNDLE_OPTIONS = {
|
|
|
4235
4256
|
var previewBaseHref = (projectId) => `/api/projects/${encodeURIComponent(projectId)}/preview/`;
|
|
4236
4257
|
var withPreviewBase = (html, projectId) => hasBaseElement(html) ? html : injectTagsAtHeadStart(html, `<base href="${previewBaseHref(projectId)}">`);
|
|
4237
4258
|
function registerPreviewRoutes(api, adapter) {
|
|
4259
|
+
let gsapBaseUrl;
|
|
4260
|
+
try {
|
|
4261
|
+
gsapBaseUrl = normalizeGsapBaseUrl(process.env.HYPERFRAMES_GSAP_BASE_URL);
|
|
4262
|
+
} catch (cause) {
|
|
4263
|
+
throw new Error(
|
|
4264
|
+
"Invalid HYPERFRAMES_GSAP_BASE_URL: use an absolute HTTP(S) npm mirror root without credentials, query, or fragment",
|
|
4265
|
+
{ cause }
|
|
4266
|
+
);
|
|
4267
|
+
}
|
|
4268
|
+
const gsapEtagSalt = `:gsap:${createHash2("sha1").update(gsapBaseUrl).digest("hex").slice(0, 12)}`;
|
|
4238
4269
|
const previewCacheHeaders = (etag) => ({
|
|
4239
4270
|
"Cache-Control": "private, no-cache",
|
|
4240
4271
|
ETag: etag
|
|
@@ -4269,7 +4300,7 @@ function registerPreviewRoutes(api, adapter) {
|
|
|
4269
4300
|
adapter,
|
|
4270
4301
|
project.dir,
|
|
4271
4302
|
mainCompositionPath,
|
|
4272
|
-
capture
|
|
4303
|
+
{ capture, gsapBaseUrl }
|
|
4273
4304
|
);
|
|
4274
4305
|
if (previewVariables) bundled = injectPreviewVariables(bundled, previewVariables);
|
|
4275
4306
|
bundled = await injectMediaCodecMap(
|
|
@@ -4297,7 +4328,7 @@ function registerPreviewRoutes(api, adapter) {
|
|
|
4297
4328
|
adapter,
|
|
4298
4329
|
project.dir,
|
|
4299
4330
|
fallback.compositionPath,
|
|
4300
|
-
capture
|
|
4331
|
+
{ capture, gsapBaseUrl }
|
|
4301
4332
|
);
|
|
4302
4333
|
if (previewVariables) {
|
|
4303
4334
|
fallbackAugmented = injectPreviewVariables(fallbackAugmented, previewVariables);
|
|
@@ -4322,7 +4353,7 @@ function registerPreviewRoutes(api, adapter) {
|
|
|
4322
4353
|
if (vars.error !== void 0) return c.json({ error: vars.error }, 400);
|
|
4323
4354
|
const previewVariables = vars.values;
|
|
4324
4355
|
const capture = c.req.query(PREVIEW_CAPTURE_PARAM) !== void 0;
|
|
4325
|
-
const etag = `"preview:${signature}${variablesEtagSalt(vars.raw)}${capture ? ":capture" : ""}"`;
|
|
4356
|
+
const etag = `"preview:${signature}${gsapEtagSalt}${variablesEtagSalt(vars.raw)}${capture ? ":capture" : ""}"`;
|
|
4326
4357
|
const ifNoneMatch = c.req.header("If-None-Match");
|
|
4327
4358
|
if (ifNoneMatch === etag) {
|
|
4328
4359
|
return new Response(null, {
|
|
@@ -4372,7 +4403,7 @@ ${etag}`;
|
|
|
4372
4403
|
}
|
|
4373
4404
|
const compPathHash = createHash2("sha1").update(compPath).digest("hex");
|
|
4374
4405
|
const capture = c.req.query(PREVIEW_CAPTURE_PARAM) !== void 0;
|
|
4375
|
-
const etag = `"comp:v2:${compPathHash}:${signature}${variablesEtagSalt(vars.raw)}${capture ? ":capture" : ""}"`;
|
|
4406
|
+
const etag = `"comp:v2:${compPathHash}:${signature}${gsapEtagSalt}${variablesEtagSalt(vars.raw)}${capture ? ":capture" : ""}"`;
|
|
4376
4407
|
const ifNoneMatch = c.req.header("If-None-Match");
|
|
4377
4408
|
if (ifNoneMatch === etag) {
|
|
4378
4409
|
return new Response(null, {
|
|
@@ -4388,12 +4419,16 @@ ${etag}`;
|
|
|
4388
4419
|
compPath,
|
|
4389
4420
|
adapter.runtimeUrl,
|
|
4390
4421
|
baseHref,
|
|
4391
|
-
stamped
|
|
4422
|
+
stamped,
|
|
4423
|
+
gsapBaseUrl
|
|
4392
4424
|
);
|
|
4393
4425
|
if (!html) return c.text("not found", 404);
|
|
4394
4426
|
recordPreviewReferences(project.dir, html);
|
|
4395
4427
|
html = ensureHfIds2(await transformPreviewHtml(html, adapter, project, compPath));
|
|
4396
|
-
html = injectStudioPreviewAugmentations(html, adapter, project.dir, compPath,
|
|
4428
|
+
html = injectStudioPreviewAugmentations(html, adapter, project.dir, compPath, {
|
|
4429
|
+
capture,
|
|
4430
|
+
gsapBaseUrl
|
|
4431
|
+
});
|
|
4397
4432
|
if (previewVariables) html = injectPreviewVariables(html, previewVariables);
|
|
4398
4433
|
html = await injectMediaCodecMap(html, adapter, project.dir, compPath, mediaCodecProbeCache);
|
|
4399
4434
|
return c.html(html, 200, previewCacheHeaders(etag));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/studio-server",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.194",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"linkedom": "^0.18.12",
|
|
85
85
|
"postcss": "^8.5.8",
|
|
86
86
|
"postcss-selector-parser": "^7.1.2",
|
|
87
|
-
"@hyperframes/core": "0.8.
|
|
88
|
-
"@hyperframes/parsers": "0.8.
|
|
87
|
+
"@hyperframes/core": "0.8.194",
|
|
88
|
+
"@hyperframes/parsers": "0.8.194"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@types/node": "^25.0.10",
|