@algorandfoundation/puya-ts 1.0.0-beta.13 → 1.0.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","sources":["../src/compile-options.ts","../src/logger/sinks/console-log-sink.ts","../src/cli.ts"],"sourcesContent":["import { globSync } from 'glob'\nimport * as fs from 'node:fs'\nimport upath from 'upath'\nimport { PuyaError } from './errors'\nimport type { LogLevel } from './logger'\nimport { logger } from './logger'\nimport { normalisePath } from './util'\n\nexport interface AlgoFile {\n matchedInput: string\n sourceFile: string\n outDir: string\n}\n\nexport interface CompileOptions {\n filePaths: AlgoFile[]\n logLevel: LogLevel\n outputAwst: boolean\n outputAwstJson: boolean\n /*\n Don't generate artifacts for puya, or invoke puya\n */\n dryRun: boolean\n\n getFileFromSource(sourceFile: string): AlgoFile | undefined\n}\n\nexport const buildCompileOptions = ({\n paths,\n workingDirectory = process.cwd(),\n outDir,\n ...rest\n}: {\n paths: string[]\n outputAwst: boolean\n outDir: string\n outputAwstJson: boolean\n workingDirectory?: string\n dryRun: boolean\n logLevel: LogLevel\n}): CompileOptions => {\n const filePaths: AlgoFile[] = []\n\n for (const p of paths) {\n if (p.endsWith('.algo.ts')) {\n if (fs.existsSync(p)) {\n const actualPath = normalisePath(p, workingDirectory)\n\n filePaths.push({\n matchedInput: p,\n sourceFile: actualPath,\n outDir: upath.isAbsolute(outDir) ? upath.normalize(outDir) : upath.join(upath.dirname(actualPath), outDir),\n })\n } else {\n logger.warn(undefined, `File ${p} could not be found`)\n }\n } else if (p.endsWith('.ts')) {\n logger.warn(undefined, `Ignoring path ${p} as it does use the .algo.ts extension`)\n } else {\n const matches = globSync(upath.join(p, '**/*.algo.ts'))\n if (matches.length) {\n for (const match of matches) {\n filePaths.push({\n matchedInput: p,\n sourceFile: normalisePath(match, workingDirectory),\n outDir: upath.join(upath.isAbsolute(outDir) ? outDir : upath.join(p, outDir), upath.relative(p, upath.dirname(match))),\n })\n }\n } else {\n logger.warn(undefined, `Path '${p}' did not match any .algo.ts files`)\n }\n }\n }\n if (filePaths.length === 0) {\n throw new PuyaError('Input paths did not match any .algo.ts files')\n }\n\n return {\n filePaths: filePaths.map(replaceOutDirTokens),\n ...rest,\n getFileFromSource(sourceFile: string): AlgoFile | undefined {\n return this.filePaths.find((p) => p.sourceFile === sourceFile)\n },\n }\n}\n\nfunction replaceOutDirTokens(algoFile: AlgoFile): AlgoFile {\n const replacements = {\n name: upath.basename(algoFile.sourceFile).replace('.algo.ts', ''),\n }\n\n return {\n ...algoFile,\n outDir: algoFile.outDir.replaceAll('[name]', replacements.name),\n }\n}\n","import chalk from 'chalk'\nimport type { SourceLocation } from '../../awst/source-location'\nimport type { LogEvent, LogLevel } from '../index'\nimport { LoggingContext } from '../index'\nimport type { LogSink } from './index'\n\ntype ColorFn = (text: string) => string\nconst levelConfig: Record<LogEvent['level'], { colorFn: ColorFn; writeFn: (...args: unknown[]) => void }> = {\n /* eslint-disable no-console */\n debug: { colorFn: chalk.green, writeFn: console.debug },\n info: { colorFn: chalk.green, writeFn: console.info },\n warning: { colorFn: chalk.yellow, writeFn: console.warn },\n error: { colorFn: chalk.red, writeFn: console.error },\n critical: { colorFn: chalk.red, writeFn: console.error },\n /* eslint-enable no-console */\n}\n\nexport class ConsoleLogSink implements LogSink {\n constructor(public readonly minLogLevel: LogLevel) {}\n\n add(logEvent: LogEvent): void {\n const config = levelConfig[logEvent.level]\n\n let logText = `${config.colorFn(logEvent.level)}: ${logEvent.message}`\n if (logEvent.sourceLocation) {\n const sourceLocationText = logEvent.sourceLocation.toString()\n const indentSize = sourceLocationText.length + logEvent.level.length + 4\n\n logText = `${sourceLocationText} ${logText}${this.getSourceSummary(logEvent.sourceLocation, indentSize)}`\n }\n config.writeFn(logText)\n }\n\n getSourceSummary(sourceLocation: SourceLocation, indent: number): string {\n const sourceFile = sourceLocation.file && LoggingContext.current.sourcesByPath[sourceLocation.file]\n if (!sourceFile || sourceLocation.scope === 'file') return ''\n\n const line = sourceFile[sourceLocation.line - 1]\n const trimmedLine = line.trimStart()\n const marker = `${''.padStart(sourceLocation.column - (line.length - trimmedLine.length))}^${''.padStart(Math.max(sourceLocation.endColumn - sourceLocation.column - 1, 0), '~')}`\n const indentChars = ''.padStart(indent, ' ')\n return `\\n${indentChars}${trimmedLine}\\n${indentChars}${marker}`\n }\n}\n","import { Command, Option } from 'commander'\nimport { z } from 'zod'\nimport { buildCompileOptions } from './compile-options'\nimport { compile } from './index'\nimport { logger, LoggingContext, LogLevel } from './logger'\nimport { ConsoleLogSink } from './logger/sinks/console-log-sink'\nimport type { PuyaPassThroughOptions } from './puya/options'\nimport { defaultPuyaOptions, LocalsCoalescingStrategy } from './puya/options'\n\nconst cmdInteger = () => z.preprocess((x) => (typeof x === 'string' && x.length > 0 ? Number(x) : x), z.number().int())\n\nconst cliOptionsSchema = z.object({\n outputAwst: z.boolean(),\n outputAwstJson: z.boolean(),\n outDir: z.string(),\n dryRun: z.boolean(),\n logLevel: z.nativeEnum(LogLevel),\n isolatedFiles: z.boolean(),\n\n // Puya options\n outputSourceMap: z.boolean(),\n outputTeal: z.boolean(),\n outputArc32: z.boolean(),\n outputArc56: z.boolean(),\n outputSsaIr: z.boolean(),\n outputOptimizationIr: z.boolean(),\n outputDestructuredIr: z.boolean(),\n outputMemoryIr: z.boolean(),\n outputBytecode: z.boolean(),\n matchAlgodBytecode: z.boolean(),\n debugLevel: cmdInteger(),\n optimizationLevel: cmdInteger(),\n targetAvmVersion: cmdInteger(),\n cliTemplateDefinitions: z.preprocess((x) => x ?? [], z.array(z.string())),\n templateVarsPrefix: z.string(),\n localsCoalescingStrategy: z.nativeEnum(LocalsCoalescingStrategy),\n})\n\nconst cliArgumentsSchema = z.array(z.string())\n\nfunction cli() {\n const commander = new Command().name('puya-ts').description('Algo-TS to Algorand smart contract compiler')\n\n commander.helpCommand(true)\n\n commander\n .command('build')\n .argument('<paths...>', 'The path, or paths to search for compatible .algo.ts files')\n .addOption(\n new Option('--log-level [level]', 'The minimum log level to output')\n .choices([LogLevel.Debug, LogLevel.Info, LogLevel.Warning, LogLevel.Error, LogLevel.Critical])\n .default(LogLevel.Info),\n )\n .addOption(new Option('--output-awst', 'Output debugging awst file per parsed file').default(false))\n .addOption(new Option('--output-awst-json', 'Output debugging awst json file per parsed file').default(false))\n .addOption(new Option('--out-dir [outDir]').default('out'))\n .addOption(new Option('--dry-run', \"Just parse typescript files, don't invoke puya compiler\").default(false))\n .addOption(new Option('--isolated-files', 'Invoke compilation on each input file individually').default(false))\n .addOption(new Option('--no-output-teal', 'Do not output TEAL code').default(defaultPuyaOptions.outputTeal))\n .addOption(new Option('--output-source-map', 'Output debug source maps ').default(defaultPuyaOptions.outputSourceMap))\n .addOption(\n new Option(\n '--no-output-arc32',\n 'Do not output {contract}.arc32.json ARC-32 app spec file. Only applicable to ARC4 contracts',\n ).default(defaultPuyaOptions.outputArc32),\n )\n .addOption(\n new Option('--output-arc56', 'Output {contract}.arc56.json ARC-56 app spec file. Only applicable to ARC4 contracts').default(\n defaultPuyaOptions.outputArc56,\n ),\n )\n .addOption(new Option('--output-ssa-ir', 'Output IR (in SSA form) before optimisations').default(defaultPuyaOptions.outputSsaIr))\n .addOption(new Option('--output-optimization-ir', 'Output IR after each optimization').default(defaultPuyaOptions.outputOptimizationIr))\n .addOption(\n new Option('--output-destructured-ir', 'Output IR after SSA destructuring and before MIR').default(\n defaultPuyaOptions.outputDestructuredIr,\n ),\n )\n .addOption(new Option('--output-memory-ir', 'Output MIR before lowering to TealOps').default(defaultPuyaOptions.outputMemoryIr))\n .addOption(new Option('--output-bytecode', 'Output AVM bytecode').default(defaultPuyaOptions.outputBytecode))\n .addOption(\n new Option('--match-algod-bytecode', 'When outputting bytecode, ensure bytecode matches algod output').default(\n defaultPuyaOptions.matchAlgodBytecode,\n ),\n )\n .addOption(\n new Option('--debug-level [level]', 'Output debug information level, 0 = none, 1 = debug, 2 = reserved for future use')\n .choices(['0', '1', '2'])\n .default(defaultPuyaOptions.debugLevel),\n )\n .addOption(\n new Option('--optimization-level [level]', 'Set optimization level of output TEAL / AVM bytecode')\n .choices(['0', '1', '2'])\n .default(defaultPuyaOptions.optimizationLevel),\n )\n .addOption(new Option('--target-avm-version [version]', '').choices(['10', '11']).default(10))\n .addOption(\n new Option(\n '--cli-template-definitions <...definitions>',\n 'Define template vars for use when assembling via --output-bytecode, should be specified without the prefix (see --template-vars-prefix)',\n ),\n )\n .addOption(\n new Option('--template-vars-prefix [prefix]', 'Define the prefix to use with --template-var').default(\n defaultPuyaOptions.templateVarsPrefix,\n ),\n )\n .addOption(\n new Option('--locals-coalescing-strategy', '')\n .default(defaultPuyaOptions.localsCoalescingStrategy)\n .choices([\n LocalsCoalescingStrategy.root_operand,\n LocalsCoalescingStrategy.root_operand_excluding_args,\n LocalsCoalescingStrategy.aggressive,\n ]),\n )\n\n .action((a, o) => {\n using logCtx = LoggingContext.create()\n logger.configure([new ConsoleLogSink(LogLevel.Warning)])\n try {\n const paths = cliArgumentsSchema.parse(a)\n const cliOptions = cliOptionsSchema.parse(o)\n logger.configure([new ConsoleLogSink(cliOptions.logLevel)])\n const compileOptions = buildCompileOptions({\n paths,\n ...cliOptions,\n })\n const passThroughOptions: PuyaPassThroughOptions = cliOptions\n\n if (cliOptions.isolatedFiles) {\n let anyHasErrors = false\n for (const file of compileOptions.filePaths) {\n using logCtx = LoggingContext.create()\n try {\n compile(\n {\n ...compileOptions,\n filePaths: [file],\n },\n passThroughOptions,\n )\n } catch (e) {\n logger.critical(undefined, `Compilation failure: ${e}`)\n }\n anyHasErrors ||= logCtx.hasErrors()\n }\n if (anyHasErrors) {\n process.exit(-1)\n }\n } else {\n compile(compileOptions, passThroughOptions)\n logCtx.exitIfErrors()\n }\n } catch (e) {\n if (e instanceof Error) {\n logger.error(e)\n } else {\n throw e\n }\n }\n })\n\n if (process.argv.length < 3) {\n commander.help()\n } else {\n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AkB,GAA2B,UAAU;AAE7D,gBAAA,IAAI,UAAU,CAAC,aAAa,EAAE;oBAC5B,IAAI,YAAY,GAAG,KAAK;AACxB,oBAAA,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,SAAS,EAAE;;;AAC3C,4BAAA,MAAM,MAAM,GAAG,uBAAA,CAAA,KAAA,EAAA,cAAc,CAAC,MAAM,EAAE,QAAA;AACtC,4BAAA,IAAI;AACF,gCAAA,OAAO,CACL;AACE,oCAAA,GAAG,cAAc;oCACjB,SAAS,EAAE,CAAC,IAAI,CAAC;iCAClB,EACD,kBAAkB,CACnB;;4BACD,OAAO,CAAC,EAAE;gCACV,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAwB,qBAAA,EAAA,CAAC,CAAE,CAAA,CAAC;;AAEzD,4BAAA,YAAY,KAAK,MAAM,CAAC,SAAS,EAAE;;;;;;;;;AACpC;oBACD,IAAI,YAAY,EAAE;AAChB,wBAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;;qBAEb;AACL,oBAAA,OAAO,CAAC,cAAc,EAAE,kBAAkB,CAAC;oBAC3C,MAAM,CAAC,YAAY,EAAE;;;YAEvB,OAAO,CAAC,EAAE;AACV,gBAAA,IAAI,CAAC,YAAY,KAAK,EAAE;AACtB,oBAAA,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;;qBACV;AACL,oBAAA,MAAM,CAAC;;;;;;;;;;;AAGZ,KAAA,CAAC;IAEJ,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,SAAS,CAAC,IAAI,EAAE;;SACX;AACL,QAAA,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;;AAEjC;AACA,GAAG,EAAE"}
1
+ {"version":3,"file":"cli.mjs","sources":["../src/logger/sinks/console-log-sink.ts","../src/cli/util.ts","../src/cli/build-command.ts","../src/cli/parse.ts","../src/cli.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { SourceLocation } from '../../awst/source-location'\nimport type { LogEvent, LogLevel } from '../index'\nimport { LoggingContext } from '../index'\nimport type { LogSink } from './index'\n\ntype ColorFn = (text: string) => string\nconst levelConfig: Record<LogEvent['level'], { colorFn: ColorFn; writeFn: (...args: unknown[]) => void }> = {\n /* eslint-disable no-console */\n debug: { colorFn: chalk.green, writeFn: console.debug },\n info: { colorFn: chalk.green, writeFn: console.info },\n warning: { colorFn: chalk.yellow, writeFn: console.warn },\n error: { colorFn: chalk.red, writeFn: console.error },\n critical: { colorFn: chalk.red, writeFn: console.error },\n /* eslint-enable no-console */\n}\n\nexport class ConsoleLogSink implements LogSink {\n constructor(public readonly minLogLevel: LogLevel) {}\n\n add(logEvent: LogEvent): void {\n const config = levelConfig[logEvent.level]\n\n let logText = `${config.colorFn(logEvent.level)}: ${logEvent.message}`\n if (logEvent.sourceLocation) {\n const sourceLocationText = logEvent.sourceLocation.toString()\n const indentSize = sourceLocationText.length + logEvent.level.length + 4\n\n logText = `${sourceLocationText} ${logText}${this.getSourceSummary(logEvent.sourceLocation, indentSize)}`\n }\n config.writeFn(logText)\n }\n\n getSourceSummary(sourceLocation: SourceLocation, indent: number): string {\n const sourceFile = sourceLocation.file && LoggingContext.current.sourcesByPath[sourceLocation.file]\n if (!sourceFile || sourceLocation.scope === 'file') return ''\n\n const line = sourceFile[sourceLocation.line - 1]\n const trimmedLine = line.trimStart()\n const marker = `${''.padStart(sourceLocation.column - (line.length - trimmedLine.length))}^${''.padStart(Math.max(sourceLocation.endColumn - sourceLocation.column - 1, 0), '~')}`\n const indentChars = ''.padStart(indent, ' ')\n return `\\n${indentChars}${trimmedLine}\\n${indentChars}${marker}`\n }\n}\n","import type { ArgumentParser } from 'argparse'\nimport { enumFromValue } from '../util'\n\nexport function addEnumArg<T>(\n parser: ArgumentParser,\n { name, enumType, default: defaultValue, help }: { name: string; enumType: Record<string, string>; default?: T; help: string },\n) {\n parser.add_argument(name, {\n type: (v: string) => enumFromValue(v, enumType),\n choices: Array.from(Object.values(enumType)),\n default: defaultValue,\n help,\n })\n}\n\nexport function convertInt(val: string) {\n const res = Number(val)\n if (isNaN(res) || Math.round(res) !== res) {\n throw new Error(`'${val}' could not be converted to a number`)\n }\n return res\n}\n","import type { SubParser } from 'argparse'\nimport { BooleanOptionalAction } from 'argparse'\nimport { compile } from '../compile'\nimport { logger, LoggingContext, LogLevel } from '../logger'\nimport { ConsoleLogSink } from '../logger/sinks/console-log-sink'\nimport { defaultPuyaOptions, LocalsCoalescingStrategy } from '../puya/options'\nimport { addEnumArg, convertInt } from './util'\n\nexport interface BuildCommandArgs {\n command: 'build'\n log_level: LogLevel\n output_awst: boolean\n output_awst_json: boolean\n dry_run: boolean\n skip_version_check: boolean\n output_teal: boolean\n output_source_map: boolean\n output_arc32: boolean\n output_arc56: boolean\n output_ssa_ir: boolean\n output_optimization_ir: boolean\n output_destructured_ir: boolean\n output_memory_ir: boolean\n output_bytecode: boolean\n match_algod_bytecode: boolean\n out_dir: string\n debug_level: string\n optimization_level: string\n target_avm_version: string\n cli_template_definitions: string[]\n template_vars_prefix: string\n locals_coalescing_strategy: LocalsCoalescingStrategy\n paths: string[]\n}\n\nexport function addBuildCommand(subparsers: SubParser) {\n const buildParser = subparsers.add_parser('build', {\n description: 'Build a smart contract or logic signature',\n help: `When provided with a directory or .algo.ts file, parses and compiles all smart contracts and logic signatures found in the directory or file and outputs compilation artifacts.`,\n })\n\n addEnumArg(buildParser, {\n name: '--log-level',\n default: LogLevel.Info,\n enumType: LogLevel,\n help: 'The minimum log level to output',\n })\n\n buildParser.add_argument('--output-awst', {\n help: 'Output debugging awst file per parsed file',\n default: false,\n action: BooleanOptionalAction,\n })\n\n buildParser.add_argument('--output-awst-json', {\n action: BooleanOptionalAction,\n default: false,\n help: 'Output debugging awst json file per parsed file',\n })\n\n buildParser.add_argument('--dry-run', {\n action: BooleanOptionalAction,\n default: false,\n help: \"Just parse typescript files, don't invoke puya compiler\",\n })\n buildParser.add_argument('--skip-version-check', {\n action: BooleanOptionalAction,\n default: false,\n help: \"Don't verify installed puya compiler version matches targeted version\",\n })\n buildParser.add_argument('--output-teal', {\n action: BooleanOptionalAction,\n help: 'Output TEAL code',\n default: defaultPuyaOptions.outputTeal,\n })\n buildParser.add_argument('--output-source-map', {\n action: BooleanOptionalAction,\n help: 'Output debug source maps ',\n default: defaultPuyaOptions.outputSourceMap,\n })\n buildParser.add_argument('--output-arc32', {\n action: BooleanOptionalAction,\n help: 'Output {contract}.arc32.json ARC-32 app spec file. Only applicable to ARC4 contracts ',\n default: defaultPuyaOptions.outputArc32,\n })\n buildParser.add_argument('--output-arc56', {\n action: BooleanOptionalAction,\n help: 'Output {contract}.arc56.json ARC-56 app spec file. Only applicable to ARC4 contracts ',\n default: defaultPuyaOptions.outputArc56,\n })\n buildParser.add_argument('--output-ssa-ir', {\n action: BooleanOptionalAction,\n help: 'Output IR (in SSA form) before optimisations',\n default: defaultPuyaOptions.outputSsaIr,\n })\n buildParser.add_argument('--output-optimization-ir', {\n action: BooleanOptionalAction,\n help: 'Output IR after each optimization',\n default: defaultPuyaOptions.outputOptimizationIr,\n })\n buildParser.add_argument('--output-destructured-ir', {\n action: BooleanOptionalAction,\n help: 'Output IR after SSA destructuring and before MIR',\n default: defaultPuyaOptions.outputDestructuredIr,\n })\n buildParser.add_argument('--output-memory-ir', {\n action: BooleanOptionalAction,\n help: 'Output MIR before lowering to TealOps',\n default: defaultPuyaOptions.outputMemoryIr,\n })\n buildParser.add_argument('--output-bytecode', {\n action: BooleanOptionalAction,\n help: 'Output AVM bytecode',\n default: defaultPuyaOptions.outputBytecode,\n })\n buildParser.add_argument('--match-algod-bytecode', {\n action: BooleanOptionalAction,\n help: 'When outputting bytecode, ensure bytecode matches algod output',\n default: defaultPuyaOptions.matchAlgodBytecode,\n })\n\n buildParser.add_argument('--out-dir', {\n action: 'store',\n help: 'Where to output builder artifacts. Can use [name] placeholder to include contract name in path',\n default: 'out',\n })\n\n buildParser.add_argument('--debug-level', {\n default: defaultPuyaOptions.debugLevel.toString(),\n choices: ['0', '1', '2'],\n help: 'Output debug information level, 0 = none, 1 = debug, 2 = reserved for future use',\n })\n buildParser.add_argument('--optimization-level', {\n default: defaultPuyaOptions.optimizationLevel.toString(),\n choices: ['0', '1', '2'],\n help: 'Set optimization level of output TEAL / AVM bytecode, 0 = none, 1 = normal, 2 = intensive',\n })\n buildParser.add_argument('--target-avm-version', {\n default: defaultPuyaOptions.targetAvmVersion.toString(),\n choices: ['10', '11'],\n help: 'Select the targeted AVM version for compilation output',\n })\n\n buildParser.add_argument('--cli-template-definitions', {\n metavar: 'VAR=VALUE',\n nargs: '+',\n help: 'Define template vars for use when assembling via --output-bytecode, should be specified without the prefix (see --template-vars-prefix)',\n })\n\n buildParser.add_argument('--template-vars-prefix', {\n help: 'Define the prefix to use with --template-var',\n default: defaultPuyaOptions.templateVarsPrefix,\n })\n\n addEnumArg(buildParser, {\n name: '--locals-coalescing-strategy',\n enumType: LocalsCoalescingStrategy,\n help: 'Strategy choice for out-of-ssa local variable coalescing. The best choice for your app is best determined through experimentation',\n default: defaultPuyaOptions.localsCoalescingStrategy,\n })\n\n buildParser.add_argument('paths', {\n metavar: 'PATHS',\n nargs: '+',\n help: 'The path, or paths to search for compatible .algo.ts files',\n })\n\n buildParser.set_defaults({\n command: 'build',\n })\n}\n\nexport async function buildCommand(args: BuildCommandArgs) {\n const logCtx = LoggingContext.create()\n return logCtx.run(async () => {\n logger.configure([new ConsoleLogSink(args.log_level)])\n try {\n await compile({\n paths: args.paths,\n outputAwst: args.output_awst,\n outputAwstJson: args.output_awst_json,\n\n outDir: args.out_dir,\n skipVersionCheck: args.skip_version_check,\n dryRun: args.dry_run,\n logLevel: args.log_level,\n\n outputTeal: args.output_teal,\n outputArc32: args.output_arc32,\n outputArc56: args.output_arc56,\n outputSsaIr: args.output_ssa_ir,\n outputOptimizationIr: args.output_optimization_ir,\n outputDestructuredIr: args.output_destructured_ir,\n outputMemoryIr: args.output_memory_ir,\n outputBytecode: args.output_bytecode,\n outputSourceMap: args.output_source_map,\n matchAlgodBytecode: args.match_algod_bytecode,\n debugLevel: convertInt(args.debug_level),\n optimizationLevel: convertInt(args.optimization_level),\n targetAvmVersion: convertInt(args.target_avm_version),\n cliTemplateDefinitions: args.cli_template_definitions,\n templateVarsPrefix: args.template_vars_prefix,\n localsCoalescingStrategy: args.locals_coalescing_strategy,\n })\n logCtx.exitIfErrors()\n } catch (e) {\n if (e instanceof Error) {\n logger.error(e)\n } else {\n throw e\n }\n }\n })\n}\n","import { ArgumentParser } from 'argparse'\nimport type { BuildCommandArgs } from './build-command'\nimport { addBuildCommand, buildCommand } from './build-command'\n\nexport async function parseCliArguments() {\n const parser = new ArgumentParser({\n prog: 'puya-ts',\n })\n\n parser.add_argument('--version', {\n action: 'version',\n version: 'puya-ts TODO',\n })\n parser.set_defaults({\n command: 'none',\n })\n addBuildCommand(parser.add_subparsers())\n const result: PuyaTsCommand = parser.parse_args()\n switch (result.command) {\n case 'build':\n await buildCommand(result)\n break\n default:\n parser.print_help()\n break\n }\n}\ntype PuyaTsCommand = NoCommandArgs | BuildCommandArgs\ninterface NoCommandArgs {\n command: 'none'\n}\n","import { parseCliArguments } from './cli/parse'\n\nvoid parseCliArguments()\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,WAAW,GAA2F;;AAE1G,IAAA,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE;AACvD,IAAA,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE;AACrD,IAAA,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE;AACzD,IAAA,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,OAA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