gscan 5.2.0 → 5.2.1

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.
@@ -7,9 +7,36 @@ module.exports = class MarkUsedCustomThemeSettings extends Rule {
7
7
  }
8
8
  }
9
9
 
10
+ // `get` helpers support using handlebars expressions in their filter attribute
11
+ // Handlebars does not parse these expressions within StringLiterals itself,
12
+ // so we need to manually check for them here.
13
+ _checkGetHelperAttributes(node) {
14
+ // Only check 'get' helpers
15
+ if (node.path && node.path.original !== 'get') {
16
+ return;
17
+ }
18
+
19
+ // Check hash parameters (named attributes like filter="...")
20
+ if (node.hash && node.hash.pairs) {
21
+ node.hash.pairs.forEach((pair) => {
22
+ // Only check the 'filter' attribute
23
+ if (pair.key === 'filter' && pair.value.type === 'StringLiteral') {
24
+ // Search for @custom.* references in the string value
25
+ const customThemeSettingRegex = /@custom\.([a-z0-9_]+)/g;
26
+ let match;
27
+ while ((match = customThemeSettingRegex.exec(pair.value.value)) !== null) {
28
+ this.scanner.context.customThemeSettings.push(match[1]);
29
+ }
30
+ }
31
+ });
32
+ }
33
+ }
34
+
10
35
  visitor() {
11
36
  return {
12
- PathExpression: this._markUsedCustomThemeSettings.bind(this)
37
+ PathExpression: this._markUsedCustomThemeSettings.bind(this),
38
+ SubExpression: this._checkGetHelperAttributes.bind(this),
39
+ BlockStatement: this._checkGetHelperAttributes.bind(this)
13
40
  };
14
41
  }
15
42
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gscan",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
5
5
  "keywords": [
6
6
  "ghost",
@@ -71,7 +71,7 @@
71
71
  "c8": "8.0.1",
72
72
  "eslint": "8.1.0",
73
73
  "eslint-plugin-ghost": "2.1.0",
74
- "mocha": "11.7.4",
74
+ "mocha": "11.7.5",
75
75
  "node-fetch": "3.3.2",
76
76
  "nodemon": "2.0.7",
77
77
  "rewire": "6.0.0",