Skip to content

Commit 2315f5c

Browse files
committed
export types
1 parent b2ed27a commit 2315f5c

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

deno.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "@mattvr/dgen",
3+
"version": "0.0.2",
4+
"exports": "./mod.ts"
5+
}

mod.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { Filter } from "https://deno.land/x/vento@v0.12.1/src/environment.ts";
33
import { parse as parseJsonc } from "https://deno.land/std@0.212.0/jsonc/parse.ts";
44
import { 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+
*/
92103
export const codegen = async (args: CodegenArgs): Promise<string> => {
93104
const startTime = performance.now();
94105
const {

0 commit comments

Comments
 (0)