Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Dynamically identify and statically analyze an arbitrary amount of source code files of any programming language.

License

Notifications You must be signed in to change notification settings

codevideo/codevideo-dynamic-ast

Repository files navigation

codevideo-dynamic-ast

Parse and validate code from multiple programming languages using their native compilers - all through a single unified interface.

Installation

npm install codevideo-dynamic-ast

Usage

Provide an array of one or more IFileSource objects and get an array of ICompileResult back.

import { IFileSource, ICompileResult } from '@fullstackcraftllc/codevideo-types';
import { parseProject } from '@fullstackcraftllc/codevideo-dynamic-ast';

const files: Array<IFileSource> = [
    { path: 'src/index.ts', content: '...' },
    { path: 'src/utils/someutil.ts', content: '...' },
    { path: 'src/components/MyComponent.tsx', content: '...' }
];

const results: Array<ICompileResult> = 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:

npm install

Build:

npm run build

Test:

npm test

About

Dynamically identify and statically analyze an arbitrary amount of source code files of any programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published