fix: improve export validation to handle destructured exports

- Enhanced validate_exports.js to detect both named exports (export const/function/etc) and destructured exports (export { name1, name2 })
- Fixes validation error that was incorrectly reporting missing exports
- All CI checks now pass successfully

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Russell Ballestrini 2025-07-03 18:07:52 -04:00
parent ba5049ebfb
commit 185d57092b

View file

@ -27,13 +27,31 @@ async function validateExports() {
for (const file of jsFiles) {
const content = await fs.readFile(path.join(srcDir, file), 'utf-8');
// Extract exports (including generator functions)
const exportMatches = content.match(/export\s+(?:async\s+)?(?:function\*?|const|let|var|class)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g);
if (exportMatches) {
const exports = exportMatches.map(match => {
// Extract exports (including generator functions and destructured exports)
const exports = [];
// Match named exports: export function/const/let/var/class
const namedExportMatches = content.match(/export\s+(?:async\s+)?(?:function\*?|const|let|var|class)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g);
if (namedExportMatches) {
namedExportMatches.forEach(match => {
const parts = match.split(/\s+/);
return parts[parts.length - 1];
exports.push(parts[parts.length - 1]);
});
}
// Match destructured exports: export { name1, name2 }
const destructuredExportMatches = content.match(/export\s*{\s*([^}]+)\s*}/g);
if (destructuredExportMatches) {
destructuredExportMatches.forEach(match => {
const namesMatch = match.match(/export\s*{\s*([^}]+)\s*}/);
if (namesMatch) {
const names = namesMatch[1].split(',').map(name => name.trim().split(/\s+as\s+/)[0].trim());
exports.push(...names);
}
});
}
if (exports.length > 0) {
exportMap.set(file, exports);
}