configforge 1.0.0-beta.8 → 1.0.0

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 (124) hide show
  1. package/README.md +371 -2
  2. package/dist/core/BatchProcessor.d.ts +48 -0
  3. package/dist/core/BatchProcessor.d.ts.map +1 -0
  4. package/dist/core/BatchProcessor.js +273 -0
  5. package/dist/core/BatchProcessor.js.map +1 -0
  6. package/dist/core/ConversionResult.d.ts +22 -0
  7. package/dist/core/ConversionResult.d.ts.map +1 -1
  8. package/dist/core/ConversionResult.js +44 -30
  9. package/dist/core/ConversionResult.js.map +1 -1
  10. package/dist/core/Converter.d.ts +52 -2
  11. package/dist/core/Converter.d.ts.map +1 -1
  12. package/dist/core/Converter.js +154 -68
  13. package/dist/core/Converter.js.map +1 -1
  14. package/dist/core/IncrementalProcessor.d.ts +75 -0
  15. package/dist/core/IncrementalProcessor.d.ts.map +1 -0
  16. package/dist/core/IncrementalProcessor.js +298 -0
  17. package/dist/core/IncrementalProcessor.js.map +1 -0
  18. package/dist/core/PerformanceMonitor.d.ts +103 -0
  19. package/dist/core/PerformanceMonitor.d.ts.map +1 -0
  20. package/dist/core/PerformanceMonitor.js +253 -0
  21. package/dist/core/PerformanceMonitor.js.map +1 -0
  22. package/dist/core/Pipeline.d.ts +42 -0
  23. package/dist/core/Pipeline.d.ts.map +1 -0
  24. package/dist/core/Pipeline.js +134 -0
  25. package/dist/core/Pipeline.js.map +1 -0
  26. package/dist/core/index.d.ts +3 -0
  27. package/dist/core/index.d.ts.map +1 -1
  28. package/dist/core/index.js +8 -1
  29. package/dist/core/index.js.map +1 -1
  30. package/dist/core/pipeline/PipelineBuilder.d.ts +71 -0
  31. package/dist/core/pipeline/PipelineBuilder.d.ts.map +1 -0
  32. package/dist/core/pipeline/PipelineBuilder.js +117 -0
  33. package/dist/core/pipeline/PipelineBuilder.js.map +1 -0
  34. package/dist/core/pipeline/PipelineSteps.d.ts +74 -0
  35. package/dist/core/pipeline/PipelineSteps.d.ts.map +1 -0
  36. package/dist/core/pipeline/PipelineSteps.js +300 -0
  37. package/dist/core/pipeline/PipelineSteps.js.map +1 -0
  38. package/dist/errors/ErrorCollector.d.ts +119 -0
  39. package/dist/errors/ErrorCollector.d.ts.map +1 -0
  40. package/dist/errors/ErrorCollector.js +197 -0
  41. package/dist/errors/ErrorCollector.js.map +1 -0
  42. package/dist/errors/ErrorContext.d.ts +168 -0
  43. package/dist/errors/ErrorContext.d.ts.map +1 -0
  44. package/dist/errors/ErrorContext.js +356 -0
  45. package/dist/errors/ErrorContext.js.map +1 -0
  46. package/dist/errors/ErrorRecovery.d.ts +91 -0
  47. package/dist/errors/ErrorRecovery.d.ts.map +1 -0
  48. package/dist/errors/ErrorRecovery.js +321 -0
  49. package/dist/errors/ErrorRecovery.js.map +1 -0
  50. package/dist/errors/ErrorReporter.d.ts +58 -0
  51. package/dist/errors/ErrorReporter.d.ts.map +1 -0
  52. package/dist/errors/ErrorReporter.js +262 -0
  53. package/dist/errors/ErrorReporter.js.map +1 -0
  54. package/dist/errors/ErrorTypes.d.ts +103 -0
  55. package/dist/errors/ErrorTypes.d.ts.map +1 -0
  56. package/dist/errors/ErrorTypes.js +125 -0
  57. package/dist/errors/ErrorTypes.js.map +1 -0
  58. package/dist/errors/SpecificErrors.d.ts +45 -0
  59. package/dist/errors/SpecificErrors.d.ts.map +1 -0
  60. package/dist/errors/SpecificErrors.js +124 -0
  61. package/dist/errors/SpecificErrors.js.map +1 -0
  62. package/dist/errors/SuggestionEngine.d.ts +63 -0
  63. package/dist/errors/SuggestionEngine.d.ts.map +1 -0
  64. package/dist/errors/SuggestionEngine.js +328 -0
  65. package/dist/errors/SuggestionEngine.js.map +1 -0
  66. package/dist/errors/index.d.ts +12 -0
  67. package/dist/errors/index.d.ts.map +1 -0
  68. package/dist/errors/index.js +39 -0
  69. package/dist/errors/index.js.map +1 -0
  70. package/dist/index.d.ts +3 -0
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +17 -1
  73. package/dist/index.js.map +1 -1
  74. package/dist/plugins/Plugin.d.ts +95 -0
  75. package/dist/plugins/Plugin.d.ts.map +1 -0
  76. package/dist/plugins/Plugin.js +3 -0
  77. package/dist/plugins/Plugin.js.map +1 -0
  78. package/dist/plugins/PluginManager.d.ts +73 -0
  79. package/dist/plugins/PluginManager.d.ts.map +1 -0
  80. package/dist/plugins/PluginManager.js +220 -0
  81. package/dist/plugins/PluginManager.js.map +1 -0
  82. package/dist/plugins/PluginRegistry.d.ts +122 -0
  83. package/dist/plugins/PluginRegistry.d.ts.map +1 -0
  84. package/dist/plugins/PluginRegistry.js +385 -0
  85. package/dist/plugins/PluginRegistry.js.map +1 -0
  86. package/dist/plugins/built-in/AuditPlugin.d.ts +81 -0
  87. package/dist/plugins/built-in/AuditPlugin.d.ts.map +1 -0
  88. package/dist/plugins/built-in/AuditPlugin.js +235 -0
  89. package/dist/plugins/built-in/AuditPlugin.js.map +1 -0
  90. package/dist/plugins/built-in/BackupPlugin.d.ts +38 -0
  91. package/dist/plugins/built-in/BackupPlugin.d.ts.map +1 -0
  92. package/dist/plugins/built-in/BackupPlugin.js +105 -0
  93. package/dist/plugins/built-in/BackupPlugin.js.map +1 -0
  94. package/dist/plugins/built-in/ValidationPlugin.d.ts +61 -0
  95. package/dist/plugins/built-in/ValidationPlugin.d.ts.map +1 -0
  96. package/dist/plugins/built-in/ValidationPlugin.js +235 -0
  97. package/dist/plugins/built-in/ValidationPlugin.js.map +1 -0
  98. package/dist/plugins/built-in/index.d.ts +7 -0
  99. package/dist/plugins/built-in/index.d.ts.map +1 -0
  100. package/dist/plugins/built-in/index.js +14 -0
  101. package/dist/plugins/built-in/index.js.map +1 -0
  102. package/dist/plugins/index.d.ts +5 -0
  103. package/dist/plugins/index.d.ts.map +1 -0
  104. package/dist/plugins/index.js +25 -0
  105. package/dist/plugins/index.js.map +1 -0
  106. package/dist/scripts/CLIGenerator.d.ts +109 -0
  107. package/dist/scripts/CLIGenerator.d.ts.map +1 -0
  108. package/dist/scripts/CLIGenerator.js +440 -0
  109. package/dist/scripts/CLIGenerator.js.map +1 -0
  110. package/dist/scripts/CLIUtils.d.ts +136 -0
  111. package/dist/scripts/CLIUtils.d.ts.map +1 -0
  112. package/dist/scripts/CLIUtils.js +361 -0
  113. package/dist/scripts/CLIUtils.js.map +1 -0
  114. package/dist/scripts/CommandBuilder.d.ts +72 -0
  115. package/dist/scripts/CommandBuilder.d.ts.map +1 -0
  116. package/dist/scripts/CommandBuilder.js +280 -0
  117. package/dist/scripts/CommandBuilder.js.map +1 -0
  118. package/dist/scripts/index.d.ts +23 -0
  119. package/dist/scripts/index.d.ts.map +1 -0
  120. package/dist/scripts/index.js +43 -0
  121. package/dist/scripts/index.js.map +1 -0
  122. package/dist/types/index.d.ts +3 -0
  123. package/dist/types/index.d.ts.map +1 -1
  124. package/package.json +1 -1
package/README.md CHANGED
@@ -781,9 +781,348 @@ const result = await converter.convert('./config.yml');
781
781
  await result.save('./config.json');
782
782
  ```
783
783
 
784
+ ### Example 9: Plugin System with Built-in Plugins
785
+
786
+ ```javascript
787
+ const {
788
+ forge,
789
+ createValidationPlugin,
790
+ createAuditPlugin,
791
+ createBackupPlugin,
792
+ } = require('configforge');
793
+
794
+ // Create converter with plugin support
795
+ const converter = forge()
796
+ .from('userForm')
797
+ .to('userProfile')
798
+ .map('personalInfo.firstName', 'firstName')
799
+ .map('personalInfo.lastName', 'lastName')
800
+ .map('personalInfo.email', 'email')
801
+ .map('accountInfo.username', 'username')
802
+ .merge(
803
+ ['personalInfo.firstName', 'personalInfo.lastName'],
804
+ 'fullName',
805
+ (first, last) => `${first} ${last}`
806
+ );
807
+
808
+ // Add built-in plugins
809
+ const validationPlugin = createValidationPlugin({
810
+ strictMode: true,
811
+ failOnWarnings: false,
812
+ });
813
+
814
+ const auditPlugin = createAuditPlugin({
815
+ logFile: './conversion-audit.log',
816
+ logLevel: 'detailed',
817
+ includeData: false,
818
+ });
819
+
820
+ const backupPlugin = createBackupPlugin({
821
+ backupDir: './backups',
822
+ keepVersions: 5,
823
+ timestampFormat: 'YYYY-MM-DD_HH-mm-ss',
824
+ });
825
+
826
+ // Install plugins
827
+ await converter.use(validationPlugin);
828
+ await converter.use(auditPlugin);
829
+ await converter.use(backupPlugin);
830
+
831
+ // Convert with plugin enhancements
832
+ const userData = {
833
+ personalInfo: {
834
+ firstName: 'John',
835
+ lastName: 'Doe',
836
+ email: 'john.doe@example.com',
837
+ },
838
+ accountInfo: {
839
+ username: 'johndoe123',
840
+ },
841
+ };
842
+
843
+ const result = await converter.convert(userData);
844
+
845
+ // Plugins automatically:
846
+ // - Validate data quality (ValidationPlugin)
847
+ // - Log conversion activities (AuditPlugin)
848
+ // - Create backups of source data (BackupPlugin)
849
+ // - Handle errors gracefully with detailed reporting
850
+
851
+ console.log(result.data);
852
+ // {
853
+ // firstName: 'John',
854
+ // lastName: 'Doe',
855
+ // email: 'john.doe@example.com',
856
+ // username: 'johndoe123',
857
+ // fullName: 'John Doe'
858
+ // }
859
+
860
+ // Check plugin results
861
+ console.log('Validation results:', result.context?.validationResults);
862
+ console.log('Backup created:', result.context?.backupPath);
863
+ ```
864
+
865
+ ### Example 10: Batch Processing and Performance Features
866
+
867
+ ```javascript
868
+ const {
869
+ forge,
870
+ BatchProcessor,
871
+ IncrementalProcessor,
872
+ PerformanceMonitor,
873
+ } = require('configforge');
874
+
875
+ // Create converter for processing multiple config files
876
+ const converter = forge()
877
+ .from('legacy-config')
878
+ .to('modern-config')
879
+ .map('app_name', 'application.name')
880
+ .map('app_version', 'application.version')
881
+ .map('database.host', 'db.hostname')
882
+ .map('database.port', 'db.port')
883
+ .map('server.port', 'application.port')
884
+ .defaults({
885
+ environment: 'production',
886
+ createdAt: () => new Date().toISOString(),
887
+ });
888
+
889
+ // 1. Batch Processing - Convert multiple files efficiently
890
+ const batchResult = await converter.convertBatch(
891
+ ['./configs/app1.yml', './configs/app2.yml', './configs/app3.yml'],
892
+ {
893
+ parallel: true,
894
+ workers: 3,
895
+ errorStrategy: 'continue',
896
+ progressCallback: progress => {
897
+ console.log(`Progress: ${progress.completed}/${progress.total} files`);
898
+ },
899
+ }
900
+ );
901
+
902
+ console.log(
903
+ `Processed ${batchResult.stats.successfulFiles} files successfully`
904
+ );
905
+ console.log(`Failed: ${batchResult.stats.failedFiles} files`);
906
+ console.log(`Total duration: ${batchResult.stats.totalDuration}ms`);
907
+
908
+ // 2. Incremental Processing - Only process changed files
909
+ const incrementalResult = await converter.convertIncremental(
910
+ './config.yml',
911
+ './output/config.json',
912
+ './.cache' // Cache directory
913
+ );
914
+
915
+ if (incrementalResult) {
916
+ console.log('File was processed (changed since last run)');
917
+ } else {
918
+ console.log('File skipped (no changes detected)');
919
+ }
920
+
921
+ // 3. Incremental Batch Processing
922
+ const incrementalBatchResult = await converter.convertIncrementalBatch(
923
+ ['./configs/app1.yml', './configs/app2.yml', './configs/app3.yml'],
924
+ './output',
925
+ {
926
+ cacheDir: './.cache',
927
+ getOutputPath: inputPath => {
928
+ const fileName = inputPath.split('/').pop().replace('.yml', '.json');
929
+ return `./output/${fileName}`;
930
+ },
931
+ }
932
+ );
933
+
934
+ console.log(`Processed: ${incrementalBatchResult.processed.length} files`);
935
+ console.log(
936
+ `Skipped: ${incrementalBatchResult.skipped.length} files (unchanged)`
937
+ );
938
+
939
+ // 4. Performance Monitoring
940
+ const monitor = new PerformanceMonitor();
941
+ monitor.start();
942
+
943
+ // Track individual steps
944
+ monitor.startStep('parse');
945
+ const result = await converter.convert('./large-config.yml');
946
+ monitor.endStep('parse');
947
+
948
+ // Record file sizes for throughput calculation
949
+ monitor.recordSizes(1024 * 1024, 800 * 1024); // 1MB input, 800KB output
950
+
951
+ // Get detailed performance metrics
952
+ const metrics = monitor.finish(result.stats);
953
+ const report = monitor.createReport(metrics);
954
+
955
+ console.log(report);
956
+ // === Performance Report ===
957
+ //
958
+ // Timing Breakdown:
959
+ // Parse: 15.23ms
960
+ // Map: 8.45ms
961
+ // Transform: 3.21ms
962
+ // Validate: 2.10ms
963
+ // Serialize: 5.67ms
964
+ // Total: 34.66ms
965
+ //
966
+ // Throughput:
967
+ // Fields/sec: 2890
968
+ // Transforms/sec: 1445
969
+ // Bytes/sec: 29.64 MB/s
970
+ //
971
+ // Memory Usage:
972
+ // Heap Used: 45.23 MB
973
+ // Heap Total: 67.89 MB
974
+ // RSS: 89.12 MB
975
+ //
976
+ // File Sizes:
977
+ // Input: 1.00 MB
978
+ // Output: 800.00 KB
979
+ // Ratio: 80.0%
980
+
981
+ // 5. Performance Benchmarking
982
+ const { PerformanceBenchmark } = require('configforge');
983
+
984
+ const sequentialOperation = async () => {
985
+ return converter.convertBatch(['./config1.yml', './config2.yml'], {
986
+ parallel: false,
987
+ });
988
+ };
989
+
990
+ const parallelOperation = async () => {
991
+ return converter.convertBatch(['./config1.yml', './config2.yml'], {
992
+ parallel: true,
993
+ workers: 2,
994
+ });
995
+ };
996
+
997
+ const benchmarks = [
998
+ { name: 'sequential-processing', operation: sequentialOperation },
999
+ { name: 'parallel-processing', operation: parallelOperation },
1000
+ ];
1001
+
1002
+ const benchmarkResults = await PerformanceBenchmark.compareBenchmarks(
1003
+ benchmarks,
1004
+ 10
1005
+ );
1006
+ const comparisonReport =
1007
+ PerformanceBenchmark.createComparisonReport(benchmarkResults);
1008
+
1009
+ console.log(comparisonReport);
1010
+ // === Benchmark Comparison ===
1011
+ //
1012
+ // Results (sorted by average time):
1013
+ // parallel-processing:
1014
+ // Average: 45.23ms (fastest)
1015
+ // Range: 42.10ms - 48.90ms
1016
+ // Std Dev: 2.15ms
1017
+ // Ops/sec: 22
1018
+ //
1019
+ // sequential-processing:
1020
+ // Average: 78.45ms (1.73x slower)
1021
+ // Range: 75.20ms - 82.10ms
1022
+ // Std Dev: 2.89ms
1023
+ // Ops/sec: 13
1024
+
1025
+ // 6. Advanced Batch Processing with Custom Options
1026
+ const advancedBatchResult = await converter.convertBatch(
1027
+ [
1028
+ './configs/*.yml', // Glob patterns supported
1029
+ ],
1030
+ {
1031
+ parallel: true,
1032
+ workers: 4,
1033
+ errorStrategy: 'fail-fast', // Stop on first error
1034
+ progressCallback: progress => {
1035
+ const percentage = Math.round(
1036
+ (progress.completed / progress.total) * 100
1037
+ );
1038
+ console.log(`[${percentage}%] Processing: ${progress.current}`);
1039
+ if (progress.failed > 0) {
1040
+ console.log(`⚠️ ${progress.failed} files failed`);
1041
+ }
1042
+ },
1043
+ }
1044
+ );
1045
+
1046
+ // Save all results to output directory
1047
+ const batchProcessor = new BatchProcessor(converter);
1048
+ await batchProcessor.saveBatch(advancedBatchResult.results, './output', [
1049
+ './configs/app1.yml',
1050
+ './configs/app2.yml',
1051
+ ]);
1052
+
1053
+ // 7. Cache Management for Incremental Processing
1054
+ const incrementalProcessor = new IncrementalProcessor(converter, './.cache');
1055
+
1056
+ // Get cache statistics
1057
+ const cacheStats = incrementalProcessor.getCacheStats();
1058
+ console.log(`Cache entries: ${cacheStats.totalEntries}`);
1059
+ console.log(`Successful: ${cacheStats.successfulEntries}`);
1060
+ console.log(`Failed: ${cacheStats.failedEntries}`);
1061
+
1062
+ // Clean up stale cache entries
1063
+ const removedEntries = await incrementalProcessor.cleanupCache();
1064
+ console.log(`Removed ${removedEntries} stale cache entries`);
1065
+
1066
+ // Clear entire cache
1067
+ await incrementalProcessor.clearCache();
1068
+ console.log('Cache cleared');
1069
+ ```
1070
+
1071
+ ### Example 11: CLI Generation System
1072
+
1073
+ ```javascript
1074
+ const { forge, CLIGenerator } = require('configforge');
1075
+
1076
+ // Create your converter
1077
+ const converter = forge()
1078
+ .from('legacy')
1079
+ .to('modern')
1080
+ .map('app_name', 'name')
1081
+ .map('app_version', 'version')
1082
+ .map('database.host', 'db.hostname')
1083
+ .map('database.port', 'db.port')
1084
+ .defaults({
1085
+ environment: 'production',
1086
+ });
1087
+
1088
+ // Generate CLI for your converter
1089
+ const cli = CLIGenerator.forConverter(converter, {
1090
+ name: 'config-converter',
1091
+ version: '1.0.0',
1092
+ description: 'Convert legacy config to modern format',
1093
+ });
1094
+
1095
+ // Add custom commands
1096
+ cli.addCommand({
1097
+ name: 'migrate',
1098
+ description: 'Migrate all configs in a directory',
1099
+ options: [
1100
+ {
1101
+ flags: '-d, --directory <dir>',
1102
+ description: 'Directory containing config files',
1103
+ },
1104
+ ],
1105
+ action: async options => {
1106
+ // Custom migration logic
1107
+ console.log(`Migrating configs in ${options.directory}`);
1108
+ },
1109
+ });
1110
+
1111
+ // Parse command line arguments
1112
+ cli.parse();
1113
+
1114
+ // Now you can use your CLI:
1115
+ // $ config-converter convert input.yml output.json
1116
+ // $ config-converter validate config.yml
1117
+ // $ config-converter profile save my-config
1118
+ // $ config-converter profile list
1119
+ // $ config-converter migrate -d ./configs
1120
+ ```
1121
+
784
1122
  ## 🎯 Key Features
785
1123
 
786
1124
  - ✅ **Simple API**: Just map fields and convert
1125
+ - ✅ **Pipeline Architecture**: Robust internal processing with configurable steps and error handling
787
1126
  - ✅ **No direct Mapper usage needed**: The `convert()` method handles everything
788
1127
  - ✅ **Nested object support**: Use dot notation like `user.profile.name`
789
1128
  - ✅ **Array access**: Use bracket notation like `items[0]`
@@ -791,6 +1130,12 @@ await result.save('./config.json');
791
1130
  - ✅ **Conditional mapping**: Use `when()` for conditional logic
792
1131
  - ✅ **Multi-field merging**: Use `merge()` to combine multiple sources into one target
793
1132
  - ✅ **Default values**: Set fallback values
1133
+ - ✅ **Comprehensive Error Handling**: Advanced error reporting with context and suggestions ⭐ ENHANCED!
1134
+ - ✅ **CLI Generation System**: Create command-line interfaces for converters ⭐ ENHANCED!
1135
+ - ✅ **Plugin System**: Extensible architecture with built-in plugins for validation, auditing, and backups ⭐ ENHANCED!
1136
+ - ✅ **Batch Processing**: Efficiently process multiple files with parallel support and progress tracking ⭐ ENHANCED!
1137
+ - ✅ **Incremental Processing**: Only process changed files using content hashing and modification times ⭐ ENHANCED!
1138
+ - ✅ **Performance Monitoring**: Detailed performance tracking, benchmarking, and reporting ⭐ ENHANCED!
794
1139
  - ✅ **File support**: Convert YAML, JSON files directly
795
1140
  - ✅ **Statistics**: Get detailed conversion reports
796
1141
  - ✅ **TypeScript**: Full type safety
@@ -808,14 +1153,19 @@ await result.save('./config.json');
808
1153
  - **Multi-field merging with `merge()`**
809
1154
  - **Field validation with `validate()`**
810
1155
  - **Lifecycle hooks with `before()` and `after()`** ⭐ NEW!
1156
+ - **Advanced error handling and reporting system** ⭐ NEW!
1157
+ - **CLI generation system with command-line interfaces** ⭐ ENHANCED!
1158
+ - **Plugin system foundation with built-in plugins** ⭐ NEW!
1159
+ - **Batch processing with parallel support and progress tracking** ⭐ ENHANCED!
1160
+ - **Incremental processing with content hashing and modification times** ⭐ ENHANCED!
1161
+ - **Performance monitoring with detailed benchmarking and reporting** ⭐ ENHANCED!
811
1162
  - File parsing (YAML, JSON)
812
1163
  - Conversion statistics and reporting
813
1164
  - Async and sync conversion support
814
1165
 
815
1166
  **🚧 Coming Soon:**
816
1167
 
817
- - CLI generation
818
- - Plugin system
1168
+ - Advanced plugin ecosystem
819
1169
 
820
1170
  ## 💡 Tips
821
1171
 
@@ -837,6 +1187,25 @@ await result.save('./config.json');
837
1187
  16. **Use `after()` hooks** to postprocess target data after conversion
838
1188
  17. **Hooks can be async** - just use `async (data) => { ... }` and they'll be awaited
839
1189
  18. **Multiple hooks execute in order** - add as many as you need for complex workflows
1190
+ 19. **Error handling provides helpful suggestions** - when field mapping fails, you'll get suggestions for similar field names
1191
+ 20. **Errors include rich context** - see exactly where and why conversions failed with detailed error information
1192
+ 21. **Use error categories** to filter and handle different types of errors (validation, mapping, parsing, etc.)
1193
+ 22. **Create CLIs for converters** - use `CLIGenerator.forConverter(converter)` to generate command-line interfaces
1194
+ 23. **Use CLI profiles** - save converter configurations as profiles for reuse: `cli profile save my-converter`
1195
+ 24. **CLI supports batch processing** - convert multiple files at once with pattern matching and parallel processing
1196
+ 25. **Use built-in plugins** - leverage ValidationPlugin, AuditPlugin, and BackupPlugin for enhanced functionality
1197
+ 26. **Plugin hooks execute in order** - plugins can intercept and modify data at different conversion stages
1198
+ 27. **Error hooks provide recovery** - plugins can handle errors gracefully and provide fallback behavior
1199
+ 28. **Use batch processing for multiple files** - `convertBatch()` processes multiple files efficiently with parallel support
1200
+ 29. **Enable parallel processing** - set `parallel: true` and configure `workers` for faster batch processing
1201
+ 30. **Use incremental processing** - `convertIncremental()` only processes files that have changed since last run
1202
+ 31. **Monitor performance** - use `PerformanceMonitor` to track conversion speed, memory usage, and throughput
1203
+ 32. **Benchmark different approaches** - use `PerformanceBenchmark` to compare sequential vs parallel processing
1204
+ 33. **Configure error strategies** - use `errorStrategy: 'continue'` to process all files even if some fail, or `'fail-fast'` to stop on first error
1205
+ 34. **Track progress** - provide `progressCallback` to monitor batch processing progress in real-time
1206
+ 35. **Cache management** - use `IncrementalProcessor.getCacheStats()` and `cleanupCache()` to manage incremental processing cache
1207
+ 36. **Save batch results** - use `BatchProcessor.saveBatch()` to save all conversion results to an output directory
1208
+ 37. **Use forge() with options** - pass `ForgeOptions` to `forge({ strict: true, parallel: true })` to configure converter behavior globally
840
1209
 
841
1210
  ---
842
1211
 
@@ -0,0 +1,48 @@
1
+ import { BatchOptions, BatchProgress, BatchResult, ConversionResult } from '../types';
2
+ import { Converter } from './Converter';
3
+ /**
4
+ * BatchProcessor handles efficient processing of multiple files
5
+ * with parallel processing support and progress tracking
6
+ */
7
+ export declare class BatchProcessor {
8
+ private converter;
9
+ private options;
10
+ constructor(converter: Converter, options?: BatchOptions);
11
+ /**
12
+ * Process multiple files efficiently
13
+ */
14
+ process(inputs: string[]): Promise<BatchResult>;
15
+ /**
16
+ * Process files sequentially
17
+ */
18
+ private processSequentially;
19
+ /**
20
+ * Process files in parallel using worker threads or Promise.all
21
+ */
22
+ private processInParallel;
23
+ /**
24
+ * Process a single file
25
+ */
26
+ private processFile;
27
+ /**
28
+ * Create an empty batch result
29
+ */
30
+ private createEmptyResult;
31
+ /**
32
+ * Split array into chunks
33
+ */
34
+ private chunkArray;
35
+ /**
36
+ * Save batch results to files
37
+ */
38
+ saveBatch(results: ConversionResult[], outputDir: string, inputPaths: string[]): Promise<void>;
39
+ /**
40
+ * Generate a progress report
41
+ */
42
+ generateProgressReport(progress: BatchProgress): string;
43
+ /**
44
+ * Create a simple progress bar
45
+ */
46
+ private createProgressBar;
47
+ }
48
+ //# sourceMappingURL=BatchProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BatchProcessor.d.ts","sourceRoot":"","sources":["../../src/core/BatchProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,WAAW,EAEX,gBAAgB,EAGjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAAyB;gBAE5B,SAAS,EAAE,SAAS,EAAE,OAAO,GAAE,YAAiB;IAU5D;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAyDrD;;OAEG;YACW,mBAAmB;IA2CjC;;OAEG;YACW,iBAAiB;IA4E/B;;OAEG;YACW,WAAW;IAwCzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;OAEG;IACH,OAAO,CAAC,UAAU;IAQlB;;OAEG;IACG,SAAS,CACb,OAAO,EAAE,gBAAgB,EAAE,EAC3B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,IAAI,CAAC;IAyBhB;;OAEG;IACH,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM;IAcvD;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAK1B"}