@@ -2,15 +2,19 @@ import { getOptions as getCLIOptions } from 'codemod-cli';
22import fs from 'node:fs' ;
33import path from 'node:path' ;
44import { ZodError , ZodType , z } from 'zod' ;
5- import { Telemetry , getTelemetry } from './telemetry ' ;
5+ import Resolver , { RuntimeResolver } from './resolver ' ;
66
77export interface Options {
8- customHelpers : string [ ] ,
9- telemetry : Telemetry
8+ customHelpers : string [ ] ;
9+ resolver : Resolver ;
1010}
1111
1212const CLIOptions = z . object ( {
1313 config : z . string ( ) . optional ( ) ,
14+ // FIXME: Defaulting to 'runtime' isn't quite correct
15+ telemetry : z . union ( [ z . literal ( 'runtime' ) , z . literal ( 'embroider' ) ] ) . default ( 'runtime' ) ,
16+ // FIXME: Optionally allow angle-bracket conversion for components
17+ // FIXME: Optionally add parens for helpers
1418} ) ;
1519
1620type CLIOptions = z . infer < typeof CLIOptions > ;
@@ -29,7 +33,8 @@ export function getOptions(): Options {
2933 const cliOptions = parse ( getCLIOptions ( ) , CLIOptions ) ;
3034 return {
3135 customHelpers : getCustomHelpersFromConfig ( cliOptions . config ) ,
32- telemetry : getTelemetry ( ) ,
36+ resolver :
37+ cliOptions . telemetry === 'runtime' ? RuntimeResolver . build ( ) : ( null as unknown as Resolver ) ,
3338 } ;
3439}
3540
0 commit comments