File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "name" : " @mattvr/dgen" ,
3+ "version" : " 0.0.2" ,
4+ "exports" : " ./mod.ts"
5+ }
Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ import { Filter } from "https://deno.land/x/vento@v0.12.1/src/environment.ts";
33import { parse as parseJsonc } from "https://deno.land/std@0.212.0/jsonc/parse.ts" ;
44import { parseArgs } from "https://deno.land/std@0.212.0/cli/parse_args.ts" ;
55
6- type CodegenArgs = {
6+ /**
7+ * Arguments object to pass to the codegen(...) function.
8+ */
9+ export type CodegenArgs = {
710 /**
811 * Full path to the template file (vento .vto template)
912 */
@@ -74,7 +77,10 @@ type CodegenArgs = {
7477 error ?: ( err : Error ) => void ;
7578}
7679
77- const DEFAULT_ARGS : Partial < CodegenArgs > = {
80+ /**
81+ * Default arguments for codegen(...) function
82+ */
83+ export const DEFAULT_ARGS : Partial < CodegenArgs > = {
7884 templateVtoPath : "template.vto" ,
7985 filters : {
8086 upper : ( str : string ) => str . toUpperCase ( ) ,
@@ -89,6 +95,11 @@ const DEFAULT_ARGS: Partial<CodegenArgs> = {
8995 flags : [ 'fmt' , 'check' , 'print_info' ] ,
9096} ;
9197
98+ /**
99+ * Generate code from a Vento template and optional processor file
100+ * @param args Arguments object to pass to the code
101+ * @returns Generated code as a string
102+ */
92103export const codegen = async ( args : CodegenArgs ) : Promise < string > => {
93104 const startTime = performance . now ( ) ;
94105 const {
You can’t perform that action at this time.
0 commit comments