@hyperframes/studio-server 0.8.102 → 0.8.104
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 +5 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3613,6 +3613,8 @@ var PREVIEW_BUNDLE_OPTIONS = {
|
|
|
3613
3613
|
staticGuard: false,
|
|
3614
3614
|
sceneParts: true
|
|
3615
3615
|
};
|
|
3616
|
+
var previewBaseHref = (projectId) => `/api/projects/${encodeURIComponent(projectId)}/preview/`;
|
|
3617
|
+
var withPreviewBase = (html, projectId) => hasBaseElement(html) ? html : injectTagsAtHeadStart(html, `<base href="${previewBaseHref(projectId)}">`);
|
|
3616
3618
|
function registerPreviewRoutes(api, adapter) {
|
|
3617
3619
|
const previewCacheHeaders = (etag) => ({
|
|
3618
3620
|
"Cache-Control": "private, no-cache",
|
|
@@ -3648,10 +3650,7 @@ function registerPreviewRoutes(api, adapter) {
|
|
|
3648
3650
|
`) ?? `${bundled}
|
|
3649
3651
|
${runtimeTag}`;
|
|
3650
3652
|
}
|
|
3651
|
-
|
|
3652
|
-
if (!hasBaseElement(bundled)) {
|
|
3653
|
-
bundled = bundled.replace(/<head>/i, `<head><base href="${baseHref}">`);
|
|
3654
|
-
}
|
|
3653
|
+
bundled = withPreviewBase(bundled, project.id);
|
|
3655
3654
|
bundled = injectStudioPreviewAugmentations(
|
|
3656
3655
|
ensureHfIds2(await transformPreviewHtml(bundled, adapter, project, mainCompositionPath)),
|
|
3657
3656
|
adapter,
|
|
@@ -3676,7 +3675,7 @@ ${runtimeTag}`;
|
|
|
3676
3675
|
} catch {
|
|
3677
3676
|
const fallback = resolveProjectMainHtml(project.dir, project.id);
|
|
3678
3677
|
if (fallback) {
|
|
3679
|
-
const fallbackHtml = ensureHfIds2(fallback.html);
|
|
3678
|
+
const fallbackHtml = withPreviewBase(ensureHfIds2(fallback.html), project.id);
|
|
3680
3679
|
let fallbackAugmented = injectStudioPreviewAugmentations(
|
|
3681
3680
|
await transformPreviewHtml(fallbackHtml, adapter, project, fallback.compositionPath),
|
|
3682
3681
|
adapter,
|
|
@@ -3767,7 +3766,7 @@ ${etag}`;
|
|
|
3767
3766
|
}
|
|
3768
3767
|
const stamped = pinSubCompHfIds(compFile, compPath);
|
|
3769
3768
|
if (stamped === null) return c.text("not found", 404);
|
|
3770
|
-
const baseHref =
|
|
3769
|
+
const baseHref = previewBaseHref(project.id);
|
|
3771
3770
|
let html = buildSubCompositionHtml(
|
|
3772
3771
|
project.dir,
|
|
3773
3772
|
compPath,
|