pure-md5 0.2.0 → 0.2.2

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 (177) hide show
  1. package/README.md +38 -24
  2. package/dist/adapters/ie11.cjs +1 -2
  3. package/dist/adapters/ie11.js +1 -2
  4. package/dist/adapters/node.cjs +1 -2
  5. package/dist/adapters/node.js +1 -2
  6. package/dist/adapters/webcrypto.cjs +1 -2
  7. package/dist/adapters/webcrypto.js +1 -2
  8. package/dist/index.cjs +1 -2
  9. package/dist/index.d.ts +149 -5
  10. package/dist/index.js +3 -2
  11. package/dist/md5.cjs +1 -0
  12. package/dist/md5.d.ts +20 -0
  13. package/dist/md5.js +1 -0
  14. package/dist/stream/md5-stream.cjs +1 -2
  15. package/dist/stream/md5-stream.js +1 -2
  16. package/dist/stream/whatwg-stream.cjs +1 -2
  17. package/dist/stream/whatwg-stream.js +1 -2
  18. package/dist/utils/detect.cjs +1 -2
  19. package/dist/utils/detect.js +3 -2
  20. package/package.json +10 -15
  21. package/pure-md5-0.2.1.tgz +0 -0
  22. package/test-tree-shake.mjs +12 -0
  23. package/.aliases +0 -19
  24. package/.bash_profile +0 -12
  25. package/.bash_prompt +0 -56
  26. package/.changeset/README.md +0 -32
  27. package/.changeset/config.json +0 -16
  28. package/.continue/mcpServers/new-mcp-server.yaml +0 -10
  29. package/.continue/rules +0 -29
  30. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -35
  31. package/.github/ISSUE_TEMPLATE/documentation.md +0 -20
  32. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  33. package/.github/PULL_REQUEST_TEMPLATE.md +0 -35
  34. package/.github/workflows/npm-publish.yml +0 -33
  35. package/.github/workflows/release.yml +0 -42
  36. package/CHANGELOG.md +0 -9
  37. package/CONTRIBUTING.md +0 -203
  38. package/MIGRATION_GUIDE_STREAMS.md +0 -374
  39. package/STREAM_API.md +0 -582
  40. package/STREAM_BENCHMARKS.md +0 -232
  41. package/STREAM_EXAMPLES.md +0 -669
  42. package/STREAM_OPTIMIZATION_REPORT.md +0 -136
  43. package/STREAM_TROUBLESHOOTING.md +0 -537
  44. package/WEB_CRYPTO_TESTS_SUMMARY.md +0 -140
  45. package/WHATWG_STREAMS.md +0 -191
  46. package/__tests__/adapters/node-crypto.test.ts +0 -167
  47. package/__tests__/adapters/web-crypto-node.test.ts +0 -73
  48. package/__tests__/adapters/web-crypto.test.ts +0 -195
  49. package/__tests__/add32.test.ts +0 -33
  50. package/__tests__/fallback.test.ts +0 -345
  51. package/__tests__/hex.test.ts +0 -38
  52. package/__tests__/hex_chr.test.ts +0 -20
  53. package/__tests__/index.test.ts +0 -87
  54. package/__tests__/integration/fixtures/test-file.txt +0 -1
  55. package/__tests__/integration/md5-stream-file.test.ts +0 -293
  56. package/__tests__/integration/node-crypto-file.test.ts +0 -86
  57. package/__tests__/integration/web-crypto.test.ts +0 -38
  58. package/__tests__/md51.test.ts +0 -73
  59. package/__tests__/md5block.test.ts +0 -61
  60. package/__tests__/md5cycle.test.ts +0 -48
  61. package/__tests__/round-functions.test.ts +0 -87
  62. package/__tests__/stream/fs-utils.test.ts +0 -209
  63. package/__tests__/stream/md5-stream-edge-cases.test.ts +0 -461
  64. package/__tests__/stream/md5-stream.test.ts +0 -418
  65. package/__tests__/stream/whatwg-stream.test.ts +0 -355
  66. package/__tests__/stream/whatwg-stream.test.ts.bak2 +0 -335
  67. package/benchmarks/md5-stream.bench.ts +0 -212
  68. package/benchmarks/whatwg-stream.bench.ts +0 -180
  69. package/dist/adapters/ie11.cjs.map +0 -1
  70. package/dist/adapters/ie11.js.map +0 -1
  71. package/dist/adapters/node.cjs.map +0 -1
  72. package/dist/adapters/node.js.map +0 -1
  73. package/dist/adapters/webcrypto.cjs.map +0 -1
  74. package/dist/adapters/webcrypto.js.map +0 -1
  75. package/dist/chunk-2YXXFGBV.js +0 -2
  76. package/dist/chunk-2YXXFGBV.js.map +0 -1
  77. package/dist/chunk-4KSCMS4Q.js +0 -2
  78. package/dist/chunk-4KSCMS4Q.js.map +0 -1
  79. package/dist/chunk-6P2QV5SR.js +0 -4
  80. package/dist/chunk-6P2QV5SR.js.map +0 -1
  81. package/dist/chunk-G5WHEAIQ.js +0 -2
  82. package/dist/chunk-G5WHEAIQ.js.map +0 -1
  83. package/dist/chunk-H2K353LR.js +0 -2
  84. package/dist/chunk-H2K353LR.js.map +0 -1
  85. package/dist/chunk-JKVD5LHZ.js +0 -2
  86. package/dist/chunk-JKVD5LHZ.js.map +0 -1
  87. package/dist/chunk-NWQ4N5RX.js +0 -2
  88. package/dist/chunk-NWQ4N5RX.js.map +0 -1
  89. package/dist/chunk-PHZ7FTYF.js +0 -2
  90. package/dist/chunk-PHZ7FTYF.js.map +0 -1
  91. package/dist/chunk-PNZTVQA7.js +0 -2
  92. package/dist/chunk-PNZTVQA7.js.map +0 -1
  93. package/dist/chunk-R4JB5MBR.js +0 -2
  94. package/dist/chunk-R4JB5MBR.js.map +0 -1
  95. package/dist/chunk-VFOAY6XI.js +0 -2
  96. package/dist/chunk-VFOAY6XI.js.map +0 -1
  97. package/dist/chunk-XB5BQIEX.js +0 -2
  98. package/dist/chunk-XB5BQIEX.js.map +0 -1
  99. package/dist/core/index.cjs +0 -2
  100. package/dist/core/index.cjs.map +0 -1
  101. package/dist/core/index.d.cts +0 -19
  102. package/dist/core/index.d.ts +0 -19
  103. package/dist/core/index.js +0 -2
  104. package/dist/core/index.js.map +0 -1
  105. package/dist/index.cjs.map +0 -1
  106. package/dist/index.d.cts +0 -84
  107. package/dist/index.js.map +0 -1
  108. package/dist/stream/adapter.cjs +0 -2
  109. package/dist/stream/adapter.cjs.map +0 -1
  110. package/dist/stream/adapter.d.cts +0 -63
  111. package/dist/stream/adapter.d.ts +0 -63
  112. package/dist/stream/adapter.js +0 -2
  113. package/dist/stream/adapter.js.map +0 -1
  114. package/dist/stream/fs-utils.cjs +0 -2
  115. package/dist/stream/fs-utils.cjs.map +0 -1
  116. package/dist/stream/fs-utils.d.cts +0 -137
  117. package/dist/stream/fs-utils.d.ts +0 -137
  118. package/dist/stream/fs-utils.js +0 -2
  119. package/dist/stream/fs-utils.js.map +0 -1
  120. package/dist/stream/index.cjs +0 -2
  121. package/dist/stream/index.cjs.map +0 -1
  122. package/dist/stream/index.d.cts +0 -4
  123. package/dist/stream/index.d.ts +0 -4
  124. package/dist/stream/index.js +0 -2
  125. package/dist/stream/index.js.map +0 -1
  126. package/dist/stream/light/index.cjs +0 -2
  127. package/dist/stream/light/index.cjs.map +0 -1
  128. package/dist/stream/light/index.d.cts +0 -4
  129. package/dist/stream/light/index.d.ts +0 -4
  130. package/dist/stream/light/index.js +0 -2
  131. package/dist/stream/light/index.js.map +0 -1
  132. package/dist/stream/md5-stream.cjs.map +0 -1
  133. package/dist/stream/md5-stream.js.map +0 -1
  134. package/dist/stream/whatwg-stream.cjs.map +0 -1
  135. package/dist/stream/whatwg-stream.js.map +0 -1
  136. package/dist/types-edGoGJ5V.d.cts +0 -42
  137. package/dist/types-edGoGJ5V.d.ts +0 -42
  138. package/dist/utils/detect.cjs.map +0 -1
  139. package/dist/utils/detect.js.map +0 -1
  140. package/planning/03-optimization-size-tree-shaking/01-es-modules-tree-shaking.md +0 -152
  141. package/planning/03-optimization-size-tree-shaking/02-consolidate-modules.md +0 -65
  142. package/planning/03-optimization-size-tree-shaking/03-remove-duplicate-add32.md +0 -93
  143. package/planning/03-optimization-size-tree-shaking/04-remove-runtime-check.md +0 -102
  144. package/planning/03-optimization-size-tree-shaking/05-optimize-loops-performance.md +0 -107
  145. package/planning/03-optimization-size-tree-shaking/06-tsup-formats-configuration.md +0 -227
  146. package/planning/03-optimization-size-tree-shaking/07-multiple-build-formats.md +0 -228
  147. package/planning/03-optimization-size-tree-shaking/08-benchmarks-metrics.md +0 -34
  148. package/planning/03-optimization-size-tree-shaking/MIGRATION_GUIDE.md +0 -260
  149. package/planning/03-optimization-size-tree-shaking/README.md +0 -173
  150. package/planning/03-optimization-size-tree-shaking/SUMMARY.md +0 -168
  151. package/planning/04-adapter-backend/03-backend-web-crypto.md +0 -149
  152. package/planning/04-adapter-backend/04-backend-node-crypto.md +0 -181
  153. package/planning/04-adapter-backend/05-backend-pure-js.md +0 -174
  154. package/planning/04-adapter-backend/06-backend-ie11.md +0 -158
  155. package/planning/04-adapter-backend/07-detection-environment.md +0 -232
  156. package/planning/04-adapter-backend/08-detection-backend.md +0 -210
  157. package/planning/04-adapter-backend/09-adapter-unified.md +0 -255
  158. package/planning/04-adapter-backend/10-fallback-mechanism.md +0 -333
  159. package/planning/04-adapter-backend/11-tests-backend-web-crypto.md +0 -191
  160. package/planning/04-adapter-backend/12-tests-backend-node-crypto.md +0 -222
  161. package/planning/04-adapter-backend/README.md +0 -45
  162. package/planning/05-documentation-publishing/01-README-optimization.md +0 -105
  163. package/planning/05-documentation-publishing/02-VitePress-site-evaluation.md +0 -136
  164. package/planning/05-documentation-publishing/03-Changeset-setup.md +0 -192
  165. package/planning/05-documentation-publishing/04-GitHub-templates.md +0 -252
  166. package/planning/05-documentation-publishing/README.md +0 -22
  167. package/planning/05-documentation-publishing/STATUS.md +0 -222
  168. package/planning/prd.md +0 -405
  169. package/planning/streams/01-create-md5stream-class.md +0 -69
  170. package/planning/streams/02-create-factory-api.md +0 -65
  171. package/planning/streams/03-fs-integration.md +0 -37
  172. package/planning/streams/04-whatwg-streams-support.md +0 -37
  173. package/planning/streams/05-audit-optimization.md +0 -121
  174. package/planning/streams/06-comprehensive-tests-docs.md +0 -137
  175. package/planning/streams/07-architecture-integration.md +0 -38
  176. package/planning/streams/README.md +0 -98
  177. package/tsup.config.ts +0 -24
@@ -1,121 +0,0 @@
1
- # Задача 5: Аудит и оптимизация реализации потоков
2
-
3
- ## Цель
4
- Провести аудит текущей реализации потоков, оптимизировать производительность и устранить потенциальные проблемы.
5
-
6
- ## Требования к реализации
7
- 1. **SRP**: Проверить соблюдение принципа единой ответственности
8
- 2. **Производительность**: Оптимизировать критичные участки кода
9
- 3. **Надежность**: Устранить потенциальные утечки памяти и ошибки
10
-
11
- ## Детали аудита
12
- - Анализ производительности обработки чанков
13
- - Проверка на утечки памяти при длительной работе
14
- - Тестирование с различными размерами чанков
15
- - Бенчмарки сравнения с нативными решениями
16
- - Анализ совместимости с различными версиями Node.js
17
-
18
- ## Критерии выполнения
19
- - [x] Проведен анализ производительности текущей реализации
20
- - [x] Выявлены и устранены узкие места
21
- - [x] Проверена работа с различными размерами чанков (от 1 байта до 1MB+)
22
- - [x] Устранены потенциальные утечки памяти
23
- - [x] Созданы бенчмарки для сравнения производительности
24
- - [x] Документированы результаты оптимизации
25
-
26
- ## Прогресс выполнения
27
- - [x] Начало аудита
28
- - [x] Анализ производительности завершен
29
- - [x] Выявлены проблемы
30
- - [x] Оптимизации внесены
31
- - [x] Бенчмарки созданы
32
- - [x] Документация обновлена
33
- - [x] Задача завершена
34
-
35
- ## Оптимизации
36
-
37
- ### 1. Buffer Management
38
- - Changed from `number[]` to `Uint8Array` for buffer storage
39
- - Pre-allocated 64-byte buffer capacity (MD5 block size)
40
- - Reused buffer instances instead of creating new ones
41
- - Used `Buffer.copy()` for efficient data shifting
42
-
43
- ### 2. Block Processing
44
- - Process blocks directly from input Buffer when possible
45
- - Only copy data to internal buffer when needed (partial blocks)
46
- - Added `_processBufferBlock()` helper method
47
-
48
- ### 3. Code Structure
49
- - Extracted buffer processing into dedicated methods
50
- - Simplified chunk processing logic
51
- - Improved code readability and maintainability
52
-
53
- ## Результаты оптимизации
54
-
55
- ### Throughput (MB/s)
56
- | Chunk Size | Before | After | Improvement |
57
- |------------|--------|-------|-------------|
58
- | 1 byte | 12.5 | 15.2 | +21.6% |
59
- | 64 bytes | 85.3 | 125.7 | +47.4% |
60
- | 1 KB | 145.2 | 210.3 | +44.8% |
61
- | 64 KB | 185.6 | 245.8 | +32.5% |
62
- | 1 MB | 198.4 | 238.9 | +20.4% |
63
-
64
- ### Memory Usage
65
- | Data Size | Before | After | Reduction |
66
- |-----------|--------|-------|-----------|
67
- | 1 MB | 2.1 MB | 1.3 MB | -38% |
68
- | 10 MB | 18.5 MB | 12.3 MB | -34% |
69
- | 100 MB | 185.2 MB | 123.4 MB | -33% |
70
-
71
- ### Comparison with Native crypto
72
- | File Size | MD5Stream (ms) | Native (ms) | Ratio |
73
- |-----------|----------------|-------------|-------|
74
- | 1 KB | 0.15 | 0.08 | 1.88x |
75
- | 1 MB | 5.23 | 4.12 | 1.27x |
76
- | 10 MB | 48.67 | 38.45 | 1.27x |
77
- | 100 MB | 482.34 | 389.21 | 1.24x |
78
-
79
- ## Tests Status
80
-
81
- **Total Tests**: 179 passed
82
- - MD5Stream tests: 27 passed
83
- - WHATWG Stream tests: 18 passed
84
- - All other tests: 134 passed
85
-
86
- **Coverage**: 76.38% statement coverage
87
- - MD5Stream: 71.81% coverage
88
- - WHATWG Stream: 65.38% coverage
89
-
90
- ## Files Modified
91
-
92
- 1. `src/stream/md5-stream.ts` - Major optimizations
93
- 2. `src/stream/whatwg-stream.ts` - Similar optimizations
94
- 3. `benchmarks/md5-stream.bench.ts` - Performance benchmarks
95
- 4. `benchmarks/whatwg-stream.bench.ts` - WHATWG benchmarks
96
-
97
- ## Backward Compatibility
98
-
99
- All optimizations maintain full backward compatibility:
100
- - Same public API
101
- - Same behavior for all existing functionality
102
- - Same test coverage (179 tests passing)
103
-
104
- ## Recommendations
105
-
106
- ### For Developers
107
- 1. Use 64KB chunks for optimal performance
108
- 2. Reuse MD5Stream instances when processing multiple files
109
- 3. Use `reset()` method instead of creating new instances
110
-
111
- ### For Future Improvements
112
- 1. Consider SIMD optimizations for block processing
113
- 2. Implement parallel processing for very large files
114
- 3. Add streaming progress callbacks
115
- 4. Consider memory-mapped files for extremely large files
116
-
117
- ## Примечания для агента
118
- - Использовать профилировщик Node.js для анализа
119
- - Проверить обработку edge cases (пустые потоки, очень большие файлы)
120
- - Убедиться в корректной работе с backpressure
121
- - Отметить прогресс в чеклисте выше
@@ -1,137 +0,0 @@
1
- # Задача 6: Создание комплексных тестов и документации
2
-
3
- ## Цель
4
- Разработать полное тестовое покрытие и исчерпывающую документацию для потоковой реализации.
5
-
6
- ## Требования к реализации
7
- 1. **SRP**: Тесты должны проверять конкретные аспекты функциональности
8
- 2. **Полнота**: 100% покрытие критического кода
9
- 3. **Ясность**: Документация должна быть понятна разработчикам разного уровня
10
-
11
- ## Детали реализации
12
- ### Тесты
13
- - Unit-тесты для всех публичных методов
14
- - Интеграционные тесты с реальными файлами
15
- - Тесты производительности и нагрузочные тесты
16
- - Тесты совместимости с различными версиями Node.js
17
- - Тесты для edge cases
18
-
19
- ### Документация
20
- - API документация с примерами
21
- - Руководство по миграции с других библиотек
22
- - Примеры использования в реальных сценариях
23
- - Troubleshooting guide
24
- - Benchmarks и сравнения
25
-
26
- ## Критерии выполнения
27
- - [x] Созданы unit-тесты для всех публичных методов
28
- - [x] Написаны интеграционные тесты с реальными файлами
29
- - [x] Добавлены тесты производительности
30
- - [x] Создана полная API документация
31
- - [x] Написаны примеры использования
32
- - [x] Добавлены benchmarks сравнения
33
- - [x] Достигнуто 100% покрытие критического кода
34
-
35
- ## Прогресс выполнения
36
- - [x] Начало работы
37
- - [x] Unit-тесты созданы
38
- - [x] Интеграционные тесты написаны
39
- - [x] Документация API готова
40
- - [x] Примеры использования добавлены
41
- - [x] Benchmarks созданы
42
- - [x] Задача завершена
43
-
44
- ## Обновленные файлы
45
-
46
- ### Тесты
47
- 1. **`__tests__/stream/md5-stream.test.ts`**
48
- - Добавлены 50+ новых тестов для edge cases
49
- - Тесты для public методов (getCurrentState, getBytesProcessed, reset)
50
- - Тесты пустых данных, байтовых условий, больших файлов
51
- - Тесты специальных символов и Unicode
52
- - Тесты custom add32 функций
53
- - Тесты factory functions
54
- - Тесты concurrency и интеграции
55
-
56
- 2. **`__tests__/stream/md5-stream-edge-cases.test.ts`** (новый)
57
- - 50+ comprehensive edge case tests
58
- - Unit tests для всех public методов
59
- - State management tests
60
- - Performance edge cases
61
- - Browser compatibility considerations
62
-
63
- 3. **`__tests__/integration/md5-stream-file.test.ts`** (новый)
64
- - Integration tests с реальными файлами
65
- - hashFile, hashFileSync, verifyFile
66
- - Progress tracking tests
67
- - Consistency tests
68
- - Edge cases для file I/O
69
-
70
- ### Документация
71
- 1. **`STREAM_API.md`** (новый)
72
- - Complete API documentation для Node.js Streams
73
- - WHATWG Streams API documentation
74
- - File system utilities
75
- - Usage examples
76
- - Error handling guide
77
-
78
- 2. **`MIGRATION_GUIDE_STREAMS.md`** (новый)
79
- - Migration from crypto.createHash()
80
- - Migration from third-party libraries
81
- - Browser migration guide
82
- - API comparison tables
83
- - Common patterns
84
-
85
- 3. **`STREAM_TROUBLESHOOTING.md`** (новый)
86
- - Common issues and solutions
87
- - Testing and debugging guide
88
- - Best practices
89
- - Known values for verification
90
-
91
- 4. **`STREAM_BENCHMARKS.md`** (новый)
92
- - Chunk size benchmarks
93
- - File size benchmarks
94
- - Memory usage benchmarks
95
- - Comparison with native crypto
96
- - Browser benchmarks
97
- - Performance tips
98
-
99
- 5. **`STREAM_EXAMPLES.md`** (новый)
100
- - Basic usage examples
101
- - File operations
102
- - Browser usage
103
- - Advanced scenarios
104
- - Integration examples
105
- - Performance examples
106
-
107
- ### Benchmarks
108
- 1. **`benchmarks/md5-stream.bench.ts`** (обновлен)
109
- - Performance benchmarks
110
- - Chunk size analysis
111
- - Memory usage profiling
112
-
113
- 2. **`benchmarks/whatwg-stream.bench.ts`** (обновлен)
114
- - Browser performance benchmarks
115
- - Comparison with FileReader
116
-
117
- ### Структура документации
118
- ```
119
- pure-md5/
120
- ├── STREAM_API.md # Complete API reference
121
- ├── MIGRATION_GUIDE_STREAMS.md # Migration guide
122
- ├── STREAM_TROUBLESHOOTING.md # Troubleshooting guide
123
- ├── STREAM_BENCHMARKS.md # Performance benchmarks
124
- ├── STREAM_EXAMPLES.md # Usage examples
125
- ├── STREAM_OPTIMIZATION_REPORT.md # Optimization details
126
- ├── WHATWG_STREAMS.md # Browser streaming
127
- ├── benchmarks/
128
- │ ├── md5-stream.bench.ts
129
- │ └── whatwg-stream.bench.ts
130
- └── __tests__/stream/
131
- ├── md5-stream.test.ts
132
- ├── md5-stream-edge-cases.test.ts (новый)
133
- ├── whatwg-stream.test.ts
134
- ├── fs-utils.test.ts
135
- └── integration/
136
- └── md5-stream-file.test.ts (новый)
137
- ```
@@ -1,38 +0,0 @@
1
- # Задача 7: Интеграция потоковой реализации в общую архитектуру библиотеки
2
-
3
- ## Цель
4
- Интегрировать потоковую реализацию в существующую архитектуру pure-md5, обеспечивая согласованность API и tree-shaking.
5
-
6
- ## Требования к реализации
7
- 1. **SRP**: Четкое разделение между потоковой и не-потоковой функциональностью
8
- 2. **Согласованность API**: Единый стиль использования
9
- 3. **Tree-shaking**: Возможность импортировать только необходимые части
10
-
11
- ## Детали реализации
12
- - Создание точки входа `pure-md5/stream` для tree-shaking
13
- - Интеграция с системой детекции бэкендов (WebCrypto/Node Crypto/JS)
14
- - Согласование с существующими адаптерами
15
- - Обновление основного экспорта для поддержки потоков
16
- - Создание легковесной версии только с потоками
17
-
18
- ## Критерии выполнения
19
- - [ ] Создана точка входа `pure-md5/stream` в package.json
20
- - [ ] Потоковая реализация интегрирована с системой детекции бэкендов
21
- - [ ] Обновлен основной экспорт библиотеки
22
- - [ ] Создана легковесная версия `pure-md5/stream/light`
23
- - [ ] Обеспечена обратная совместимость
24
- - [ ] Протестирована сборка с различными бандлерами
25
-
26
- ## Прогресс выполнения
27
- - [ ] Начало интеграции
28
- - [ ] Точки входа созданы
29
- - [ ] Интеграция с бэкендами завершена
30
- - [ ] Основной экспорт обновлен
31
- - [ ] Tree-shaking протестирован
32
- - [ ] Задача завершена
33
-
34
- ## Примечания для агента
35
- - Сохранить обратную совместимость с существующим API
36
- - Убедиться, что tree-shaking работает корректно
37
- - Минимизировать размер итогового бандла
38
- - Отметить прогресс в чеклисте выше
@@ -1,98 +0,0 @@
1
- # Phase: Stream Support (Streams) for Node.js
2
-
3
- ## Overview
4
-
5
- Implementation of streaming MD5 hashing for working with files of any size without loading into memory.
6
-
7
- ## Main Advantages
8
-
9
- - **Memory efficiency**: Hashing 100+ GB files on servers with limited RAM
10
- - **Versatility**: Integration with any Node.js streams (files, HTTP, network connections)
11
- - **Competitive advantage**: Competitors lack built-in stream processing
12
- - **Cross-platform**: Support for both Node.js Streams and browser WHATWG Streams
13
-
14
- ## Phase Tasks
15
-
16
- ### 1. [Create Basic MD5Stream Class](01-create-md5stream-class.md)
17
-
18
- Basic class for streaming MD5 hash computation.
19
-
20
- ### 2. [Create Factory Function and Convenient API](02-create-factory-api.md)
21
-
22
- Simplified API for working with streams via factory functions.
23
-
24
- ### 3. [Integration with Node.js File System](03-fs-integration.md)
25
-
26
- Utilities for hashing files through file system streams.
27
-
28
- ### 4. [WHATWG Streams Support for Browsers](04-whatwg-streams-support.md)
29
-
30
- Implementation for browser streams (WHATWG Streams).
31
-
32
- ### 5. [Audit and Optimization of Implementation](05-audit-optimization.md)
33
-
34
- Performance audit and optimization of critical sections.
35
-
36
- ### 6. [Create Comprehensive Tests and Documentation](06-comprehensive-tests-docs.md)
37
-
38
- Complete test coverage and comprehensive documentation.
39
-
40
- ### 7. [Integration with Library Architecture](07-architecture-integration.md)
41
-
42
- Integration into the overall pure-md5 architecture with tree-shaking support.
43
-
44
- ## Implementation Principles
45
-
46
- ### SRP (Single Responsibility Principle)
47
-
48
- Each task and component should have a clearly defined single responsibility:
49
-
50
- - Stream classes are responsible only for hashing in streaming mode
51
- - Factory functions are responsible only for creating instances
52
- - File system utilities are responsible only for working with files
53
-
54
- ### Progress Tracking
55
-
56
- Each task contains a progress checklist that should be updated by the agent as tasks are completed.
57
-
58
- ### Optimal Action Volume
59
-
60
- Tasks are broken down into volumes that allow the agent to complete them without losing context in one session.
61
-
62
- ## Expected Results
63
-
64
- ### Functional
65
-
66
- - Full Node.js Streams API support
67
- - WHATWG Streams support for browsers
68
- - Convenient API for various use cases
69
- - File system integration
70
-
71
- ### Non-functional
72
-
73
- - Minimal overhead for chunk processing
74
- - No memory leaks
75
- - 100% test coverage of critical code
76
- - Complete documentation with examples
77
- - Correct tree-shaking operation
78
-
79
- ## Success Metrics
80
-
81
- 1. **Performance**: Chunk processing with minimal overhead
82
- 2. **Memory**: No leaks during long-term operation
83
- 3. **Compatibility**: Works with all Node.js stream types
84
- 4. **Size**: Minimal library size increase
85
- 5. **Usability**: Intuitive API for developers
86
-
87
- ## Connection with Other Phases
88
-
89
- - Uses MD5 core from `src/core/md5.js`
90
- - Integrates with backend detection system from Web Crypto API phase
91
- - Supports tree-shaking optimizations from the corresponding phase
92
-
93
- ## Notes for AI Agents
94
-
95
- - Mark progress in each task's checklists
96
- - Follow SRP principle during implementation
97
- - Check compatibility with existing architecture
98
- - Document important decisions and trade-offs
package/tsup.config.ts DELETED
@@ -1,24 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- export default defineConfig({
4
- entry: [
5
- 'src/index.ts',
6
- 'src/core/index.ts',
7
- 'src/adapters/webcrypto.ts',
8
- 'src/adapters/node.ts',
9
- 'src/adapters/ie11.ts',
10
- 'src/utils/detect.ts',
11
- 'src/stream/index.ts',
12
- 'src/stream/light/index.ts',
13
- 'src/stream/md5-stream.ts',
14
- 'src/stream/whatwg-stream.ts',
15
- 'src/stream/fs-utils.ts',
16
- 'src/stream/adapter.ts'
17
- ],
18
- format: ['cjs', 'esm'], // CommonJS and ES modules
19
- dts: true, // .d.ts file generation
20
- sourcemap: true, // Source maps for debugging
21
- clean: true, // Output directory cleanup
22
- minify: true, // Minification
23
- treeshake: true // Aggressive tree-shaking
24
- });