gbu-accessibility-package 3.2.0 → 3.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.
- package/CHANGELOG.md +20 -0
- package/README-vi.md +45 -28
- package/README.md +21 -15
- package/cli.js +21 -1
- package/demo/broken-links-test.html +41 -0
- package/index.js +1 -2
- package/lib/fixer.js +1436 -5
- package/package.json +5 -4
- package/lib/enhanced-alt-checker.js +0 -632
- package/lib/enhanced-alt-generator.js +0 -741
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.2.0] - 2024-07-28
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Enhanced Alt Attribute Integration**: Tích hợp hoàn toàn EnhancedAltChecker và EnhancedAltGenerator vào AccessibilityFixer
|
|
12
|
+
- **Broken Links Detection**: Tính năng phát hiện liên kết bị hỏng và tài nguyên 404
|
|
13
|
+
- **Clean Architecture**: Tất cả tính năng enhanced được tích hợp trong một file duy nhất
|
|
14
|
+
- **Improved Performance**: Giảm overhead từ việc import nhiều module riêng biệt
|
|
15
|
+
- **Simplified API**: Không cần import các class enhanced riêng biệt
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **BREAKING**: EnhancedAltChecker và EnhancedAltGenerator không còn là class riêng biệt
|
|
19
|
+
- **Integrated Features**: Tất cả tính năng enhanced alt đã được tích hợp vào AccessibilityFixer
|
|
20
|
+
- **Cleaner Codebase**: Loại bỏ các file enhanced riêng lẻ để có kiến trúc gọn gàng hơn
|
|
21
|
+
- **Updated Documentation**: README và README-vi được cập nhật để phản ánh kiến trúc mới
|
|
22
|
+
|
|
23
|
+
### Migration Guide
|
|
24
|
+
- **For most users**: Không cần thay đổi gì - tất cả tính năng vẫn hoạt động như cũ
|
|
25
|
+
- **For programmatic usage**: Chỉ cần import AccessibilityFixer, không cần import EnhancedAltChecker/Generator riêng
|
|
26
|
+
- **Enhanced features**: Vẫn có sẵn thông qua các config options trong AccessibilityFixer
|
|
27
|
+
|
|
8
28
|
## [3.1.0] - 2024-07-25
|
|
9
29
|
|
|
10
30
|
### Changed
|
package/README-vi.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
## ✨ Tính năng
|
|
10
10
|
|
|
11
11
|
### 🎯 **Sửa lỗi Accessibility cơ bản**
|
|
12
|
+
|
|
12
13
|
- 🖼️ **Tạo Alt Text thông minh** - Alt attributes nhận biết ngữ cảnh cho hình ảnh
|
|
13
14
|
- 🏷️ **Hỗ trợ Aria Label** - Tự động tạo aria-label phù hợp với alt text
|
|
14
15
|
- 🌐 **HTML Lang Attributes** - Tự động sửa thuộc tính ngôn ngữ
|
|
@@ -18,17 +19,21 @@
|
|
|
18
19
|
- 🔗 **Link Names** - Sửa links rỗng và phát hiện text generic
|
|
19
20
|
- 🏛️ **Landmarks** - Thêm main và navigation landmarks thiếu
|
|
20
21
|
- 📑 **Phân tích Heading** - Phân tích cấu trúc heading với gợi ý (không tự động sửa)
|
|
22
|
+
- 🔍 **Broken Links Detection** - Phát hiện liên kết bị hỏng và tài nguyên 404
|
|
21
23
|
- 🧹 **Dọn dẹp Duplicate** - Loại bỏ role attributes trùng lặp
|
|
22
24
|
|
|
23
|
-
### 🚀 **Tính năng Enhanced Alt Attribute (
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
25
|
+
### 🚀 **Tính năng Enhanced Alt Attribute (Đã tích hợp!)**
|
|
26
|
+
|
|
27
|
+
- 🔍 **Phân tích toàn diện** - Phân loại loại hình ảnh và kiểm tra chất lượng tích hợp sẵn
|
|
28
|
+
- 🎨 **Tạo Alt đa dạng** - Nhiều chiến lược cho alt text sáng tạo được tích hợp trong core
|
|
29
|
+
- 🌐 **Hỗ trợ đa ngôn ngữ** - Từ vựng tiếng Nhật, Anh, Việt tích hợp sẵn
|
|
27
30
|
- 🎭 **Mức độ sáng tạo** - Chế độ Conservative, Balanced, Creative
|
|
28
31
|
- 🧠 **Nhận biết ngữ cảnh** - Tích hợp ngữ cảnh thương hiệu, cảm xúc, kỹ thuật
|
|
29
32
|
- 📊 **Trực quan hóa dữ liệu** - Mô tả chuyên biệt cho biểu đồ và đồ thị
|
|
33
|
+
- 🧹 **Kiến trúc gọn gàng** - Tất cả tính năng enhanced được tích hợp trong một file duy nhất
|
|
30
34
|
|
|
31
35
|
### 🛠️ **Tính năng tiện ích**
|
|
36
|
+
|
|
32
37
|
- 📁 **Xử lý hàng loạt** - Xử lý toàn bộ thư mục đệ quy
|
|
33
38
|
- 💾 **Backup tùy chọn** - Tạo file backup khi cần với flag --backup
|
|
34
39
|
- 🔍 **Chế độ Dry Run** - Xem trước thay đổi trước khi áp dụng
|
|
@@ -103,6 +108,7 @@ Chế độ sửa lỗi:
|
|
|
103
108
|
--links-only Sửa link names + dọn dẹp
|
|
104
109
|
--landmarks-only Sửa landmarks + dọn dẹp
|
|
105
110
|
--headings-only Phân tích cấu trúc heading (không tự động sửa)
|
|
111
|
+
--links-check Kiểm tra liên kết bị hỏng và tài nguyên 404
|
|
106
112
|
--cleanup-only Chỉ dọn dẹp role attributes trùng lặp
|
|
107
113
|
|
|
108
114
|
Tùy chọn Enhanced Alt:
|
|
@@ -131,6 +137,7 @@ gbu-a11y -l en ./public
|
|
|
131
137
|
gbu-a11y --alt-only # Sửa alt attributes + dọn dẹp
|
|
132
138
|
gbu-a11y --forms-only # Sửa form labels + dọn dẹp
|
|
133
139
|
gbu-a11y --buttons-only # Sửa button names + dọn dẹp
|
|
140
|
+
gbu-a11y --links-check # Kiểm tra liên kết bị hỏng + dọn dẹp
|
|
134
141
|
|
|
135
142
|
# Tính năng enhanced alt attribute
|
|
136
143
|
gbu-a11y --enhanced-alt # Chế độ enhanced cơ bản
|
|
@@ -149,6 +156,7 @@ gbu-a11y --enhanced-alt --dry-run # Xem trước sửa
|
|
|
149
156
|
### Mức độ sáng tạo
|
|
150
157
|
|
|
151
158
|
#### Conservative (Bảo thủ)
|
|
159
|
+
|
|
152
160
|
- Mô tả đơn giản, thực tế
|
|
153
161
|
- Tập trung vào chức năng cơ bản
|
|
154
162
|
- Biến thể từ vựng tối thiểu
|
|
@@ -156,6 +164,7 @@ gbu-a11y --enhanced-alt --dry-run # Xem trước sửa
|
|
|
156
164
|
**Ví dụ**: `alt="Biểu đồ"`, `alt="Logo"`
|
|
157
165
|
|
|
158
166
|
#### Balanced (Cân bằng - Mặc định)
|
|
167
|
+
|
|
159
168
|
- Mô tả nhận biết ngữ cảnh
|
|
160
169
|
- Sáng tạo vừa phải
|
|
161
170
|
- Cân bằng giữa đơn giản và chi tiết
|
|
@@ -163,6 +172,7 @@ gbu-a11y --enhanced-alt --dry-run # Xem trước sửa
|
|
|
163
172
|
**Ví dụ**: `alt="Biểu đồ hiệu suất bán hàng"`, `alt="Logo công ty"`
|
|
164
173
|
|
|
165
174
|
#### Creative (Sáng tạo)
|
|
175
|
+
|
|
166
176
|
- Mô tả phong phú, chi tiết
|
|
167
177
|
- Tích hợp ngữ cảnh cảm xúc
|
|
168
178
|
- Nhận biết thương hiệu và ngữ cảnh cao
|
|
@@ -189,54 +199,51 @@ gbu-a11y --enhanced-alt --dry-run # Xem trước sửa
|
|
|
189
199
|
### Sử dụng cơ bản
|
|
190
200
|
|
|
191
201
|
```javascript
|
|
192
|
-
const { AccessibilityFixer } = require(
|
|
202
|
+
const { AccessibilityFixer } = require("gbu-accessibility-package");
|
|
193
203
|
|
|
194
204
|
const fixer = new AccessibilityFixer({
|
|
195
|
-
language:
|
|
205
|
+
language: "vi",
|
|
196
206
|
backupFiles: true,
|
|
197
|
-
dryRun: false
|
|
207
|
+
dryRun: false,
|
|
198
208
|
});
|
|
199
209
|
|
|
200
210
|
// Sửa tất cả vấn đề accessibility
|
|
201
|
-
fixer.fixAllAccessibilityIssues(
|
|
202
|
-
console.log(
|
|
211
|
+
fixer.fixAllAccessibilityIssues("./src").then((results) => {
|
|
212
|
+
console.log("Hoàn thành sửa lỗi accessibility:", results);
|
|
203
213
|
});
|
|
204
214
|
|
|
205
215
|
// Sửa các vấn đề cụ thể
|
|
206
|
-
await fixer.fixEmptyAltAttributes(
|
|
207
|
-
await fixer.fixFormLabels(
|
|
208
|
-
await fixer.fixButtonNames(
|
|
216
|
+
await fixer.fixEmptyAltAttributes("./src");
|
|
217
|
+
await fixer.fixFormLabels("./src");
|
|
218
|
+
await fixer.fixButtonNames("./src");
|
|
209
219
|
```
|
|
210
220
|
|
|
211
|
-
### Chế độ Enhanced Alt Attribute
|
|
221
|
+
### Chế độ Enhanced Alt Attribute (Tích hợp sẵn)
|
|
212
222
|
|
|
213
223
|
```javascript
|
|
214
|
-
const { AccessibilityFixer
|
|
224
|
+
const { AccessibilityFixer } = require("gbu-accessibility-package");
|
|
215
225
|
|
|
216
|
-
// Sử dụng AccessibilityFixer với chế độ enhanced
|
|
226
|
+
// Sử dụng AccessibilityFixer với chế độ enhanced (tích hợp sẵn)
|
|
217
227
|
const fixer = new AccessibilityFixer({
|
|
218
|
-
language:
|
|
228
|
+
language: "vi",
|
|
219
229
|
enhancedAltMode: true,
|
|
220
|
-
altCreativity:
|
|
230
|
+
altCreativity: "creative",
|
|
221
231
|
includeEmotions: true,
|
|
222
|
-
strictAltChecking: true
|
|
232
|
+
strictAltChecking: true,
|
|
223
233
|
});
|
|
224
234
|
|
|
225
|
-
await fixer.fixEmptyAltAttributes(
|
|
235
|
+
await fixer.fixEmptyAltAttributes("./src");
|
|
226
236
|
|
|
227
|
-
//
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
const issues = checker.analyzeAltAttributes(htmlContent);
|
|
234
|
-
console.log('Tìm thấy vấn đề alt attribute:', issues);
|
|
237
|
+
// Tất cả tính năng enhanced đã được tích hợp trong AccessibilityFixer
|
|
238
|
+
// Không cần import thêm class riêng biệt
|
|
239
|
+
const results = await fixer.fixAllAccessibilityIssues("./src");
|
|
240
|
+
console.log("Hoàn thành sửa lỗi với enhanced features:", results);
|
|
235
241
|
```
|
|
236
242
|
|
|
237
243
|
## 🎯 Những gì được sửa
|
|
238
244
|
|
|
239
245
|
### Alt Attributes (Chế độ Enhanced)
|
|
246
|
+
|
|
240
247
|
- **Alt attributes thiếu** → Tạo alt text nhận biết ngữ cảnh
|
|
241
248
|
- **Alt attributes rỗng** → Mô tả thông minh dựa trên nội dung
|
|
242
249
|
- **Alt text generic** → Mô tả cụ thể, có ý nghĩa
|
|
@@ -245,21 +252,31 @@ console.log('Tìm thấy vấn đề alt attribute:', issues);
|
|
|
245
252
|
- **Trực quan hóa dữ liệu** → Loại biểu đồ + xu hướng + dữ liệu chính
|
|
246
253
|
|
|
247
254
|
### Accessibility Form
|
|
255
|
+
|
|
248
256
|
- **Form labels thiếu** → Tạo aria-label thông minh
|
|
249
257
|
- **Input không có label** → Gợi ý label dựa trên ngữ cảnh
|
|
250
258
|
- **Cấu trúc form** → Liên kết label phù hợp
|
|
251
259
|
|
|
252
260
|
### Phần tử tương tác
|
|
261
|
+
|
|
253
262
|
- **Button rỗng** → Tên button dựa trên hành động
|
|
254
263
|
- **Text link generic** → Mục đích link mô tả
|
|
255
264
|
- **Tên button thiếu** → Mô tả dựa trên chức năng
|
|
256
265
|
|
|
257
266
|
### Cấu trúc tài liệu
|
|
267
|
+
|
|
258
268
|
- **Lang attributes thiếu** → Phát hiện ngôn ngữ tự động
|
|
259
269
|
- **Landmark thiếu** → Main và navigation landmarks
|
|
260
270
|
- **Cấu trúc heading** → Phân tích và khuyến nghị
|
|
261
271
|
- **Role attributes** → Gán role tuân thủ WCAG
|
|
262
272
|
|
|
273
|
+
### Kiểm tra liên kết
|
|
274
|
+
|
|
275
|
+
- **Liên kết bị hỏng** → Phát hiện HTTP 404, 500, timeout
|
|
276
|
+
- **Tài nguyên không tồn tại** → Kiểm tra file local thiếu
|
|
277
|
+
- **URL không hợp lệ** → Phát hiện định dạng URL sai
|
|
278
|
+
- **Liên kết chậm** → Cảnh báo timeout và phản hồi chậm
|
|
279
|
+
|
|
263
280
|
## 🧪 Kiểm tra và Demo
|
|
264
281
|
|
|
265
282
|
```bash
|
|
@@ -329,4 +346,4 @@ Dự án này được cấp phép theo Giấy phép MIT - xem file [LICENSE](LI
|
|
|
329
346
|
|
|
330
347
|
**Được tạo với ❤️ bởi GBU Team**
|
|
331
348
|
|
|
332
|
-
Để biết thêm thông tin, hãy truy cập [GitHub repository](https://github.com/dangpv94/gbu-accessibility-tool) của chúng tôi.
|
|
349
|
+
Để biết thêm thông tin, hãy truy cập [GitHub repository](https://github.com/dangpv94/gbu-accessibility-tool) của chúng tôi.
|
package/README.md
CHANGED
|
@@ -18,15 +18,17 @@
|
|
|
18
18
|
- 🔗 **Link Names** - Fix empty links and detect generic link text
|
|
19
19
|
- 🏛️ **Landmarks** - Add missing main and navigation landmarks
|
|
20
20
|
- 📑 **Heading Analysis** - Analyze heading structure with suggestions (no auto-fix)
|
|
21
|
+
- 🔍 **Broken Links Detection** - Detect broken links and 404 resources
|
|
21
22
|
- 🧹 **Duplicate Cleanup** - Remove duplicate role attributes
|
|
22
23
|
|
|
23
|
-
### 🚀 **Enhanced Alt Attribute Features (
|
|
24
|
-
- 🔍 **Comprehensive Analysis** - Image type classification and quality checking
|
|
25
|
-
- 🎨 **Diverse Alt Generation** - Multiple strategies for creative alt text
|
|
26
|
-
- 🌐 **Multi-language Support** - Japanese, English, Vietnamese vocabulary
|
|
24
|
+
### 🚀 **Enhanced Alt Attribute Features (Integrated!)**
|
|
25
|
+
- 🔍 **Comprehensive Analysis** - Image type classification and quality checking built-in
|
|
26
|
+
- 🎨 **Diverse Alt Generation** - Multiple strategies for creative alt text integrated in core
|
|
27
|
+
- 🌐 **Multi-language Support** - Japanese, English, Vietnamese vocabulary built-in
|
|
27
28
|
- 🎭 **Creativity Levels** - Conservative, Balanced, Creative modes
|
|
28
29
|
- 🧠 **Context Awareness** - Brand, emotional, and technical context integration
|
|
29
30
|
- 📊 **Data Visualization** - Specialized descriptions for charts and graphs
|
|
31
|
+
- 🧹 **Clean Architecture** - All enhanced features integrated in a single file
|
|
30
32
|
|
|
31
33
|
### 🛠️ **Utility Features**
|
|
32
34
|
- 📁 **Batch Processing** - Process entire directories recursively
|
|
@@ -103,6 +105,7 @@ Fix Modes:
|
|
|
103
105
|
--links-only Fix link names + cleanup
|
|
104
106
|
--landmarks-only Fix landmarks + cleanup
|
|
105
107
|
--headings-only Analyze heading structure (no auto-fix)
|
|
108
|
+
--links-check Check for broken links and 404 resources
|
|
106
109
|
--cleanup-only Only cleanup duplicate role attributes
|
|
107
110
|
|
|
108
111
|
Enhanced Alt Options:
|
|
@@ -131,6 +134,7 @@ gbu-a11y -l en ./public
|
|
|
131
134
|
gbu-a11y --alt-only # Fix alt attributes + cleanup
|
|
132
135
|
gbu-a11y --forms-only # Fix form labels + cleanup
|
|
133
136
|
gbu-a11y --buttons-only # Fix button names + cleanup
|
|
137
|
+
gbu-a11y --links-check # Check broken links + cleanup
|
|
134
138
|
|
|
135
139
|
# Enhanced alt attribute features
|
|
136
140
|
gbu-a11y --enhanced-alt # Basic enhanced mode
|
|
@@ -208,12 +212,12 @@ await fixer.fixFormLabels('./src');
|
|
|
208
212
|
await fixer.fixButtonNames('./src');
|
|
209
213
|
```
|
|
210
214
|
|
|
211
|
-
### Enhanced Alt Attribute Mode
|
|
215
|
+
### Enhanced Alt Attribute Mode (Integrated)
|
|
212
216
|
|
|
213
217
|
```javascript
|
|
214
|
-
const { AccessibilityFixer
|
|
218
|
+
const { AccessibilityFixer } = require('gbu-accessibility-package');
|
|
215
219
|
|
|
216
|
-
// Use AccessibilityFixer with enhanced mode
|
|
220
|
+
// Use AccessibilityFixer with enhanced mode (integrated)
|
|
217
221
|
const fixer = new AccessibilityFixer({
|
|
218
222
|
language: 'en',
|
|
219
223
|
enhancedAltMode: true,
|
|
@@ -224,14 +228,10 @@ const fixer = new AccessibilityFixer({
|
|
|
224
228
|
|
|
225
229
|
await fixer.fixEmptyAltAttributes('./src');
|
|
226
230
|
|
|
227
|
-
//
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
const issues = checker.analyzeAltAttributes(htmlContent);
|
|
234
|
-
console.log('Alt attribute issues found:', issues);
|
|
231
|
+
// All enhanced features are now integrated in AccessibilityFixer
|
|
232
|
+
// No need to import separate classes
|
|
233
|
+
const results = await fixer.fixAllAccessibilityIssues('./src');
|
|
234
|
+
console.log('Accessibility fixes completed with enhanced features:', results);
|
|
235
235
|
```
|
|
236
236
|
|
|
237
237
|
## 🎯 What Gets Fixed
|
|
@@ -260,6 +260,12 @@ console.log('Alt attribute issues found:', issues);
|
|
|
260
260
|
- **Heading structure** → Analysis and recommendations
|
|
261
261
|
- **Role attributes** → WCAG-compliant role assignments
|
|
262
262
|
|
|
263
|
+
### Link Validation
|
|
264
|
+
- **Broken links** → Detect HTTP 404, 500, timeout errors
|
|
265
|
+
- **Missing resources** → Check for missing local files
|
|
266
|
+
- **Invalid URLs** → Detect malformed URL formats
|
|
267
|
+
- **Slow links** → Warn about timeouts and slow responses
|
|
268
|
+
|
|
263
269
|
## 🧪 Testing and Demo
|
|
264
270
|
|
|
265
271
|
```bash
|
package/cli.js
CHANGED
|
@@ -27,6 +27,7 @@ const options = {
|
|
|
27
27
|
linksOnly: false,
|
|
28
28
|
landmarksOnly: false,
|
|
29
29
|
headingsOnly: false,
|
|
30
|
+
brokenLinksOnly: false,
|
|
30
31
|
// Enhanced alt options
|
|
31
32
|
enhancedAlt: false,
|
|
32
33
|
altCreativity: 'balanced', // conservative, balanced, creative
|
|
@@ -91,6 +92,10 @@ for (let i = 0; i < args.length; i++) {
|
|
|
91
92
|
case '--headings-only':
|
|
92
93
|
options.headingsOnly = true;
|
|
93
94
|
break;
|
|
95
|
+
case '--links-check':
|
|
96
|
+
case '--broken-links':
|
|
97
|
+
options.brokenLinksOnly = true;
|
|
98
|
+
break;
|
|
94
99
|
case '--enhanced-alt':
|
|
95
100
|
options.enhancedAlt = true;
|
|
96
101
|
break;
|
|
@@ -133,6 +138,7 @@ Options:
|
|
|
133
138
|
--links-only Fix link names + cleanup
|
|
134
139
|
--landmarks-only Fix landmarks + cleanup
|
|
135
140
|
--headings-only Analyze heading structure (no auto-fix)
|
|
141
|
+
--links-check Check for broken links and 404 resources (no auto-fix)
|
|
136
142
|
--enhanced-alt Use enhanced alt attribute analysis and generation
|
|
137
143
|
--alt-creativity <mode> Alt text creativity: conservative, balanced, creative (default: balanced)
|
|
138
144
|
--include-emotions Include emotional descriptors in alt text
|
|
@@ -162,6 +168,7 @@ Examples:
|
|
|
162
168
|
node cli.js --links-only # Fix link names + cleanup
|
|
163
169
|
node cli.js --landmarks-only # Fix landmarks + cleanup
|
|
164
170
|
node cli.js --headings-only # Analyze heading structure only
|
|
171
|
+
node cli.js --links-check # Check for broken links and 404s
|
|
165
172
|
node cli.js --cleanup-only # Only cleanup duplicate roles
|
|
166
173
|
node cli.js ./src # Fix src directory (comprehensive)
|
|
167
174
|
node cli.js -l en --dry-run ./dist # Preview comprehensive fixes in English
|
|
@@ -220,7 +227,8 @@ async function main() {
|
|
|
220
227
|
try {
|
|
221
228
|
// Handle different modes - All modes now include cleanup
|
|
222
229
|
if (options.cleanupOnly || options.altOnly || options.langOnly || options.roleOnly ||
|
|
223
|
-
options.formsOnly || options.buttonsOnly || options.linksOnly || options.landmarksOnly ||
|
|
230
|
+
options.formsOnly || options.buttonsOnly || options.linksOnly || options.landmarksOnly ||
|
|
231
|
+
options.headingsOnly || options.brokenLinksOnly) {
|
|
224
232
|
// Individual modes - handle each separately, then run cleanup
|
|
225
233
|
} else {
|
|
226
234
|
// Default mode: Run comprehensive fix (all fixes including cleanup)
|
|
@@ -390,6 +398,18 @@ async function main() {
|
|
|
390
398
|
|
|
391
399
|
showCompletionMessage(options, 'Heading analysis');
|
|
392
400
|
return;
|
|
401
|
+
|
|
402
|
+
} else if (options.brokenLinksOnly) {
|
|
403
|
+
// Check broken links only (no fixes, no cleanup)
|
|
404
|
+
console.log(chalk.blue('🔗 Running broken links check only...'));
|
|
405
|
+
const linkResults = await fixer.checkBrokenLinks(options.directory);
|
|
406
|
+
const totalBrokenLinks = linkResults.reduce((sum, r) => sum + (r.issues || 0), 0);
|
|
407
|
+
|
|
408
|
+
console.log(chalk.green(`\n✅ Checked links in ${linkResults.length} files (${totalBrokenLinks} issues found)`));
|
|
409
|
+
console.log(chalk.gray('💡 Broken link issues require manual review and cannot be auto-fixed'));
|
|
410
|
+
|
|
411
|
+
showCompletionMessage(options, 'Broken links check');
|
|
412
|
+
return;
|
|
393
413
|
}
|
|
394
414
|
|
|
395
415
|
} catch (error) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="ja">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Broken Links Test</title>
|
|
6
|
+
<!-- Broken CSS -->
|
|
7
|
+
<link rel="stylesheet" href="missing-style.css">
|
|
8
|
+
<!-- Working CSS (if exists) -->
|
|
9
|
+
<link rel="stylesheet" href="../package.json">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<h1>Broken Links Test</h1>
|
|
13
|
+
|
|
14
|
+
<!-- Working local link -->
|
|
15
|
+
<a href="advanced-test.html">Working local link</a>
|
|
16
|
+
|
|
17
|
+
<!-- Broken local link -->
|
|
18
|
+
<a href="non-existent-page.html">Broken local link</a>
|
|
19
|
+
|
|
20
|
+
<!-- Working external link -->
|
|
21
|
+
<a href="https://www.google.com">Working external link</a>
|
|
22
|
+
|
|
23
|
+
<!-- Broken external link -->
|
|
24
|
+
<a href="https://this-domain-does-not-exist-12345.com">Broken external link</a>
|
|
25
|
+
|
|
26
|
+
<!-- Working image -->
|
|
27
|
+
<img src="advanced-test.html" alt="Working image reference">
|
|
28
|
+
|
|
29
|
+
<!-- Broken image -->
|
|
30
|
+
<img src="missing-image.jpg" alt="Broken image">
|
|
31
|
+
|
|
32
|
+
<!-- Broken script -->
|
|
33
|
+
<script src="missing-script.js"></script>
|
|
34
|
+
|
|
35
|
+
<!-- Skip patterns -->
|
|
36
|
+
<a href="#anchor">Anchor link (should skip)</a>
|
|
37
|
+
<a href="mailto:test@example.com">Email link (should skip)</a>
|
|
38
|
+
<a href="tel:+1234567890">Phone link (should skip)</a>
|
|
39
|
+
<a href="javascript:void(0)">JavaScript link (should skip)</a>
|
|
40
|
+
</body>
|
|
41
|
+
</html>
|
package/index.js
CHANGED