create-fhevm-playground-pro 1.0.20 → 1.0.21

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/dist/scaffolder.js +11 -4
  2. package/package.json +1 -1
@@ -82,11 +82,18 @@ async function createExample(options) {
82
82
  let content = fs_extra_1.default.readFileSync(srcPath, 'utf-8');
83
83
  // Fix import paths in test files
84
84
  content = content.replace(/import\s+{([^}]+)}\s+from\s+"\.\.\/\.\.\/\.\.\/\.\.\/scripts\/test-helpers"/, 'import { $1 } from "./test-helpers.js"');
85
- // Only convert to .js if it's a .ts file - remove type annotations
85
+ // Only convert to .js if it's a .ts file - remove type annotations carefully
86
86
  if (file.endsWith('.ts')) {
87
- // Remove ": Type" patterns for variable declarations
88
- // This regex matches "variable: TypeAnnotation" patterns
89
- content = content.replace(/([a-zA-Z_$]\w*)\s*:\s*(?:any|void|string|number|boolean|object|{[^}]*}|[A-Za-z_$][A-Za-z0-9_$<>\[\]|&\s]*)/g, '$1');
87
+ // Remove ": TypeAnnotation" patterns but be very specific:
88
+ // Match ": " followed by type patterns (capitalized names, generics, etc.)
89
+ // Use negative lookbehind to avoid matching destructuring patterns like { name: value }
90
+ // Actually, simpler approach: only match patterns clearly TypeScript
91
+ // Pattern: ": " followed by word starting with capital or keywords
92
+ content = content.replace(/:\s*(any|void|string|number|boolean|object|never|unknown|keyof|readonly)\b/g, '');
93
+ // Also match capitalized type names
94
+ content = content.replace(/:\s*([A-Z][A-Za-z0-9_$<>\[\]|&\s]*?)(?=[,}\)\n=;])/g, '');
95
+ // Remove function return type annotations like ": Promise<void>"
96
+ content = content.replace(/\)\s*:\s*([A-Z][A-Za-z0-9_$<>\[\]|&\s]*?)\s*{/g, ') {');
90
97
  }
91
98
  fs_extra_1.default.writeFileSync(finalDestPath, content);
92
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fhevm-playground-pro",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Premium scaffolding CLI for fhEVM Playground Pro – Zama bounty",
5
5
  "main": "dist/create-example.js",
6
6
  "bin": {