gbu-accessibility-package 3.8.2 → 3.8.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.
package/README-vi.md CHANGED
@@ -175,6 +175,7 @@ Tùy chọn Enhanced Alt:
175
175
 
176
176
  Trợ giúp:
177
177
  -h, --help Hiển thị thông điệp trợ giúp
178
+ -v, --version Hiển thị số phiên bản
178
179
  ```
179
180
 
180
181
  ### Ví dụ
@@ -361,6 +362,7 @@ await fixer.checkFileSizes('./src');
361
362
  ### Tối ưu hóa dự án
362
363
 
363
364
  - **File không sử dụng** → Phát hiện file không được tham chiếu ở đâu trong toàn bộ dự án
365
+ - **File types được kiểm tra**: Hình ảnh, CSS, JavaScript, JSX, TypeScript, Vue, PHP, JSON, Markdown, XML, PDF, Video, Audio files (không bao gồm HTML)
364
366
  - **Quét toàn diện**: Phân tích từ project root, không giới hạn thư mục hiện tại
365
367
  - **Cross-reference detection**: Tìm tham chiếu từ HTML, CSS, JavaScript, JSON, và các file khác
366
368
  - **Multiple path formats**: Hỗ trợ relative paths, absolute paths, imports, requires
package/README.md CHANGED
@@ -170,6 +170,7 @@ Enhanced Alt Options:
170
170
 
171
171
  Help:
172
172
  -h, --help Show help message
173
+ -v, --version Show version number
173
174
  ```
174
175
 
175
176
  ### Examples
@@ -348,7 +349,7 @@ await fixer.checkFileSizes('./src');
348
349
 
349
350
  ### Project Optimization
350
351
  - **Unused Files** → Detect files not referenced anywhere in the project
351
- - Images, CSS, JavaScript, HTML files
352
+ - Images, CSS, JavaScript, JSX, TypeScript, Vue, PHP, JSON, Markdown, XML, PDF, Video, Audio files
352
353
  - Local file references analysis
353
354
  - Heuristic detection with manual review recommendations
354
355
  - **Dead Code Analysis** → Find unused CSS rules and JavaScript functions
package/cli.js CHANGED
@@ -17,6 +17,7 @@ const options = {
17
17
  backupFiles: false, // Default to false for faster processing
18
18
  dryRun: false,
19
19
  help: false,
20
+ version: false,
20
21
  cleanupOnly: false,
21
22
  comprehensive: false, // Keep for backward compatibility
22
23
  altOnly: false,
@@ -52,6 +53,10 @@ for (let i = 0; i < args.length; i++) {
52
53
  case '-h':
53
54
  options.help = true;
54
55
  break;
56
+ case '--version':
57
+ case '-v':
58
+ options.version = true;
59
+ break;
55
60
  case '--directory':
56
61
  case '-d':
57
62
  options.directory = args[++i];
@@ -155,6 +160,12 @@ for (let i = 0; i < args.length; i++) {
155
160
  }
156
161
 
157
162
  // Show help
163
+ if (options.version) {
164
+ const packageJson = require('./package.json');
165
+ console.log(chalk.blue(`🔧 GBU Accessibility Package v${packageJson.version}`));
166
+ process.exit(0);
167
+ }
168
+
158
169
  if (options.help) {
159
170
  console.log(chalk.blue(`
160
171
  🔧 Accessibility Fixer CLI
@@ -189,6 +200,7 @@ Options:
189
200
  --include-emotions Include emotional descriptors in alt text
190
201
  --strict-alt Enable strict alt attribute quality checking
191
202
  -h, --help Show this help message
203
+ -v, --version Show version number
192
204
 
193
205
  Enhanced Alt Features:
194
206
  --enhanced-alt Comprehensive alt attribute analysis with:
package/lib/fixer.js CHANGED
@@ -5659,16 +5659,16 @@ class AccessibilityFixer {
5659
5659
 
5660
5660
  const startTime = Date.now();
5661
5661
 
5662
- // Find project root for comprehensive scanning
5663
- const projectRoot = this.findProjectRoot(directory);
5664
- console.log(chalk.gray(`📁 Project root: ${path.relative(process.cwd(), projectRoot) || '.'}`));
5662
+ // Determine scan directory - use specified directory or project root for comprehensive scanning
5663
+ const scanDirectory = path.resolve(directory);
5664
+ console.log(chalk.gray(`📁 Scanning directory: ${path.relative(process.cwd(), scanDirectory) || '.'}`));
5665
5665
 
5666
- // Get all project files from root (comprehensive scan)
5667
- const allFiles = await this.findAllProjectFiles(projectRoot);
5668
- console.log(chalk.gray(`📊 Found ${allFiles.length} total files in project`));
5666
+ // Get all project files from scan directory
5667
+ const allFiles = await this.findAllProjectFiles(scanDirectory);
5668
+ console.log(chalk.gray(`📊 Found ${allFiles.length} total files in scan area`));
5669
5669
 
5670
- // Get referenced files from entire project (not just target directory)
5671
- const referencedFiles = await this.findReferencedFiles(projectRoot);
5670
+ // Get referenced files from scan directory
5671
+ const referencedFiles = await this.findReferencedFiles(scanDirectory);
5672
5672
  console.log(chalk.gray(`🔍 Found ${referencedFiles.size} referenced files`));
5673
5673
 
5674
5674
  // Find unused files
@@ -5680,9 +5680,9 @@ class AccessibilityFixer {
5680
5680
  continue;
5681
5681
  }
5682
5682
 
5683
- // Check if file is referenced anywhere in the project
5684
- const relativePath = path.relative(projectRoot, file);
5685
- const isReferenced = this.isFileReferenced(file, relativePath, referencedFiles, projectRoot);
5683
+ // Check if file is referenced anywhere in the scan area
5684
+ const relativePath = path.relative(scanDirectory, file);
5685
+ const isReferenced = this.isFileReferenced(file, relativePath, referencedFiles, scanDirectory);
5686
5686
 
5687
5687
  if (!isReferenced) {
5688
5688
  const stats = await require('fs').promises.stat(file);
@@ -5768,9 +5768,10 @@ class AccessibilityFixer {
5768
5768
 
5769
5769
  async findAllProjectFiles(directory) {
5770
5770
  const files = [];
5771
- const extensions = ['.html', '.css', '.js', '.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp', '.ico', '.pdf', '.mp4', '.webm', '.mp3', '.wav'];
5771
+ // Check all relevant file types except HTML files
5772
+ const extensions = ['.css', '.js', '.jsx', '.ts', '.tsx', '.vue', '.php', '.json', '.md', '.xml', '.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp', '.ico', '.pdf', '.mp4', '.webm', '.mp3', '.wav'];
5772
5773
 
5773
- async function scan(dir) {
5774
+ const scan = async (dir) => {
5774
5775
  try {
5775
5776
  const entries = await fs.readdir(dir, { withFileTypes: true });
5776
5777
 
@@ -5791,10 +5792,11 @@ class AccessibilityFixer {
5791
5792
  }
5792
5793
  } catch (error) {
5793
5794
  // Skip directories we can't read
5795
+ console.log(chalk.gray(`⚠️ Skipping directory ${dir}: ${error.message}`));
5794
5796
  }
5795
- }
5797
+ };
5796
5798
 
5797
- await scan.call(this, directory);
5799
+ await scan(directory);
5798
5800
  return files;
5799
5801
  }
5800
5802
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gbu-accessibility-package",
3
- "version": "3.8.2",
3
+ "version": "3.8.5",
4
4
  "description": "Comprehensive accessibility fixes and project optimization for HTML files. Smart context-aware alt text generation, form labels, button names, link names, landmarks, heading analysis, WCAG-compliant role attributes, unused files detection, dead code analysis, broken external links detection, and missing local resources detection. Covers major axe DevTools issues with individual fix modes.",
5
5
  "main": "index.js",
6
6
  "bin": {