Skip to content
/ plutonio Public

Plutonio is a TypeScript library that statically analyzes your codebase and generates a complete schema of all types and interfaces, including properties, inheritance, and import metadata. Suitable for static analysis, tooling, and code introspection.

Notifications You must be signed in to change notification settings

x71c9/plutonio

Repository files navigation

Plutonio

Plutonio is a Typescript library that scans your typescript project and generate a schema of all types and interfaces of the project.

The schema is the following:

type Schema = {
    name: string;
    category: Category;
    type: Primitive;
    original?: string;
    enum?: string[];
    imports: Import[];
    properties?: {
        [k:string]: Schema
    }
};

type Category = 'type' | 'interface';

type Primitive =
  | 'any';
  | 'boolean'
  | 'null'
  | 'number'
  | 'object'
  | 'string'
  | 'undefined'

An example of a schema is the following:

const schema = {
    name: 'Product',
    category: 'interface',
    type: 'object',
    original: 'export interface Product extends Foo.Boo {title: string, price: number}',
    properties: {
        title: {
            type: 'string',
        },
        price: {
            type: 'number',
        },
    },
    imports: [
        {
            text: 'import Foo from "foo"',
            module: 'foo',
            clause: 'Foo',
            specifiers: [],
        },
    ],
},
};

About

Plutonio is a TypeScript library that statically analyzes your codebase and generates a complete schema of all types and interfaces, including properties, inheritance, and import metadata. Suitable for static analysis, tooling, and code introspection.

Resources

Stars

Watchers

Forks

Packages

No packages published