@hyperframes/lint 0.8.90 → 0.8.92

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 CHANGED
@@ -6158,6 +6158,7 @@ import {
6158
6158
  isUnresolvedAssetPlaceholder as isUnresolvedAssetPlaceholder2,
6159
6159
  isWithinProjectRoot,
6160
6160
  maskNonScannableRanges as maskNonScannableRanges2,
6161
+ readProjectFile,
6161
6162
  resolveExistingLocalAsset as resolveExistingLocalAsset2,
6162
6163
  resolveLocalAssetCandidates,
6163
6164
  resolveProjectRelativeSrc
@@ -6808,13 +6809,24 @@ function lintMissingOrEmptySubComposition(projectDir, rootHtml) {
6808
6809
  const filePath = resolve(projectDir, srcPath);
6809
6810
  if (visited.has(filePath)) continue;
6810
6811
  visited.add(filePath);
6811
- if (!existsSync2(filePath)) {
6812
+ const read = readProjectFile(filePath);
6813
+ if (read.kind === "missing") {
6812
6814
  if (!checked.has(srcPath)) {
6813
6815
  checked.set(srcPath, { srcPath, problem: "the file does not exist" });
6814
6816
  }
6815
6817
  continue;
6816
6818
  }
6817
- const fileHtml = readFileSync(filePath, "utf-8");
6819
+ if (read.kind === "folder") {
6820
+ if (!checked.has(srcPath)) {
6821
+ checked.set(srcPath, {
6822
+ srcPath,
6823
+ problem: "it is a folder, not an HTML file",
6824
+ folder: true
6825
+ });
6826
+ }
6827
+ continue;
6828
+ }
6829
+ const fileHtml = read.text;
6818
6830
  const validity = checkSubCompositionUsability(fileHtml, parseSubCompHtml);
6819
6831
  if (!validity.ok) {
6820
6832
  if (!checked.has(srcPath)) {
@@ -6830,12 +6842,12 @@ function lintMissingOrEmptySubComposition(projectDir, rootHtml) {
6830
6842
  };
6831
6843
  walk(rootHtml);
6832
6844
  const findings = [];
6833
- for (const { srcPath, problem } of checked.values()) {
6845
+ for (const { srcPath, problem, folder } of checked.values()) {
6834
6846
  findings.push({
6835
6847
  code: "missing_or_empty_sub_composition",
6836
6848
  severity: "error",
6837
6849
  message: `data-composition-src references "${srcPath}", but ${problem}.`,
6838
- fixHint: `Fix this before rendering \u2014 the render pre-flight rejects unusable sub-compositions. Write valid HTML into "${srcPath}" \u2014 it needs a <template> or <body> containing an element with data-composition-id, data-width, and data-height. Preview/studio still tolerates and skips the scene while you author it. If a scene-authoring step is still running, wait for it to finish before referencing the file, or re-run the step that generates it.`
6850
+ fixHint: folder ? `Point data-composition-src at the HTML file inside the folder, such as "${srcPath}/index.html".` : `Fix this before rendering \u2014 the render pre-flight rejects unusable sub-compositions. Write valid HTML into "${srcPath}" \u2014 it needs a <template> or <body> containing an element with data-composition-id, data-width, and data-height. Preview/studio still tolerates and skips the scene while you author it. If a scene-authoring step is still running, wait for it to finish before referencing the file, or re-run the step that generates it.`
6839
6851
  });
6840
6852
  }
6841
6853
  return findings;