@hyperframes/producer 0.8.194 → 0.8.195

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.
@@ -1492,6 +1492,7 @@ import {
1492
1492
  readMediaStart,
1493
1493
  redactTelemetryString as redactTelemetryString2,
1494
1494
  resolveNaturalMediaTimelineDurationFromValues,
1495
+ rewriteAssetPath,
1495
1496
  rewriteAssetPaths,
1496
1497
  rewriteCssAssetUrls,
1497
1498
  rewriteInlineStyleAssetUrls
@@ -1499,7 +1500,7 @@ import {
1499
1500
  import { MAX_AUDIO_GAIN } from "@hyperframes/core/audio-gain";
1500
1501
  import { readPlaybackRate } from "@hyperframes/parsers/media-duration";
1501
1502
  import { resolveRateSpec } from "@hyperframes/core/speed-ramp";
1502
- import { gsapCdnDist } from "@hyperframes/core/gsap-cdn";
1503
+ import { gsapCdnDist, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
1503
1504
  import {
1504
1505
  assignBundledRuntimeCompositionIds,
1505
1506
  assignMediaRenderIds,
@@ -2532,7 +2533,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
2532
2533
  const results = await Promise.all(
2533
2534
  workItems.map(async (item) => {
2534
2535
  const { html: compiledSub } = await compileHtmlFile(
2535
- item.rawSubHtml,
2536
+ rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
2536
2537
  dirname4(item.filePath),
2537
2538
  downloadDir,
2538
2539
  void 0,
@@ -2706,7 +2707,9 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
2706
2707
  let compHtml = subCompositions.get(srcPath) || null;
2707
2708
  if (!compHtml) {
2708
2709
  const read = readProjectFile(resolve5(projectDir, srcPath));
2709
- if (read.kind === "file") compHtml = read.text;
2710
+ if (read.kind === "file") {
2711
+ compHtml = rewriteUnresolvableGsapToCdn(read.text, projectDir, srcPath);
2712
+ }
2710
2713
  }
2711
2714
  return compHtml;
2712
2715
  },
@@ -3249,18 +3252,27 @@ async function embedLocalFontFaces(html, projectDir) {
3249
3252
  }
3250
3253
  return result;
3251
3254
  }
3252
- var GSAP_CDN_BASE = gsapCdnDist();
3253
- function rewriteUnresolvableGsapToCdn(html, projectDir) {
3255
+ function renderGsapDist() {
3256
+ try {
3257
+ return gsapCdnDist(void 0, normalizeGsapBaseUrl(process.env.HYPERFRAMES_GSAP_BASE_URL));
3258
+ } catch (cause) {
3259
+ throw new Error(
3260
+ "Invalid HYPERFRAMES_GSAP_BASE_URL: use an absolute HTTPS npm mirror root (plain HTTP only for localhost) without credentials, query, or fragment",
3261
+ { cause }
3262
+ );
3263
+ }
3264
+ }
3265
+ function rewriteUnresolvableGsapToCdn(html, projectDir, compSrcPath) {
3266
+ let gsapDist;
3267
+ const exists = (path) => existsSync6(resolve5(projectDir, path));
3254
3268
  return html.replace(
3255
3269
  /(<script\b[^>]*\bsrc=["'])([^"']*gsap[^"']*\/dist\/([^"']+))(["'][^>]*>)/gi,
3256
3270
  (full, prefix, src, file, suffix) => {
3257
3271
  if (/^https?:\/\//i.test(src)) return full;
3258
- const absPath = resolve5(projectDir, src);
3259
- if (existsSync6(absPath)) return full;
3260
- defaultLogger.info(
3261
- `[Compiler] Rewriting missing gsap script to CDN: ${src} \u2192 ${GSAP_CDN_BASE}${file}`
3262
- );
3263
- return `${prefix}${GSAP_CDN_BASE}${file}${suffix}`;
3272
+ if (exists(compSrcPath ? rewriteAssetPath(compSrcPath, src, exists) : src)) return full;
3273
+ gsapDist ??= renderGsapDist();
3274
+ defaultLogger.info(`[Compiler] Rewriting missing gsap script: ${src} \u2192 ${gsapDist}${file}`);
3275
+ return `${prefix}${gsapDist}${file}${suffix}`;
3264
3276
  }
3265
3277
  );
3266
3278
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "17f66a5b2b626b2c74d51365de8d8d74f7c4ce6d96089c893cb1054b201bd512",
4
+ "sha256": "5325b9ad7580263b1e0a9ad0873c5a768b80a8807731148ebfe84ef585184902",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"