@reteps/tree-sitter-htmlmustache 0.0.22 → 0.0.24

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/cli/out/check.js +31 -6
  2. package/package.json +1 -1
package/cli/out/check.js CHANGED
@@ -139,9 +139,19 @@ function formatSummary(totalErrors, filesWithErrors, totalFiles) {
139
139
  // ── Glob expansion ──
140
140
  function expandGlobs(patterns) {
141
141
  const files = new Set();
142
+ const cwd = process.cwd();
142
143
  for (const pattern of patterns) {
143
- for (const match of node_fs_1.default.globSync(pattern)) {
144
- files.add(node_path_1.default.resolve(match));
144
+ // If the pattern is an exact file path, use it directly
145
+ if (!pattern.includes('*') && !pattern.includes('?')) {
146
+ const resolved = node_path_1.default.resolve(cwd, pattern);
147
+ if (node_fs_1.default.existsSync(resolved)) {
148
+ files.add(resolved);
149
+ }
150
+ }
151
+ else {
152
+ for (const match of node_fs_1.default.globSync(pattern, { cwd })) {
153
+ files.add(node_path_1.default.resolve(cwd, match));
154
+ }
145
155
  }
146
156
  }
147
157
  return [...files].sort();
@@ -171,24 +181,39 @@ function run(args) {
171
181
  }
172
182
  const files = expandGlobs(args);
173
183
  if (files.length === 0) {
174
- console.error(chalk_1.default.yellow('No files matched the given patterns.'));
184
+ console.error(chalk_1.default.yellow('No files matched the given patterns:'));
185
+ for (const arg of args) {
186
+ console.error(chalk_1.default.yellow(` ${arg}`));
187
+ }
175
188
  return 1;
176
189
  }
177
190
  const parser = loadParser();
178
191
  let totalErrors = 0;
179
192
  let filesWithErrors = 0;
193
+ const cwd = process.cwd();
194
+ const errorOutput = [];
180
195
  for (const file of files) {
196
+ const displayPath = node_path_1.default.relative(cwd, file) || file;
181
197
  const source = node_fs_1.default.readFileSync(file, 'utf-8');
182
198
  const tree = parser.parse(source);
183
- const errors = collectErrors(tree, file);
199
+ const errors = collectErrors(tree, displayPath);
184
200
  if (errors.length > 0) {
185
201
  filesWithErrors++;
186
202
  totalErrors += errors.length;
187
203
  for (const error of errors) {
188
- console.log(formatError(error, source));
189
- console.log();
204
+ errorOutput.push(formatError(error, source));
190
205
  }
191
206
  }
207
+ console.log(errors.length > 0
208
+ ? chalk_1.default.red(displayPath)
209
+ : chalk_1.default.dim(displayPath));
210
+ }
211
+ if (errorOutput.length > 0) {
212
+ console.log();
213
+ for (const output of errorOutput) {
214
+ console.log(output);
215
+ console.log();
216
+ }
192
217
  }
193
218
  console.log(formatSummary(totalErrors, filesWithErrors, files.length));
194
219
  return totalErrors > 0 ? 1 : 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reteps/tree-sitter-htmlmustache",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "HTML with Mustache/Handlebars template syntax grammar for tree-sitter",
5
5
  "repository": {
6
6
  "type": "git",