@hyperframes/lint 0.8.197 → 0.8.199

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
@@ -3208,11 +3208,14 @@ function declaredIdsForBindingCheck(tags) {
3208
3208
  if (declared.size === 0 && !findHtmlTag(tags)) return null;
3209
3209
  return declared;
3210
3210
  }
3211
- function isInsideInertTemplate(tag, tags) {
3211
+ function isInsideTag(tag, tags, name) {
3212
3212
  return tags.some(
3213
- (candidate) => candidate.name === "template" && candidate.closeIndex != null && tag.index > candidate.index && tag.index < candidate.closeIndex
3213
+ (candidate) => candidate.name === name && candidate.closeIndex != null && tag.index > candidate.index && tag.index < candidate.closeIndex
3214
3214
  );
3215
3215
  }
3216
+ function isInsideInertTemplate(tag, tags) {
3217
+ return isInsideTag(tag, tags, "template");
3218
+ }
3216
3219
  var NEGATIVE_Z_INDEX = /(?<![\w-])z-index\s*:\s*-(?!0(?:\s*[;}]|\s*$))([\d.]+)/g;
3217
3220
  function cssOwnerSelector(content, matchIndex) {
3218
3221
  const blockStart = content.lastIndexOf("{", matchIndex);
@@ -3810,6 +3813,26 @@ var compositionRules = [
3810
3813
  }
3811
3814
  ];
3812
3815
  },
3816
+ // subcomposition_style_outside_template
3817
+ // Mounting keeps only the <template> content and the <head> stylesheet links.
3818
+ ({ rawSource, options }) => {
3819
+ if (!options.isSubComposition) return [];
3820
+ const { tags } = parseHtmlStructure(stripHtmlComments(rawSource));
3821
+ if (!tags.some((tag) => tag.name === "template")) return [];
3822
+ const dropped = tags.filter((tag) => {
3823
+ if (isInsideInertTemplate(tag, tags)) return false;
3824
+ if (tag.name === "style") return true;
3825
+ const rel = (readAttr(tag.raw, "rel") || "").toLowerCase().split(/\s+/);
3826
+ return tag.name === "link" && rel.includes("stylesheet") && !isInsideTag(tag, tags, "head");
3827
+ });
3828
+ return dropped.map((tag) => ({
3829
+ code: "subcomposition_style_outside_template",
3830
+ severity: "warning",
3831
+ message: `<${tag.name}> sits outside this sub-composition's <template>. Mounting keeps only the template's content, so these styles never apply in preview, snapshot or render.`,
3832
+ fixHint: "Move it inside <template>, next to the composition root.",
3833
+ snippet: truncateSnippet(tag.raw)
3834
+ }));
3835
+ },
3813
3836
  // root_composition_missing_duration_source
3814
3837
  //
3815
3838
  // The render engine (packages/engine/src/services/frameCapture.ts) needs a
package/dist/index.js CHANGED
@@ -3214,11 +3214,14 @@ function declaredIdsForBindingCheck(tags) {
3214
3214
  if (declared.size === 0 && !findHtmlTag(tags)) return null;
3215
3215
  return declared;
3216
3216
  }
3217
- function isInsideInertTemplate(tag, tags) {
3217
+ function isInsideTag(tag, tags, name) {
3218
3218
  return tags.some(
3219
- (candidate) => candidate.name === "template" && candidate.closeIndex != null && tag.index > candidate.index && tag.index < candidate.closeIndex
3219
+ (candidate) => candidate.name === name && candidate.closeIndex != null && tag.index > candidate.index && tag.index < candidate.closeIndex
3220
3220
  );
3221
3221
  }
3222
+ function isInsideInertTemplate(tag, tags) {
3223
+ return isInsideTag(tag, tags, "template");
3224
+ }
3222
3225
  var NEGATIVE_Z_INDEX = /(?<![\w-])z-index\s*:\s*-(?!0(?:\s*[;}]|\s*$))([\d.]+)/g;
3223
3226
  function cssOwnerSelector(content, matchIndex) {
3224
3227
  const blockStart = content.lastIndexOf("{", matchIndex);
@@ -3816,6 +3819,26 @@ var compositionRules = [
3816
3819
  }
3817
3820
  ];
3818
3821
  },
3822
+ // subcomposition_style_outside_template
3823
+ // Mounting keeps only the <template> content and the <head> stylesheet links.
3824
+ ({ rawSource, options }) => {
3825
+ if (!options.isSubComposition) return [];
3826
+ const { tags } = parseHtmlStructure(stripHtmlComments(rawSource));
3827
+ if (!tags.some((tag) => tag.name === "template")) return [];
3828
+ const dropped = tags.filter((tag) => {
3829
+ if (isInsideInertTemplate(tag, tags)) return false;
3830
+ if (tag.name === "style") return true;
3831
+ const rel = (readAttr(tag.raw, "rel") || "").toLowerCase().split(/\s+/);
3832
+ return tag.name === "link" && rel.includes("stylesheet") && !isInsideTag(tag, tags, "head");
3833
+ });
3834
+ return dropped.map((tag) => ({
3835
+ code: "subcomposition_style_outside_template",
3836
+ severity: "warning",
3837
+ message: `<${tag.name}> sits outside this sub-composition's <template>. Mounting keeps only the template's content, so these styles never apply in preview, snapshot or render.`,
3838
+ fixHint: "Move it inside <template>, next to the composition root.",
3839
+ snippet: truncateSnippet(tag.raw)
3840
+ }));
3841
+ },
3819
3842
  // root_composition_missing_duration_source
3820
3843
  //
3821
3844
  // The render engine (packages/engine/src/services/frameCapture.ts) needs a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/lint",
3
- "version": "0.8.197",
3
+ "version": "0.8.199",
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.197"
38
+ "@hyperframes/parsers": "0.8.199"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^25.0.10",