@hyperframes/lint 0.8.206 → 0.8.207

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 +20 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7066,6 +7066,7 @@ import {
7066
7066
  resolveLocalAssetCandidates,
7067
7067
  resolveProjectRelativeSrc
7068
7068
  } from "@hyperframes/parsers/asset-resolution";
7069
+ import { encodeUrlPath } from "@hyperframes/parsers";
7069
7070
 
7070
7071
  // src/hevcPreviewLint.ts
7071
7072
  import { execFile } from "child_process";
@@ -7591,10 +7592,18 @@ function lintProjectAudioFiles(projectDir, htmlSources) {
7591
7592
  }
7592
7593
  return findings;
7593
7594
  }
7595
+ function urlSafeSrcOf(projectDir, rootRelative) {
7596
+ if (!/[?#]/.test(rootRelative)) return null;
7597
+ const literal = resolve(projectDir, rootRelative.replace(/^\//, ""));
7598
+ if (!existsSync2(literal)) return null;
7599
+ return encodeUrlPath(rootRelative);
7600
+ }
7601
+ var urlSafeHint = (safe) => `The file exists, but a "#" or "?" in a src ends the file name there. Write the src as "${safe}".`;
7594
7602
  function lintAudioSrcNotFound(projectDir, htmlSources) {
7595
7603
  const findings = [];
7596
7604
  const audioSrcRe = mediaSrcTagRe("audio");
7597
7605
  const missingByFile = /* @__PURE__ */ new Map();
7606
+ const urlSafe = /* @__PURE__ */ new Map();
7598
7607
  for (const { html, compSrcPath } of htmlSources) {
7599
7608
  const scannable = maskNonScannableRanges2(html);
7600
7609
  let match;
@@ -7604,6 +7613,8 @@ function lintAudioSrcNotFound(projectDir, htmlSources) {
7604
7613
  if (isUnresolvedAssetPlaceholder2(src)) continue;
7605
7614
  const rootRelative = compSrcPath ? rewriteAssetPath2(compSrcPath, src, (path) => existsSync2(join3(projectDir, path))) : src;
7606
7615
  if (!existsSync2(resolveProjectRelativeSrc(rootRelative, projectDir))) {
7616
+ const safe = urlSafeSrcOf(projectDir, rootRelative);
7617
+ if (safe) urlSafe.set(src, safe);
7607
7618
  const file = sourceFile(projectDir, compSrcPath);
7608
7619
  missingByFile.set(file, (missingByFile.get(file) ?? /* @__PURE__ */ new Set()).add(src));
7609
7620
  }
@@ -7616,7 +7627,7 @@ function lintAudioSrcNotFound(projectDir, htmlSources) {
7616
7627
  severity: "error",
7617
7628
  file,
7618
7629
  message: `<audio> element references file(s) not found in the project: ${unique.join(", ")}. The rendered video will be silent.`,
7619
- fixHint: unique.length === 1 ? `Add the file "${unique[0]}" to the project directory, or update the src attribute to point to an existing file.` : `Add the missing files to the project directory, or update the src attributes to point to existing files.`
7630
+ fixHint: unique.length === 1 && urlSafe.has(unique[0]) ? urlSafeHint(urlSafe.get(unique[0])) : unique.length === 1 ? `Add the file "${unique[0]}" to the project directory, or update the src attribute to point to an existing file.` : `Add the missing files to the project directory, or update the src attributes to point to existing files.`
7620
7631
  });
7621
7632
  }
7622
7633
  return findings;
@@ -7625,6 +7636,7 @@ function lintMissingLocalAsset(projectDir, htmlSources) {
7625
7636
  const findings = [];
7626
7637
  const localAssetSrcRe = mediaSrcTagRe("video|img|source");
7627
7638
  const missingByTag = /* @__PURE__ */ new Map();
7639
+ const urlSafe = /* @__PURE__ */ new Map();
7628
7640
  for (const { html, compSrcPath } of htmlSources) {
7629
7641
  const scannable = maskNonScannableRanges2(html);
7630
7642
  const re = new RegExp(localAssetSrcRe.source, localAssetSrcRe.flags);
@@ -7639,6 +7651,12 @@ function lintMissingLocalAsset(projectDir, htmlSources) {
7639
7651
  const rootRelative = compSrcPath ? rewriteAssetPath2(compSrcPath, src, (path) => existsSync2(join3(projectDir, path))) : src;
7640
7652
  const resolvedAsset = resolveExistingLocalAsset3(projectDir, rootRelative);
7641
7653
  if (resolvedAsset) continue;
7654
+ const rawRoot = rawSrc.trim();
7655
+ const safe = urlSafeSrcOf(
7656
+ projectDir,
7657
+ compSrcPath ? rewriteAssetPath2(compSrcPath, rawRoot, (path) => existsSync2(join3(projectDir, path))) : rawRoot
7658
+ );
7659
+ if (safe) urlSafe.set(src, safe);
7642
7660
  const resolvedKey = resolve(projectDir, rootRelative);
7643
7661
  const file = sourceFile(projectDir, compSrcPath);
7644
7662
  const bucketKey = `${file}\0${tagName}`;
@@ -7657,7 +7675,7 @@ function lintMissingLocalAsset(projectDir, htmlSources) {
7657
7675
  severity: "error",
7658
7676
  file,
7659
7677
  message: `<${tagName}> element references local file(s) not found in the project: ${unique.join(", ")}. The renderer will silently skip these and produce a video with missing visuals.`,
7660
- fixHint: unique.length === 1 ? `Add "${unique[0]}" to the project directory, or update the src attribute to point to an existing file. Common cause: captured asset filenames are unreliable (heygen-logo.svg often contains Google, nvidia-logo.svg may contain Autodesk, etc.). Open the contact sheets and verify the file actually exists at this path before referencing it.` : "Add the missing files to the project directory, or update the src attributes to point to existing files. Captured asset filenames are unreliable. Verify against capture/contact-sheets/ and capture/extracted/asset-descriptions.md."
7678
+ fixHint: unique.length === 1 && urlSafe.has(unique[0]) ? urlSafeHint(urlSafe.get(unique[0])) : unique.length === 1 ? `Add "${unique[0]}" to the project directory, or update the src attribute to point to an existing file. Common cause: captured asset filenames are unreliable (heygen-logo.svg often contains Google, nvidia-logo.svg may contain Autodesk, etc.). Open the contact sheets and verify the file actually exists at this path before referencing it.` : "Add the missing files to the project directory, or update the src attributes to point to existing files. Captured asset filenames are unreliable. Verify against capture/contact-sheets/ and capture/extracted/asset-descriptions.md."
7661
7679
  });
7662
7680
  }
7663
7681
  return findings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/lint",
3
- "version": "0.8.206",
3
+ "version": "0.8.207",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -35,7 +35,7 @@
35
35
  "linkedom": "^0.18.12",
36
36
  "postcss": "^8.5.8",
37
37
  "postcss-selector-parser": "^7.1.4",
38
- "@hyperframes/parsers": "0.8.206"
38
+ "@hyperframes/parsers": "0.8.207"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^25.0.10",