gscan 4.43.3 → 4.43.5

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.
@@ -3,7 +3,7 @@ const spec = require('../specs');
3
3
  const {versions, getPackageJSON} = require('../utils');
4
4
  const ASTLinter = require('../ast-linter');
5
5
 
6
- function processFileFunction(files, failures, rules) {
6
+ function processFileFunction(files, failures, rules, partialVerificationCache) {
7
7
  // This rule is needed to find partials
8
8
  // Partials are needed for a full parsing
9
9
  if (!rules['mark-used-partials']) {
@@ -16,6 +16,16 @@ function processFileFunction(files, failures, rules) {
16
16
  return;
17
17
  }
18
18
 
19
+ const fileName = themeFile.file;
20
+
21
+ // Check if the file is a partial
22
+ const isPartial = fileName.startsWith('partials/');
23
+
24
+ // Skip if already cached (for partials only)
25
+ if (isPartial && partialVerificationCache.has(fileName)) {
26
+ return;
27
+ }
28
+
19
29
  const astResults = linter.verify({
20
30
  parsed: themeFile.parsed,
21
31
  rules,
@@ -30,6 +40,11 @@ function processFileFunction(files, failures, rules) {
30
40
  });
31
41
  }
32
42
 
43
+ // Cache the result for this partial
44
+ if (isPartial) {
45
+ partialVerificationCache.set(fileName, astResults);
46
+ }
47
+
33
48
  linter.partials.forEach(({normalizedName}) => {
34
49
  const file = files.find(f => f.normalizedFile === `partials/${normalizedName}.hbs`);
35
50
  if (file) {
@@ -62,15 +77,16 @@ const checkTemplateSyntax = function checkTemplateSyntax(theme, options) {
62
77
  });
63
78
 
64
79
  _.each(rulesToCheck, function (check, ruleCode) {
80
+ const partialVerificationCache = new Map();
65
81
  const failures = [];
66
82
  const processFile = processFileFunction(
67
83
  theme.files,
68
84
  failures,
69
85
  {
70
86
  [ruleCode]: require(`../ast-linter/rules`)[ruleCode]
71
- }
87
+ },
88
+ partialVerificationCache
72
89
  );
73
-
74
90
  const linter = new ASTLinter({
75
91
  partials: theme.partials,
76
92
  inlinePartials: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gscan",
3
- "version": "4.43.3",
3
+ "version": "4.43.5",
4
4
  "description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
5
5
  "keywords": [
6
6
  "ghost",
@@ -49,7 +49,7 @@
49
49
  "@tryghost/debug": "^0.1.26",
50
50
  "@tryghost/errors": "^1.2.26",
51
51
  "@tryghost/logging": "^2.4.7",
52
- "@tryghost/nql": "^0.12.0",
52
+ "@tryghost/nql": "^0.12.5",
53
53
  "@tryghost/pretty-cli": "^1.2.38",
54
54
  "@tryghost/server": "^0.1.37",
55
55
  "@tryghost/zip": "^1.1.42",
@@ -77,7 +77,7 @@
77
77
  "nodemon": "2.0.7",
78
78
  "rewire": "6.0.0",
79
79
  "should": "13.2.3",
80
- "sinon": "18.0.0"
80
+ "sinon": "19.0.2"
81
81
  },
82
82
  "files": [
83
83
  "lib",