@hyperframes/lint 0.8.150 → 0.8.151

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 +8 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -6736,6 +6736,9 @@ var MASK_IMAGE_URL_RE = /\b(?:-webkit-)?mask-image\s*:\s*[^;{}]*url\(\s*(?:"([^"
6736
6736
  function isLocalStylesheetHref(href) {
6737
6737
  return !!href && !/^(https?:|data:|blob:|\/\/)/i.test(href);
6738
6738
  }
6739
+ function staysInsideProjectRoot(href) {
6740
+ return !href.startsWith("/") && !href.split("/").includes("..");
6741
+ }
6739
6742
  function collectLocalStylesheets(projectDir, document, compSrcPath) {
6740
6743
  const styles = [];
6741
6744
  for (const link of querySelectorAllIncludingTemplates(document, "link")) {
@@ -6743,14 +6746,12 @@ function collectLocalStylesheets(projectDir, document, compSrcPath) {
6743
6746
  if (!rel.split(/\s+/).some((part) => part.toLowerCase() === "stylesheet")) continue;
6744
6747
  const href = link.getAttribute("href") ?? "";
6745
6748
  if (!isLocalStylesheetHref(href)) continue;
6746
- const rootRelative = compSrcPath ? join2(dirname(compSrcPath), href) : href;
6747
- const stylesheet = resolveExistingLocalAsset2(projectDir, rootRelative);
6749
+ const besideFile = compSrcPath ? join2(dirname(compSrcPath), href) : href;
6750
+ const stylesheet = resolveExistingLocalAsset2(projectDir, besideFile) ?? (compSrcPath && staysInsideProjectRoot(href) ? resolveExistingLocalAsset2(projectDir, href) : null);
6748
6751
  if (!stylesheet) continue;
6749
- styles.push({
6750
- href,
6751
- content: readFileSync(stylesheet.resolved, "utf-8"),
6752
- rootRelativePath: stylesheet.rootRelativePath
6753
- });
6752
+ const read = readProjectFile(stylesheet.resolved);
6753
+ if (read.kind !== "file") continue;
6754
+ styles.push({ href, content: read.text, rootRelativePath: stylesheet.rootRelativePath });
6754
6755
  }
6755
6756
  return styles;
6756
6757
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/lint",
3
- "version": "0.8.150",
3
+ "version": "0.8.151",
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.150"
38
+ "@hyperframes/parsers": "0.8.151"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^25.0.10",