@hyperframes/producer 0.9.55 → 0.9.56

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/README.md CHANGED
@@ -8,7 +8,7 @@ Full HTML-to-video rendering pipeline: capture frames with Chrome's BeginFrame A
8
8
  npm install @hyperframes/producer
9
9
  ```
10
10
 
11
- **Requirements:** Node.js >= 22, Chrome/Chromium (auto-downloaded), FFmpeg
11
+ **Requirements:** Node.js >= 22, FFmpeg, and the pinned `chrome-headless-shell`: run `npx hyperframes browser ensure` once, or name a browser in `PRODUCER_HEADLESS_SHELL_PATH`. A cached browser is used only when its files match the pinned build. HDR capture needs a full Chrome named in `HYPERFRAMES_BROWSER_PATH`.
12
12
 
13
13
  ## Usage
14
14
 
@@ -39,7 +39,7 @@ export { assemble, chunksAreStitchedMp4, stitchesSeparateAudio, type AssembleChu
39
39
  export { muxChunkWithAudio } from "./services/distributed/chunkAudio.js";
40
40
  export { buildStitchedHeader, readMp4Layout, type Mp4Layout, type ReadRange, } from "./services/distributed/mp4Stitch.js";
41
41
  export { InvalidConfigError, type SerializableDistributedRenderConfig, validateDistributedRenderConfig, validateVariablesPayload, } from "./services/distributed/renderConfigValidation.js";
42
- export { hashProjectDir, listSiteFiles } from "./services/distributed/projectHash.js";
42
+ export { hashProjectDir, isPrivateSitePath, listSiteFiles, listSiteFilesForUpload, } from "./services/distributed/projectHash.js";
43
43
  export { AUDIO_SIDECAR_MIN_BYTES, buildAudioSidecar, wantsAudioSidecar, type AudioSidecarOutcome, } from "./services/distributed/audioSidecar.js";
44
44
  export { buildProbeFacts, wantsProbeFacts, type ProbeFactsOutcome, } from "./services/distributed/probeFacts.js";
45
45
  export { PLAN_PROTOCOL_V2, PLAN_PROTOCOL_UNSUPPORTED, PLAN_V2_ARTIFACT_LAYOUT, PLAN_V2_HASH_SCHEMA, PLAN_V2_SCHEMA_VERSION, PlanProtocolUnsupportedError, type PlanProtocolDescriptor, type PlanProtocolV2Descriptor, } from "./services/distributed/planProtocol.js";
@@ -160,7 +160,177 @@ import {
160
160
  toFps as toFps2
161
161
  } from "@hyperframes/core";
162
162
  import { HF_AUDIO_GROUP_TAG } from "@hyperframes/core/audio-groups";
163
- import { HTML_BODY_CSS_HEIGHT_FIRST_RE, HTML_BODY_CSS_WIDTH_FIRST_RE } from "@hyperframes/parsers";
163
+
164
+ // src/services/htmlTagScans.ts
165
+ function forwardFinder(text, pattern) {
166
+ let start = -1;
167
+ let found = null;
168
+ return (from) => {
169
+ if (start < 0 || from < start || found !== null && from > found.index) {
170
+ start = from;
171
+ pattern.lastIndex = from;
172
+ found = pattern.exec(text);
173
+ }
174
+ return found;
175
+ };
176
+ }
177
+ function indexFinder(text, pattern) {
178
+ const find = forwardFinder(text, pattern);
179
+ return (from) => find(from)?.index ?? -1;
180
+ }
181
+ function* inlineScriptBlocks(html) {
182
+ const opener = /<script\b/gi;
183
+ const closer = /<\/script>/gi;
184
+ for (let open2 = opener.exec(html); open2; open2 = opener.exec(html)) {
185
+ const attrsStart = open2.index + open2[0].length;
186
+ const gt = html.indexOf(">", attrsStart);
187
+ if (gt < 0) return;
188
+ closer.lastIndex = gt + 1;
189
+ const close = closer.exec(html);
190
+ if (!close) return;
191
+ yield { attrs: html.slice(attrsStart, gt), body: html.slice(gt + 1, close.index) };
192
+ opener.lastIndex = close.index + close[0].length;
193
+ }
194
+ }
195
+ function removeDelimitedRuns(source, start, end) {
196
+ let out = "";
197
+ let kept = 0;
198
+ for (let open2 = source.indexOf(start); open2 >= 0; open2 = source.indexOf(start, kept)) {
199
+ const close = source.indexOf(end, open2 + start.length);
200
+ if (close < 0) break;
201
+ out += source.slice(kept, open2);
202
+ kept = close + end.length;
203
+ }
204
+ return out + source.slice(kept);
205
+ }
206
+ function gsapDistFile(value) {
207
+ let dist = -1;
208
+ const distPattern = /\/dist\//gi;
209
+ for (let m = distPattern.exec(value); m; m = distPattern.exec(value)) {
210
+ if (m.index + 6 < value.length) dist = m.index;
211
+ distPattern.lastIndex = m.index + 1;
212
+ }
213
+ const gsap = dist < 0 ? null : /gsap/i.exec(value);
214
+ return gsap && gsap.index + 4 <= dist ? value.slice(dist + 6) : void 0;
215
+ }
216
+ function lastGsapMatch(html, finders, tagStart, gt) {
217
+ const { nextSrc, nextQuote, nextGt } = finders;
218
+ let match;
219
+ for (let src = nextSrc(tagStart); src && src.index < gt; src = nextSrc(src.index + 1)) {
220
+ const valueStart = src.index + 5;
221
+ const close = nextQuote(valueStart);
222
+ const end = close < 0 ? -1 : nextGt(close + 1);
223
+ if (end < 0) return { match, laterTagsFail: true };
224
+ const file = gsapDistFile(html.slice(valueStart, close));
225
+ if (file !== void 0) match = { valueStart, close, end, file };
226
+ }
227
+ return { match, laterTagsFail: false };
228
+ }
229
+ function replaceGsapDistScripts(html, replace) {
230
+ const opener = /<script\b/gi;
231
+ const finders = {
232
+ nextSrc: forwardFinder(html, /\bsrc=["']/gi),
233
+ nextQuote: indexFinder(html, /["']/g),
234
+ nextGt: indexFinder(html, />/g)
235
+ };
236
+ let out = "";
237
+ let kept = 0;
238
+ for (let open2 = opener.exec(html); open2; open2 = opener.exec(html)) {
239
+ const gt = finders.nextGt(open2.index);
240
+ if (gt < 0) break;
241
+ const { match, laterTagsFail } = lastGsapMatch(html, finders, open2.index, gt);
242
+ if (match) {
243
+ const { valueStart, close, end, file } = match;
244
+ const full = html.slice(open2.index, end + 1);
245
+ const src = html.slice(valueStart, close);
246
+ out += html.slice(kept, open2.index);
247
+ out += replace(
248
+ full,
249
+ html.slice(open2.index, valueStart),
250
+ src,
251
+ file,
252
+ html.slice(close, end + 1)
253
+ );
254
+ kept = end + 1;
255
+ }
256
+ if (laterTagsFail) break;
257
+ opener.lastIndex = match ? kept : gt;
258
+ }
259
+ return out + html.slice(kept);
260
+ }
261
+ function removeSpanPerTag(html, opener, spanIn) {
262
+ const nextGt = indexFinder(html, />/g);
263
+ let out = "";
264
+ let kept = 0;
265
+ for (let open2 = opener.exec(html); open2; open2 = opener.exec(html)) {
266
+ const attrsStart = open2.index + open2[0].length;
267
+ const gt = nextGt(attrsStart);
268
+ const span = spanIn(attrsStart, gt < 0 ? html.length : gt);
269
+ if (span) {
270
+ out += html.slice(kept, span[0]);
271
+ kept = span[1];
272
+ } else if (gt < 0) break;
273
+ opener.lastIndex = span ? kept : gt;
274
+ }
275
+ return out + html.slice(kept);
276
+ }
277
+ function stripCrossoriginAttr(html, tagName) {
278
+ const nextQuote = indexFinder(html, /["']/g);
279
+ const nextAttr = forwardFinder(html, /\scrossorigin/gi);
280
+ return removeSpanPerTag(html, new RegExp(`<${tagName}\\b`, "gi"), (attrsStart, tagEnd) => {
281
+ let last = -1;
282
+ for (let at = nextAttr(attrsStart); at && at.index < tagEnd; at = nextAttr(at.index + 12)) {
283
+ last = at.index;
284
+ }
285
+ if (last < 0) return void 0;
286
+ const nameEnd = last + 12;
287
+ const quote = html[nameEnd + 1];
288
+ const quoted = html[nameEnd] === "=" && (quote === '"' || quote === "'");
289
+ const close = quoted ? nextQuote(nameEnd + 2) : -1;
290
+ return [last, close < 0 ? nameEnd : close + 1];
291
+ });
292
+ }
293
+ function stripPreloadNone(html) {
294
+ const nextAttr = forwardFinder(html, /(?<!\s)\s+preload\s*=\s*["']none["']/gi);
295
+ return removeSpanPerTag(html, /<(?:video|audio)\b/gi, (attrsStart, tagEnd) => {
296
+ const attr = nextAttr(attrsStart);
297
+ return attr && attr.index < tagEnd ? [attr.index, attr.index + attr[0].length] : void 0;
298
+ });
299
+ }
300
+ var REMOTE_SRC_TAGS = {
301
+ media: { opener: "<(?:video|audio)\\b", attr: /\bsrc\s*=\s*["'](https?:\/\/)/gi },
302
+ source: { opener: "<source\\b", attr: /\bsrc\s*=\s*["'](https?:\/\/)/gi },
303
+ img: { opener: "<img\\b", attr: /(?<![\w-])src\s*=\s*["'](https?:\/\/)/gi }
304
+ };
305
+ function remoteSrcUrls(html, tag) {
306
+ const opener = new RegExp(REMOTE_SRC_TAGS[tag].opener, "gi");
307
+ const nextAttr = forwardFinder(html, new RegExp(REMOTE_SRC_TAGS[tag].attr));
308
+ const nextGt = indexFinder(html, />/g);
309
+ const nextQuote = indexFinder(html, /["']/g);
310
+ const urls = [];
311
+ for (let open2 = opener.exec(html); open2; open2 = opener.exec(html)) {
312
+ const attrsStart = open2.index + open2[0].length;
313
+ const gt = nextGt(attrsStart);
314
+ if (gt < 0) break;
315
+ let resumeAt = gt;
316
+ for (let attr = nextAttr(attrsStart); attr && attr.index < gt; attr = nextAttr(attr.index + 1)) {
317
+ const urlRest = attr.index + attr[0].length;
318
+ const close = nextQuote(urlRest);
319
+ if (close < 0) return urls;
320
+ if (close === urlRest) continue;
321
+ const end = nextGt(close + 1);
322
+ if (end < 0) return urls;
323
+ urls.push(html.slice(urlRest - attr[1].length, close));
324
+ resumeAt = end + 1;
325
+ break;
326
+ }
327
+ opener.lastIndex = resumeAt;
328
+ }
329
+ return urls;
330
+ }
331
+
332
+ // src/services/renderOrchestrator.ts
333
+ import { matchHtmlBodyCssHeightFirst, matchHtmlBodyCssWidthFirst } from "@hyperframes/parsers";
164
334
  import {
165
335
  extractMediaMetadata as extractMediaMetadata5,
166
336
  resolveConfig as resolveConfig2,
@@ -2564,14 +2734,13 @@ function resolveLocalImageSourcePath(src, options) {
2564
2734
  const mapped = options.sourceAssets?.get(trimmed) ?? options.sourceAssets?.get(basePath) ?? options.sourceAssets?.get(normalizedBase);
2565
2735
  if (mapped && existsSync5(mapped)) return mapped;
2566
2736
  if (isHttpUrl(trimmed)) return null;
2567
- const protocolRelativeUrlOnShare = basePath.startsWith("/") && namesAnotherNetworkRoot(options.projectDir, basePath);
2568
2737
  const projectRelative = basePath.startsWith("/") ? basePath.slice(1) : basePath;
2569
2738
  const candidates = [
2570
- ...protocolRelativeUrlOnShare ? [] : [isAbsolute2(basePath) ? basePath : resolve4(options.projectDir, projectRelative)],
2739
+ isAbsolute2(basePath) ? basePath : resolve4(options.projectDir, projectRelative),
2571
2740
  resolve4(options.downloadDir, normalizedBase)
2572
2741
  ];
2573
- const allowed = (candidate) => !escapesAssetRoot(candidate, options.assetRoot) && outsideAssetRefusal(options.projectDir, candidate) !== "blocklisted" || !escapesAssetRoot(candidate, options.downloadDir);
2574
- return candidates.find((candidate) => existsSync5(candidate) && allowed(candidate)) ?? null;
2742
+ const allowed = (candidate) => !namesAnotherNetworkRoot(options.projectDir, candidate) && (!escapesAssetRoot(candidate, options.assetRoot) && outsideAssetRefusal(options.projectDir, candidate) !== "blocklisted" || !escapesAssetRoot(candidate, options.downloadDir));
2743
+ return candidates.find((candidate) => allowed(candidate) && existsSync5(candidate)) ?? null;
2575
2744
  }
2576
2745
  function isUsableFile(path) {
2577
2746
  try {
@@ -3433,20 +3602,13 @@ function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @
3433
3602
  throw new EmptyCompositionError(problems);
3434
3603
  }
3435
3604
  }
3436
- var INLINE_SCRIPT_PATTERN = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
3437
3605
  var COMPILER_MOUNT_BLOCK_START = "/* __HF_COMPILER_MOUNT_START__ */";
3438
3606
  var COMPILER_MOUNT_BLOCK_END = "/* __HF_COMPILER_MOUNT_END__ */";
3439
3607
  function stripJsComments(source) {
3440
- return source.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
3608
+ return removeDelimitedRuns(source.replace(/\/\/.*$/gm, ""), "/*", "*/");
3441
3609
  }
3442
3610
  function stripCompilerMountBootstrap(source) {
3443
- return source.replace(
3444
- new RegExp(
3445
- `${COMPILER_MOUNT_BLOCK_START.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}[\\s\\S]*?${COMPILER_MOUNT_BLOCK_END.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`,
3446
- "g"
3447
- ),
3448
- ""
3449
- );
3611
+ return removeDelimitedRuns(source, COMPILER_MOUNT_BLOCK_START, COMPILER_MOUNT_BLOCK_END);
3450
3612
  }
3451
3613
  function runtimeRoot(document2) {
3452
3614
  return document2.querySelector('[data-composition-id][data-root="true"]') ?? document2.querySelector("[data-composition-id]");
@@ -3471,12 +3633,9 @@ function detectRenderModeHints(html, pageMotionBlur) {
3471
3633
  message: "Detected <iframe> in the composition DOM. Nested iframe animation is routed through screenshot capture mode for compatibility."
3472
3634
  });
3473
3635
  }
3474
- let scriptMatch;
3475
- const scriptPattern = new RegExp(INLINE_SCRIPT_PATTERN.source, INLINE_SCRIPT_PATTERN.flags);
3476
- while ((scriptMatch = scriptPattern.exec(html)) !== null) {
3477
- const attrs = scriptMatch[1] || "";
3636
+ for (const { attrs, body } of inlineScriptBlocks(html)) {
3478
3637
  if (/\bsrc\s*=/i.test(attrs)) continue;
3479
- const content = stripJsComments(stripCompilerMountBootstrap(scriptMatch[2] || ""));
3638
+ const content = stripJsComments(stripCompilerMountBootstrap(body));
3480
3639
  if (!/requestAnimationFrame\s*\(/.test(content)) continue;
3481
3640
  reasons.push({
3482
3641
  code: "requestAnimationFrame",
@@ -3528,12 +3687,9 @@ function detectAncestorBackgroundImage(html) {
3528
3687
  }
3529
3688
  var SHADER_TRANSITION_USAGE_PATTERN = /\b(?:(?:window|globalThis)\s*\.\s*)?HyperShader\s*\.\s*init\s*\(|\b__hf\s*\.\s*transitions\s*=/;
3530
3689
  function detectShaderTransitionUsage(html) {
3531
- let scriptMatch;
3532
- const scriptPattern = new RegExp(INLINE_SCRIPT_PATTERN.source, INLINE_SCRIPT_PATTERN.flags);
3533
- while ((scriptMatch = scriptPattern.exec(html)) !== null) {
3534
- const attrs = scriptMatch[1] || "";
3690
+ for (const { attrs, body } of inlineScriptBlocks(html)) {
3535
3691
  if (/\bsrc\s*=/i.test(attrs)) continue;
3536
- const content = stripJsComments(stripCompilerMountBootstrap(scriptMatch[2] || ""));
3692
+ const content = stripJsComments(stripCompilerMountBootstrap(body));
3537
3693
  if (SHADER_TRANSITION_USAGE_PATTERN.test(content)) return true;
3538
3694
  }
3539
3695
  return false;
@@ -3689,9 +3845,9 @@ async function compileHtmlFile(html, baseDir, downloadDir, log, urlByAbsentLocal
3689
3845
  if (clampList.length > 0) {
3690
3846
  compiledHtml = clampDurations(compiledHtml, clampList);
3691
3847
  }
3692
- compiledHtml = compiledHtml.replace(/(<video\b[^>]*)\s+crossorigin(?:=["'][^"']*["'])?/gi, "$1");
3693
- compiledHtml = compiledHtml.replace(/(<img\b[^>]*)\s+crossorigin(?:=["'][^"']*["'])?/gi, "$1");
3694
- compiledHtml = compiledHtml.replace(/(<audio\b[^>]*)\s+crossorigin(?:=["'][^"']*["'])?/gi, "$1");
3848
+ compiledHtml = stripCrossoriginAttr(compiledHtml, "video");
3849
+ compiledHtml = stripCrossoriginAttr(compiledHtml, "img");
3850
+ compiledHtml = stripCrossoriginAttr(compiledHtml, "audio");
3695
3851
  return { html: compiledHtml, unresolvedCompositions };
3696
3852
  }
3697
3853
  async function parseSubCompositions(html, projectDir, downloadDir, visited = /* @__PURE__ */ new Set(), urlByAbsentLocalPath, probes, assetRoot) {
@@ -4117,7 +4273,7 @@ ${safeText}
4117
4273
  function collectExternalAssets(html, projectDir, log = defaultLogger, file = "index.html") {
4118
4274
  const absProjectDir = resolve6(projectDir);
4119
4275
  const externalAssets = /* @__PURE__ */ new Map();
4120
- const leftOut2 = /* @__PURE__ */ new Set();
4276
+ const leftOut = /* @__PURE__ */ new Set();
4121
4277
  function processPath(rawPath) {
4122
4278
  const trimmed = rawPath.trim();
4123
4279
  if (isNonRelativeUrl(trimmed)) return null;
@@ -4125,11 +4281,12 @@ function collectExternalAssets(html, projectDir, log = defaultLogger, file = "in
4125
4281
  if (isPathInside(absPath, absProjectDir)) {
4126
4282
  return null;
4127
4283
  }
4128
- if (!existsSync7(absPath)) return null;
4129
- const refusal = outsideAssetRefusal(absProjectDir, absPath);
4284
+ const onShare = namesAnotherNetworkRoot2(absProjectDir, absPath);
4285
+ if (!onShare && !existsSync7(absPath)) return null;
4286
+ const refusal = onShare ? "network_share" : outsideAssetRefusal(absProjectDir, absPath);
4130
4287
  if (refusal) {
4131
- if (!leftOut2.has(trimmed)) log.warn(`[Compiler] ${leftOutOfRender(file, trimmed, refusal)}`);
4132
- leftOut2.add(trimmed);
4288
+ if (!leftOut.has(trimmed)) log.warn(`[Compiler] ${leftOutOfRender(file, trimmed, refusal)}`);
4289
+ leftOut.add(trimmed);
4133
4290
  return null;
4134
4291
  }
4135
4292
  const safeKey = toExternalAssetKey(absPath);
@@ -4176,9 +4333,6 @@ function collectExternalAssets(html, projectDir, log = defaultLogger, file = "in
4176
4333
  };
4177
4334
  }
4178
4335
  var REMOTE_MEDIA_SUBDIR = "_remote_media";
4179
- var REMOTE_MEDIA_TAG_RE = /<(?:video|audio)\b[^>]*?\bsrc\s*=\s*["'](https?:\/\/[^"']+)["'][^>]*>/gi;
4180
- var REMOTE_SOURCE_TAG_RE = /<source\b[^>]*?\bsrc\s*=\s*["'](https?:\/\/[^"']+)["'][^>]*>/gi;
4181
- var REMOTE_IMG_TAG_RE = /<img\b[^>]*?(?<![\w-])src\s*=\s*["'](https?:\/\/[^"']+)["'][^>]*>/gi;
4182
4336
  async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, extraRewrite) {
4183
4337
  if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
4184
4338
  if (!existsSync7(remoteDir)) mkdirSync4(remoteDir, { recursive: true });
@@ -4217,14 +4371,7 @@ async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLab
4217
4371
  return { html: result, remoteMediaAssets };
4218
4372
  }
4219
4373
  async function localizeRemoteMediaSources(html, downloadDir) {
4220
- const urlSet = /* @__PURE__ */ new Set();
4221
- for (const tagRe of [REMOTE_MEDIA_TAG_RE, REMOTE_SOURCE_TAG_RE]) {
4222
- const re = new RegExp(tagRe.source, tagRe.flags);
4223
- let m;
4224
- while ((m = re.exec(html)) !== null) {
4225
- if (m[1]) urlSet.add(m[1]);
4226
- }
4227
- }
4374
+ const urlSet = /* @__PURE__ */ new Set([...remoteSrcUrls(html, "media"), ...remoteSrcUrls(html, "source")]);
4228
4375
  const localized = await downloadAndRewriteUrls(
4229
4376
  urlSet,
4230
4377
  html,
@@ -4247,12 +4394,7 @@ function dropBindingOnLocalizedMedia(html) {
4247
4394
  return changed ? document2.toString() : html;
4248
4395
  }
4249
4396
  async function localizeRemoteImageSources(html, downloadDir) {
4250
- const urlSet = /* @__PURE__ */ new Set();
4251
- const re = new RegExp(REMOTE_IMG_TAG_RE.source, REMOTE_IMG_TAG_RE.flags);
4252
- let m;
4253
- while ((m = re.exec(html)) !== null) {
4254
- if (m[1]) urlSet.add(m[1]);
4255
- }
4397
+ const urlSet = new Set(remoteSrcUrls(html, "img"));
4256
4398
  return downloadAndRewriteUrls(
4257
4399
  urlSet,
4258
4400
  html,
@@ -4513,16 +4655,13 @@ function rewriteUnresolvableGsapToCdn(html, projectDir, compSrcPath) {
4513
4655
  const file = resolve6(projectDir, path);
4514
4656
  return !namesAnotherNetworkRoot2(projectDir, file) && existsSync7(file);
4515
4657
  };
4516
- return html.replace(
4517
- /(<script\b[^>]*\bsrc=["'])([^"']*gsap[^"']*\/dist\/([^"']+))(["'][^>]*>)/gi,
4518
- (full, prefix, src, file, suffix) => {
4519
- if (/^https?:\/\//i.test(src)) return full;
4520
- if (exists(compSrcPath ? rewriteAssetPath(compSrcPath, src, exists) : src)) return full;
4521
- gsapDist ??= renderGsapDist();
4522
- defaultLogger.debug(`[Compiler] Rewriting missing gsap script: ${src} \u2192 ${gsapDist}${file}`);
4523
- return `${prefix}${gsapDist}${file}${suffix}`;
4524
- }
4525
- );
4658
+ return replaceGsapDistScripts(html, (full, prefix, src, file, suffix) => {
4659
+ if (/^https?:\/\//i.test(src)) return full;
4660
+ if (exists(compSrcPath ? rewriteAssetPath(compSrcPath, src, exists) : src)) return full;
4661
+ gsapDist ??= renderGsapDist();
4662
+ defaultLogger.debug(`[Compiler] Rewriting missing gsap script: ${src} \u2192 ${gsapDist}${file}`);
4663
+ return `${prefix}${gsapDist}${file}${suffix}`;
4664
+ });
4526
4665
  }
4527
4666
  function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath) {
4528
4667
  if (!isPathInside(htmlPath, projectDir)) return html;
@@ -4609,10 +4748,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
4609
4748
  options.variables ?? {},
4610
4749
  assetRoot
4611
4750
  );
4612
- const sanitizedHtml = inlinedHtml.replace(
4613
- /(<(?:video|audio)\b[^>]*?)\s+preload\s*=\s*["']none["']/gi,
4614
- "$1"
4615
- );
4751
+ const sanitizedHtml = stripPreloadNone(inlinedHtml);
4616
4752
  const renderModeHints = detectRenderModeHints(sanitizedHtml, options.pageMotionBlur);
4617
4753
  const hasShaderTransitions = detectShaderTransitionUsage(sanitizedHtml);
4618
4754
  const usesThreeDTransforms = detectThreeDTransformUsage(sanitizedHtml);
@@ -13448,40 +13584,56 @@ function validateIntDimension(field, value) {
13448
13584
  import { closeSync as closeSync5, openSync as openSync5, readdirSync as readdirSync10, readSync as readSync4, realpathSync as realpathSync2, statSync as statSync10 } from "node:fs";
13449
13585
  import { createHash as createHash9 } from "node:crypto";
13450
13586
  import { join as join34 } from "node:path";
13587
+ import { isPrivateFileUnder as isPrivateFileUnder3, isStudioPrivatePath as isStudioPrivatePath3 } from "@hyperframes/core/safe-path";
13451
13588
  var SITE_ID_SCHEME = "site-v2\0";
13452
13589
  var READ_CHUNK_BYTES = 256 * 1024;
13453
- var ENV_FILE = /^\.env([._-].*|rc)?$/i;
13454
- var leftOut = (rel, name) => rel === "" && PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(name) || ENV_FILE.test(name);
13455
- function listSiteFiles(projectDir) {
13590
+ var isPrivateSitePath = (relPath) => isStudioPrivatePath3(relPath);
13591
+ function statEntry(full, relPath) {
13592
+ try {
13593
+ return statSync10(full);
13594
+ } catch (err) {
13595
+ throw new Error(`[listSiteFiles] cannot read ${relPath} (dangling symlink?)`, { cause: err });
13596
+ }
13597
+ }
13598
+ function listSiteFiles(projectDir, onPrivate) {
13456
13599
  const files = [];
13457
13600
  const ancestors = /* @__PURE__ */ new Set([realpathSync2(projectDir)]);
13601
+ function visit(full, relPath) {
13602
+ if (isPrivateFileUnder3(projectDir, full, isStudioPrivatePath3)) return void onPrivate?.(relPath);
13603
+ const stat = statEntry(full, relPath);
13604
+ if (stat.isFile()) return void files.push(relPath);
13605
+ if (!stat.isDirectory()) return;
13606
+ const real = realpathSync2(full);
13607
+ if (ancestors.has(real)) return;
13608
+ ancestors.add(real);
13609
+ walk(full, relPath);
13610
+ ancestors.delete(real);
13611
+ }
13458
13612
  function walk(dir, rel) {
13459
13613
  for (const name of readdirSync10(dir).sort()) {
13460
- if (leftOut(rel, name)) continue;
13461
- const full = join34(dir, name);
13462
- const relPath = rel === "" ? name : `${rel}/${name}`;
13463
- let stat;
13464
- try {
13465
- stat = statSync10(full);
13466
- } catch (err) {
13467
- throw new Error(`[listSiteFiles] cannot read ${relPath} (dangling symlink?)`, {
13468
- cause: err
13469
- });
13470
- }
13471
- if (stat.isFile()) {
13472
- files.push(relPath);
13473
- } else if (stat.isDirectory()) {
13474
- const real = realpathSync2(full);
13475
- if (ancestors.has(real)) continue;
13476
- ancestors.add(real);
13477
- walk(full, relPath);
13478
- ancestors.delete(real);
13479
- }
13614
+ if (rel === "" && PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(name)) continue;
13615
+ visit(join34(dir, name), rel === "" ? name : `${rel}/${name}`);
13480
13616
  }
13481
13617
  }
13482
13618
  walk(projectDir, "");
13483
13619
  return files;
13484
13620
  }
13621
+ var printablePath = (path) => [...path].map((ch) => {
13622
+ const code = ch.charCodeAt(0);
13623
+ const control = code < 32 && code !== 9 || code >= 127 && code <= 159;
13624
+ return control ? `\\x${code.toString(16).padStart(2, "0")}` : ch;
13625
+ }).join("");
13626
+ function listSiteFilesForUpload(projectDir, onNotice) {
13627
+ const leftOut = [];
13628
+ const files = listSiteFiles(projectDir, (path) => leftOut.push(path));
13629
+ if (leftOut.length > 0) {
13630
+ const more = leftOut.length > 5 ? ` and ${leftOut.length - 5} more` : "";
13631
+ onNotice?.(
13632
+ `[deploySite] left out private files no composition loads (env, Git, credentials, tool state): ${leftOut.slice(0, 5).map(printablePath).join(", ")}${more}`
13633
+ );
13634
+ }
13635
+ return files;
13636
+ }
13485
13637
  function hashProjectDir(projectDir, files = listSiteFiles(projectDir)) {
13486
13638
  const hash = createHash9("sha256").update(SITE_ID_SCHEME);
13487
13639
  const chunk = Buffer.allocUnsafe(READ_CHUNK_BYTES);
@@ -13593,8 +13745,10 @@ export {
13593
13745
  hashProjectDir,
13594
13746
  isPlanAudioArtifactPath,
13595
13747
  isPlanV2DeferredSourceArtifact,
13748
+ isPrivateSitePath,
13596
13749
  listPlanV2ArtifactsForTarget,
13597
13750
  listSiteFiles,
13751
+ listSiteFilesForUpload,
13598
13752
  materializePlanV2Target,
13599
13753
  measurePlanDirBytes,
13600
13754
  muxChunkWithAudio,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "e9989f5a4b18bb0ae30ba9492234771124c21fc43876f62959ee41098d128b14",
4
+ "sha256": "b41b128e65eba9f85332f59b3a6597b8ef52f4375bed38cbd8f6d0fddc1a0bc1",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"