forked from Handit-AI/handit-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-parse.js
More file actions
28 lines (23 loc) · 786 Bytes
/
Copy pathtest-parse.js
File metadata and controls
28 lines (23 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const { parse } = require('@babel/parser');
const fs = require('fs');
async function testParse() {
try {
console.log('Testing parsing of server.js...');
const content = await fs.readFile('server.js', 'utf8');
const ast = parse(content, {
sourceType: 'module',
plugins: ['jsx', 'typescript'],
allowImportExportEverywhere: true,
allowReturnOutsideFunction: true,
allowAwaitOutsideFunction: true,
errorRecovery: true
});
console.log('✅ Parsing successful!');
console.log('AST type:', ast.type);
console.log('Number of statements:', ast.program.body.length);
} catch (error) {
console.error('❌ Parsing failed:', error.message);
console.error('Error details:', error.stack);
}
}
testParse();