https://github.com/codevideo/codevideo-dynamic-ast
Dynamically identify and statically analyze an arbitrary amount of source code files of any programming language.
https://github.com/codevideo/codevideo-dynamic-ast
Last synced: about 1 year ago
JSON representation
Dynamically identify and statically analyze an arbitrary amount of source code files of any programming language.
- Host: GitHub
- URL: https://github.com/codevideo/codevideo-dynamic-ast
- Owner: codevideo
- License: mit
- Created: 2024-11-06T21:19:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-24T11:18:27.000Z (about 1 year ago)
- Last Synced: 2025-03-24T12:31:33.706Z (about 1 year ago)
- Language: TypeScript
- Size: 116 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `codevideo-dynamic-ast`
Parse and validate code from multiple programming languages using their native compilers - all through a single unified interface.
## Installation
```bash
npm install codevideo-dynamic-ast
```
## Usage
Provide an array of one or more `IFileSource` objects and get an array of `ICompileResult` back.
```typescript
import { IFileSource, ICompileResult } from '@fullstackcraftllc/codevideo-types';
import { parseProject } from '@fullstackcraftllc/codevideo-dynamic-ast';
const files: Array = [
{ path: 'src/index.ts', content: '...' },
{ path: 'src/utils/someutil.ts', content: '...' },
{ path: 'src/components/MyComponent.tsx', content: '...' }
];
const results: Array = await compileProject(files);
console.log(results);
// Output:
// {
// "projects": [
// {
// "language": "TypeScript"
// "errors": [{
// "file": "src/index.ts",
// "message": "..."
// "line": 1,
// "column": 1,
// "code": "2339"
// }],
// },
// ]
// }
```
## Supported Languages
- TypeScript (using ts-morph)
- C# (using dotnet CLI)
- Go (using go CLI)
## Requirements
- Node.js >= 16
- TypeScript >= 4.0.0
- For C# parsing: .NET SDK
- For Go parsing: Go toolchain
## Development
Install dependencies:
```bash
npm install
```
Build:
```bash
npm run build
```
Test:
```
npm test
```