@tripsnek/tmf
Version:
TypeScript Modeling Framework - A TypeScript port of the Eclipse Modeling Framework (EMF)
89 lines • 3.13 kB
TypeScript
import { EPackage } from '../metamodel/api/epackage.js';
import { EClass } from '../metamodel/api/eclass.js';
/**
* Exposes source code generation. Only available in Node.js environment.
* @param pkg
* @param outDir
* @param overwriteImpl
*/
export declare function generate(pkg: EPackage, outDir: string, overwriteImpl: boolean): Promise<void>;
/**
* Generates TypeScript source code for an EPackage and all subpackages, including
* the following artifacts:
* (1) *-package.ts for each EPackage (see TMFPackageSourceGenerator.ts)
* (2) *-factory.ts for each EPackage (see TMFFactorySourceGenerator.ts)
* (3) API interfaces (see TMFApiSourceGenerator.ts)
* (4) Abstract *Gen.ts classes (see TMFGenSourceGenerator.ts)
* (5) Overwritable *Impl.ts classes (see TMFImplSourceGenerator.ts)
* (6) Enums (see TMFEnumSourceGenerator.ts)
*/
export declare class TGeneratorMain {
pkg: EPackage;
outDir: string;
overwriteImpl: boolean;
barrelFileDir?: string | undefined;
barrelFileOutDir: string;
pkgOutDir: string;
pkgRootOutDir: string;
pkgApiOutDir: string;
pkgGenOutDir: string;
pkgImplOutDir: string;
private eClassApiImports;
private eClassGenImports;
private eClassPkgImports;
private fs;
private path;
private childProcess;
constructor(pkg: EPackage, outDir: string, overwriteImpl?: boolean, barrelFileDir?: string | undefined);
/**
* Generates typescript sourcecode for all packages, recursing all subpackages.
* Only available in Node.js environment.
*/
generate(attemptFormatWithPrettier?: boolean): Promise<void>;
generateAllEClassArtifacts(eClassifier: EClass): Promise<void>;
/**
* Check if code generation is supported in current environment
*/
static isGenerationSupported(): boolean;
/**
* Get list of supported operations in current environment
*/
static getSupportedOperations(): string[];
private ensureNodeModulesLoaded;
private initializeDirectories;
private writeBarrelFile;
private writePackageFile;
private writeFactoryFile;
private writeUtilsFile;
private setupEClassImports;
private writeEClassApiFile;
private writeEClassGenFile;
private writeEClassImplFile;
private writeEnumFile;
private resolveAndMaybeCreateDir;
/**
* Traverses entire EClass structure and collects the set of types that need
* to be imported, including API, Gen and EPackage instances.
*/
private collectEClassImports;
private eopsToImplement;
/**
* Possibly adds the type and package of 'etype' to the list of things
* to import.
*/
private maybeAddMemberImports;
private writePackageInitializerFile;
private writePackageRegistryFile;
private generatePackageRegistryContent;
/**
* Writes the sourcecode file to the file system.
* @param outDir
* @param filename
* @param content
* @param overwrite
*/
private writeSourceFile;
private deleteFilesInFolder;
private tryFormatWithPrettier;
}
//# sourceMappingURL=tgenerator-main.d.ts.map