@hyperframes/lint 0.8.7 → 0.8.9

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/browser.js CHANGED
@@ -3266,7 +3266,7 @@ var captionRules = [
3266
3266
  ];
3267
3267
 
3268
3268
  // src/rules/composition.ts
3269
- import { COMPOSITION_VARIABLE_TYPES } from "@hyperframes/parsers/composition";
3269
+ import { COMPOSITION_VARIABLE_TYPES, isSafeMediaUrl } from "@hyperframes/parsers/composition";
3270
3270
  import { COMPOSITION_ATTRIBUTES, readClipTiming } from "@hyperframes/parsers/composition-contract";
3271
3271
  var MAX_COMPOSITION_LINES = 300;
3272
3272
  var MAX_TIMED_ELEMENTS_PER_TRACK = 3;
@@ -3434,6 +3434,7 @@ var compositionRules = [
3434
3434
  const tagsByCompositionId = /* @__PURE__ */ new Map();
3435
3435
  for (const tag of tags) {
3436
3436
  if (isInsideInertTemplate(tag, tags)) continue;
3437
+ if (readAttr(tag.raw, "data-composition-src")) continue;
3437
3438
  const compositionId = readDecodedAttr(tag.raw, "data-composition-id");
3438
3439
  if (!compositionId || compositionId.trim().length === 0) continue;
3439
3440
  const matchingTags = tagsByCompositionId.get(compositionId) ?? [];
@@ -3836,6 +3837,11 @@ var compositionRules = [
3836
3837
  }
3837
3838
  const findings = [];
3838
3839
  const knownTypes = new Set(COMPOSITION_VARIABLE_TYPES);
3840
+ const varSrcIds = /* @__PURE__ */ new Set();
3841
+ for (const tag of tags) {
3842
+ const bound = readAttr(tag.raw, "data-var-src");
3843
+ if (bound) varSrcIds.add(bound);
3844
+ }
3839
3845
  for (let i = 0; i < parsed.length; i += 1) {
3840
3846
  const entry = parsed[i];
3841
3847
  if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
@@ -3860,6 +3866,17 @@ var compositionRules = [
3860
3866
  message: `data-composition-variables entry [${i}] is missing or has invalid: ${missing.join(", ")}. Type must be one of string, number, color, boolean, enum, font, image.`,
3861
3867
  snippet: truncateSnippet(htmlTag.raw)
3862
3868
  });
3869
+ continue;
3870
+ }
3871
+ const id = String(e.id);
3872
+ if ((e.type === "image" || varSrcIds.has(id)) && typeof e.default === "string" && e.default.length > 0 && !isSafeMediaUrl(e.default)) {
3873
+ findings.push({
3874
+ code: "unloadable_media_variable_default",
3875
+ severity: "error",
3876
+ message: `Variable "${id}" defaults to a URL the runtime will refuse to load, so any element bound to it renders its authored fallback src instead and the render still exits 0.`,
3877
+ fixHint: `Media URLs must be relative, http(s), blob:, or a data:image/* URI. Copy the file into the project and reference it relatively (e.g. "assets/bg.png") rather than by absolute path.`,
3878
+ snippet: truncateSnippet(htmlTag.raw)
3879
+ });
3863
3880
  }
3864
3881
  }
3865
3882
  return findings;