devbonzai 1.6.9 → 1.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.
Files changed (2) hide show
  1. package/cli.js +30 -3
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -382,6 +382,11 @@ function extractJavaScriptFunctions(filePath) {
382
382
  return { functions: [], classes: [] };
383
383
  }
384
384
 
385
+ // Skip .d.ts files, minified files, and node_modules
386
+ if (filePath.endsWith('.d.ts') || filePath.endsWith('.min.js') || filePath.includes('node_modules')) {
387
+ return { functions: [], classes: [] };
388
+ }
389
+
385
390
  const content = fs.readFileSync(filePath, 'utf8');
386
391
  const functions = [];
387
392
  const classes = [];
@@ -534,7 +539,18 @@ function extractJavaScriptFunctions(filePath) {
534
539
 
535
540
  traverse(ast);
536
541
  } catch (parseError) {
537
- console.warn('Failed to parse JavaScript/TypeScript file:', filePath, parseError.message);
542
+ // Silently skip parsing errors - these are expected for some files
543
+ // Only log if it's not in node_modules or a known problematic file type
544
+ if (!filePath.includes('node_modules') && !filePath.endsWith('.d.ts') && !filePath.endsWith('.min.js')) {
545
+ // Suppress warnings for common parsing issues
546
+ const errorMsg = parseError.message || '';
547
+ if (!errorMsg.includes('outside of function') &&
548
+ !errorMsg.includes('Missing initializer') &&
549
+ !errorMsg.includes('Export') &&
550
+ !errorMsg.includes('Unexpected token')) {
551
+ // Only log unexpected errors
552
+ }
553
+ }
538
554
  return { functions: [], classes: [] };
539
555
  }
540
556
 
@@ -708,7 +724,7 @@ function extractVueFunctions(filePath) {
708
724
 
709
725
  traverse(ast);
710
726
  } catch (parseError) {
711
- console.warn('Failed to parse Vue script:', filePath, parseError.message);
727
+ // Silently skip parsing errors for Vue files
712
728
  return { functions: [], classes: [] };
713
729
  }
714
730
 
@@ -739,11 +755,20 @@ function listAllFiles(dir, base = '', ignorePatterns = null) {
739
755
 
740
756
  const stat = fs.statSync(fullPath);
741
757
  if (stat && stat.isDirectory()) {
758
+ // Skip node_modules directories explicitly
759
+ if (file === 'node_modules' || relativePath.includes('node_modules/')) {
760
+ continue;
761
+ }
742
762
  // Add the directory itself to results
743
763
  results.push(relativePath + '/');
744
764
  // Recursively list files inside the directory
745
765
  results = results.concat(listAllFiles(fullPath, relativePath, ignorePatterns));
746
766
  } else {
767
+ // Skip files in node_modules explicitly
768
+ if (relativePath.includes('node_modules/') || fullPath.includes('node_modules')) {
769
+ continue;
770
+ }
771
+
747
772
  results.push(relativePath);
748
773
 
749
774
  // Helper function to add functions, classes, and methods as virtual files
@@ -778,7 +803,9 @@ function listAllFiles(dir, base = '', ignorePatterns = null) {
778
803
  }
779
804
 
780
805
  // Handle JavaScript/TypeScript files
781
- if (file.endsWith('.js') || file.endsWith('.jsx') || file.endsWith('.ts') || file.endsWith('.tsx')) {
806
+ // Skip .d.ts files (TypeScript declaration files) and .min.js files (minified)
807
+ if ((file.endsWith('.js') || file.endsWith('.jsx') || file.endsWith('.ts') || file.endsWith('.tsx')) &&
808
+ !file.endsWith('.d.ts') && !file.endsWith('.min.js')) {
782
809
  const parseResult = extractJavaScriptFunctions(fullPath);
783
810
  addVirtualFiles(parseResult, relativePath);
784
811
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devbonzai",
3
- "version": "1.6.9",
3
+ "version": "1.7.0",
4
4
  "description": "Quickly set up a local file server in any repository for browser-based file access",
5
5
  "main": "cli.js",
6
6
  "bin": {