@hyperframes/studio-server 0.9.7 → 0.9.8

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -4
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -3933,6 +3933,7 @@ import {
3933
3933
  import {
3934
3934
  STUDIO_PREVIEW_CAPTURE_MODE,
3935
3935
  STUDIO_PREVIEW_MARK_META,
3936
+ STUDIO_PREVIEW_ERROR_KINDS,
3936
3937
  STUDIO_PREVIEW_ERRORS
3937
3938
  } from "@hyperframes/core/studio-preview-mark";
3938
3939
  import {
@@ -4280,7 +4281,7 @@ var GSAP_FALLBACK_ATTR = "data-hf-gsap-fallback";
4280
4281
  function gsapCdnFallbackScript(baseUrl) {
4281
4282
  return `<script ${GSAP_FALLBACK_ATTR}>
4282
4283
  (function(){
4283
- var cdnBase=${JSON.stringify(gsapCdnDist2(void 0, baseUrl)).replace(/</g, "\\u003c")};
4284
+ var cdnBase=${scriptJson(gsapCdnDist2(void 0, baseUrl))};
4284
4285
  var loaded={};
4285
4286
  function loadFallback(file){
4286
4287
  if(loaded[file])return loaded[file];
@@ -4330,15 +4331,21 @@ function previewVariablesFromRequest(rawVariables) {
4330
4331
  return { raw: rawVariables, values: parse2.values };
4331
4332
  }
4332
4333
  var PREVIEW_CAPTURE_PARAM = "hf-capture";
4333
- var EARLY_ERRORS_SCRIPT = `<script>(function(){var seen=window.${STUDIO_PREVIEW_ERRORS}=[];
4334
- addEventListener("error",function(e){seen.push(e.message||String(e))});})();</script>`;
4334
+ function scriptJson(value) {
4335
+ return JSON.stringify(value).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
4336
+ }
4337
+ var earlyErrorsScript = (runtimeUrl) => `<script>(function(){var seen=window.${STUDIO_PREVIEW_ERRORS}=[],kinds=window.${STUDIO_PREVIEW_ERROR_KINDS}=[],known={SyntaxError:1,TypeError:1,ReferenceError:1,RangeError:1},runtime=${scriptJson(new URL(runtimeUrl, "http://x").pathname)};
4338
+ addEventListener("error",function(e){seen.push(e.message||String(e));
4339
+ var name=e.error&&e.error.constructor&&e.error.constructor.name,path="";
4340
+ try{var url=e.filename&&new URL(e.filename,window.location.href);if(url&&url.origin===window.location.origin)path=url.pathname}catch(_){}
4341
+ kinds.push({name:known[name]===1?name:"other",origin:!path?"unknown":path===runtime?"runtime":path.indexOf("/api/projects/")===0?"project":"studio"})});})();</script>`;
4335
4342
  function injectStudioPreviewAugmentations(html, adapter, projectDir, activeCompositionPath, options) {
4336
4343
  const marked = options.capture ? injectTagsAtHeadStart2(
4337
4344
  html,
4338
4345
  `<meta name="${STUDIO_PREVIEW_MARK_META}" content="${STUDIO_PREVIEW_CAPTURE_MODE}">`
4339
4346
  ) : injectTagsAtHeadStart2(
4340
4347
  lazyPreviewImages(html),
4341
- `<meta name="${STUDIO_PREVIEW_MARK_META}">${EARLY_ERRORS_SCRIPT}`
4348
+ `<meta name="${STUDIO_PREVIEW_MARK_META}">${earlyErrorsScript(adapter.runtimeUrl)}`
4342
4349
  );
4343
4350
  const withFallback = injectGsapCdnFallback(
4344
4351
  injectProjectSignature(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/studio-server",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -88,8 +88,8 @@
88
88
  "linkedom": "^0.18.12",
89
89
  "postcss": "^8.5.8",
90
90
  "postcss-selector-parser": "^7.1.2",
91
- "@hyperframes/parsers": "0.9.7",
92
- "@hyperframes/core": "0.9.7"
91
+ "@hyperframes/core": "0.9.8",
92
+ "@hyperframes/parsers": "0.9.8"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@types/node": "^25.0.10",