@xelth/eck-snapshot 6.5.1 → 6.7.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.
@@ -207,6 +207,8 @@ async function getProjectDetails(projectPath, type) {
207
207
  return await getGoDetails(projectPath);
208
208
  case 'dotnet':
209
209
  return await getDotnetDetails(projectPath);
210
+ case 'esp-idf':
211
+ return await getEspIdfDetails(projectPath);
210
212
  default:
211
213
  return details;
212
214
  }
@@ -641,6 +643,64 @@ async function getDotnetDetails(projectPath) {
641
643
  return details;
642
644
  }
643
645
 
646
+ async function getEspIdfDetails(projectPath) {
647
+ const details = { type: 'esp-idf' };
648
+
649
+ try {
650
+ const cmakePath = path.join(projectPath, 'CMakeLists.txt');
651
+ if (await fileExists(cmakePath)) {
652
+ const cmakeContent = await fs.readFile(cmakePath, 'utf-8');
653
+ const projectMatch = cmakeContent.match(/project\((\w+)/);
654
+ if (projectMatch) details.projectName = projectMatch[1];
655
+ const idfPathMatch = cmakeContent.includes('IDF_PATH');
656
+ if (idfPathMatch) details.usesIdfPath = true;
657
+ }
658
+
659
+ const sdkDefaultsPath = path.join(projectPath, 'sdkconfig.defaults');
660
+ if (await fileExists(sdkDefaultsPath)) {
661
+ const sdkContent = await fs.readFile(sdkDefaultsPath, 'utf-8');
662
+ const chipMatch = sdkContent.match(/CONFIG_IDF_TARGET="(\w+)"/);
663
+ if (chipMatch) details.targetChip = chipMatch[1];
664
+ const flashSizeMatch = sdkContent.match(/CONFIG_ESPTOOLPY_FLASHSIZE_(\w+)/);
665
+ if (flashSizeMatch) details.flashSize = flashSizeMatch[1];
666
+ }
667
+
668
+ const componentYmlPath = path.join(projectPath, 'main', 'idf_component.yml');
669
+ if (await fileExists(componentYmlPath)) {
670
+ details.hasComponentManifest = true;
671
+ try {
672
+ const ymlContent = await fs.readFile(componentYmlPath, 'utf-8');
673
+ const deps = [];
674
+ const depMatches = ymlContent.matchAll(/^\s{2}(\S+):/gm);
675
+ for (const m of depMatches) {
676
+ if (m[1] !== 'version') deps.push(m[1]);
677
+ }
678
+ if (deps.length > 0) details.dependencies = deps;
679
+ } catch {}
680
+ }
681
+
682
+ const partitionsPath = path.join(projectPath, 'partitions.csv');
683
+ if (await fileExists(partitionsPath)) {
684
+ details.hasPartitions = true;
685
+ }
686
+
687
+ const mainDir = path.join(projectPath, 'main');
688
+ if (await directoryExists(mainDir)) {
689
+ try {
690
+ const mainFiles = await fs.readdir(mainDir);
691
+ details.mainFiles = mainFiles.filter(f =>
692
+ f.endsWith('.c') || f.endsWith('.h') || f.endsWith('.cpp')
693
+ );
694
+ } catch {}
695
+ }
696
+
697
+ } catch (error) {
698
+ console.warn('Error getting ESP-IDF project details:', error.message);
699
+ }
700
+
701
+ return details;
702
+ }
703
+
644
704
  // Utility functions
645
705
  async function fileExists(filePath) {
646
706
  try {