@algorandfoundation/puya-ts 1.0.2-beta.2 → 1.1.0-beta.1

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.
@@ -1,5 +1,5 @@
1
1
  import type { ResourceEncoding } from '../awst';
2
- import type { ARC4ABIMethodConfig } from '../awst/nodes';
2
+ import { ARC4ABIMethodConfig } from '../awst/nodes';
3
3
  import type { SourceLocation } from '../awst/source-location';
4
4
  import type { ABICompatiblePType, FunctionPType, PType } from './ptypes';
5
5
  import { ArrayPType, FixedArrayPType, ImmutableObjectPType, MutableTuplePType, ReadonlyArrayPType, ReadonlyTuplePType } from './ptypes';
@@ -12,6 +12,10 @@ import { ARC4EncodedType, ARC4StructType, ARC4TupleType, DynamicArrayType, Stati
12
12
  * @param sourceLocation The location of the method or parameter, for use in error metadata
13
13
  */
14
14
  export declare function ptypeToAbiPType(ptype: PType, direction: 'in' | 'out', resourceEncoding: ResourceEncoding, sourceLocation: SourceLocation): ABICompatiblePType;
15
+ export declare function arc4ConfigFromType(functionType: FunctionPType, sourceLocation: SourceLocation): {
16
+ arc4Config: ARC4ABIMethodConfig;
17
+ methodSelector: import("../awst/nodes").MethodConstant;
18
+ };
15
19
  /**
16
20
  * Generate a methodConstant node for the given function, making use of the ARC4ABIMethodConfig
17
21
  * @param functionType The function ptype
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { l as logger, L as LogLevel, r as resolvePuyaPath } from '../resolve-puya-path-LGppZCBg.js';
3
- import { C as ConsoleLogSink } from '../console-log-sink-CMYe8JXy.js';
2
+ import { l as logger, L as LogLevel, r as resolvePuyaPath } from '../resolve-puya-path-YORRh-ku.js';
3
+ import { C as ConsoleLogSink } from '../console-log-sink-C0u_GjoF.js';
4
4
  import 'tslib';
5
5
  import 'fs';
6
6
  import 'node:async_hooks';
package/bin/puyats-ls.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { cI as processInputPaths, cU as DefaultMap, cF as registerPTypes, cG as typeRegistry, cJ as CompileOptions, cO as createTsProgram, cP as buildAwst, cQ as validateAwst, cL as PuyaService, cM as deserializeAndLog, cN as appVersion } from '../options-DLW_Tu42.js';
2
+ import { cI as processInputPaths, cU as DefaultMap, cF as registerPTypes, cG as typeRegistry, cJ as CompileOptions, cO as createTsProgram, cP as buildAwst, cQ as validateAwst, cL as PuyaService, cM as deserializeAndLog, cN as appVersion } from '../options-bdkR01m5.js';
3
3
  import { ArgumentParser, BooleanOptionalAction } from 'argparse';
4
- import { c as checkNodeVersion } from '../check-node-version-D8Nrsfl_.js';
4
+ import { c as checkNodeVersion } from '../check-node-version-CtzvzQu5.js';
5
5
  import { __esDecorate, __runInitializers } from 'tslib';
6
6
  import require$$0$2 from 'node:util';
7
7
  import require$$0 from 'util';
@@ -12,7 +12,7 @@ import require$$4 from 'net';
12
12
  import require$$0$1 from 'url';
13
13
  import fs__default from 'fs';
14
14
  import require$$3 from 'child_process';
15
- import { L as LogLevel, k as distinct, C as Constants, I as InternalError, l as logger, a as LoggingContext, n as isIn, o as LogSource, z as zipStrict, r as resolvePuyaPath } from '../resolve-puya-path-LGppZCBg.js';
15
+ import { L as LogLevel, k as distinct, C as Constants, I as InternalError, l as logger, a as LoggingContext, n as isIn, o as LogSource, z as zipStrict, r as resolvePuyaPath } from '../resolve-puya-path-YORRh-ku.js';
16
16
  import EventEmitter from 'node:events';
17
17
  import { globSync } from 'glob';
18
18
  import 'arcsecond';
package/bin/run-cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import '../cli.mjs';
3
- import '../options-DLW_Tu42.js';
4
- import '../resolve-puya-path-LGppZCBg.js';
3
+ import '../options-bdkR01m5.js';
4
+ import '../resolve-puya-path-YORRh-ku.js';
5
5
  import 'tslib';
6
6
  import 'fs';
7
7
  import 'node:async_hooks';
@@ -27,8 +27,8 @@ import 'change-case';
27
27
  import 'polytype';
28
28
  import 'minimatch';
29
29
  import 'argparse';
30
- import '../compile-9vC7vSko.js';
31
- import '../console-log-sink-CMYe8JXy.js';
30
+ import '../compile-aQuHq9aX.js';
31
+ import '../console-log-sink-C0u_GjoF.js';
32
32
  import 'chalk';
33
- import '../check-node-version-D8Nrsfl_.js';
33
+ import '../check-node-version-CtzvzQu5.js';
34
34
  //# sourceMappingURL=run-cli.mjs.map
@@ -1,5 +1,5 @@
1
1
  import chalk from 'chalk';
2
- import { p as parseSemVer, C as Constants } from './resolve-puya-path-LGppZCBg.js';
2
+ import { p as parseSemVer, C as Constants } from './resolve-puya-path-YORRh-ku.js';
3
3
 
4
4
  function writeError(text) {
5
5
  // eslint-disable-next-line no-console
@@ -16,4 +16,4 @@ function checkNodeVersion() {
16
16
  }
17
17
 
18
18
  export { checkNodeVersion as c };
19
- //# sourceMappingURL=check-node-version-D8Nrsfl_.js.map
19
+ //# sourceMappingURL=check-node-version-CtzvzQu5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"check-node-version-D8Nrsfl_.js","sources":["../src/cli/check-node-version.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { Constants } from '../constants'\nimport { parseSemVer } from '../puya/semver'\n\nfunction writeError(text: string) {\n // eslint-disable-next-line no-console\n console.error(chalk.red(text))\n}\n\nexport function checkNodeVersion() {\n const min = parseSemVer(Constants.minNodeVersion)\n const actual = parseSemVer(process.versions.node)\n\n if (\n actual.major < min.major ||\n (actual.major === min.major && actual.minor < min.minor) ||\n (actual.major === min.major && actual.minor === min.minor && actual.rev < min.rev)\n ) {\n writeError(\n `Installed node version ${process.versions.node} is older than the minimum required version ${Constants.minNodeVersion}. You may experience compatibility issues.`,\n )\n }\n}\n"],"names":[],"mappings":";;;AAIA,SAAS,UAAU,CAAC,IAAY,EAAA;;IAE9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChC;SAEgB,gBAAgB,GAAA;IAC9B,MAAM,GAAG,GAAG,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC;IACjD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;AAEjD,IAAA,IACE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;AACxB,SAAC,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;SACvD,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,EAClF;AACA,QAAA,UAAU,CACR,CAAA,uBAAA,EAA0B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAA,4CAAA,EAA+C,SAAS,CAAC,cAAc,CAAA,0CAAA,CAA4C,CACnK;IACH;AACF;;;;"}
1
+ {"version":3,"file":"check-node-version-CtzvzQu5.js","sources":["../src/cli/check-node-version.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { Constants } from '../constants'\nimport { parseSemVer } from '../puya/semver'\n\nfunction writeError(text: string) {\n // eslint-disable-next-line no-console\n console.error(chalk.red(text))\n}\n\nexport function checkNodeVersion() {\n const min = parseSemVer(Constants.minNodeVersion)\n const actual = parseSemVer(process.versions.node)\n\n if (\n actual.major < min.major ||\n (actual.major === min.major && actual.minor < min.minor) ||\n (actual.major === min.major && actual.minor === min.minor && actual.rev < min.rev)\n ) {\n writeError(\n `Installed node version ${process.versions.node} is older than the minimum required version ${Constants.minNodeVersion}. You may experience compatibility issues.`,\n )\n }\n}\n"],"names":[],"mappings":";;;AAIA,SAAS,UAAU,CAAC,IAAY,EAAA;;IAE9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChC;SAEgB,gBAAgB,GAAA;IAC9B,MAAM,GAAG,GAAG,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC;IACjD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;AAEjD,IAAA,IACE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;AACxB,SAAC,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;SACvD,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,EAClF;AACA,QAAA,UAAU,CACR,CAAA,uBAAA,EAA0B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAA,4CAAA,EAA+C,SAAS,CAAC,cAAc,CAAA,0CAAA,CAA4C,CACnK;IACH;AACF;;;;"}
package/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { cR as defaultPuyaOptions, cK as AbsolutePath, cI as processInputPaths, cJ as CompileOptions, cS as parseCliTemplateVar, cT as LocalsCoalescingStrategy, cN as appVersion } from './options-DLW_Tu42.js';
1
+ import { cR as defaultPuyaOptions, cK as AbsolutePath, cI as processInputPaths, cJ as CompileOptions, cS as parseCliTemplateVar, cT as LocalsCoalescingStrategy, cN as appVersion } from './options-bdkR01m5.js';
2
2
  import { BooleanOptionalAction, ArgumentParser } from 'argparse';
3
- import { c as compile } from './compile-9vC7vSko.js';
4
- import { j as enumFromValue, a as LoggingContext, l as logger, L as LogLevel } from './resolve-puya-path-LGppZCBg.js';
5
- import { C as ConsoleLogSink } from './console-log-sink-CMYe8JXy.js';
6
- import { c as checkNodeVersion } from './check-node-version-D8Nrsfl_.js';
3
+ import { c as compile } from './compile-aQuHq9aX.js';
4
+ import { j as enumFromValue, a as LoggingContext, l as logger, L as LogLevel } from './resolve-puya-path-YORRh-ku.js';
5
+ import { C as ConsoleLogSink } from './console-log-sink-C0u_GjoF.js';
6
+ import { c as checkNodeVersion } from './check-node-version-CtzvzQu5.js';
7
7
  import 'arcsecond';
8
8
  import 'node:fs';
9
9
  import 'node:util';
@@ -1,5 +1,5 @@
1
- import { cL as PuyaService, cM as deserializeAndLog, cF as registerPTypes, cN as appVersion, cO as createTsProgram, cP as buildAwst, cQ as validateAwst, cG as typeRegistry } from './options-DLW_Tu42.js';
2
- import { m as mkDirIfNotExists, r as resolvePuyaPath, L as LogLevel, l as logger, a as LoggingContext } from './resolve-puya-path-LGppZCBg.js';
1
+ import { cL as PuyaService, cM as deserializeAndLog, cF as registerPTypes, cN as appVersion, cO as createTsProgram, cP as buildAwst, cQ as validateAwst, cG as typeRegistry } from './options-bdkR01m5.js';
2
+ import { m as mkDirIfNotExists, r as resolvePuyaPath, L as LogLevel, l as logger, a as LoggingContext } from './resolve-puya-path-YORRh-ku.js';
3
3
  import ts from 'typescript';
4
4
 
5
5
  function buildCompilationSetMapping({ awst, inputPaths, compilationSet, }) {
@@ -99,4 +99,4 @@ async function compile(options) {
99
99
  }
100
100
 
101
101
  export { compile as c };
102
- //# sourceMappingURL=compile-9vC7vSko.js.map
102
+ //# sourceMappingURL=compile-aQuHq9aX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile-9vC7vSko.js","sources":["../src/puya/build-compilation-set-mapping.ts","../src/puya/index.ts","../src/compile.ts"],"sourcesContent":["import type { AWST } from '../awst/nodes'\nimport type { CompilationSet } from '../awst_build/models/contract-class-model'\nimport type { AlgoFile, CompilationSetMapping } from '../options'\nimport { mkDirIfNotExists } from '../util'\n\nexport function buildCompilationSetMapping({\n awst,\n inputPaths,\n compilationSet,\n}: {\n awst: AWST[]\n inputPaths: AlgoFile[]\n compilationSet: CompilationSet\n}): CompilationSetMapping {\n const setIds = new Set(compilationSet.compilationOutputSet.map((s) => s.id))\n\n return awst.reduce((acc, cur) => {\n if (setIds.has(cur.id.toString())) {\n const matchedPath = inputPaths.find((p) => cur.sourceLocation.file && p.sourceFile.equals(cur.sourceLocation.file))\n if (matchedPath) {\n mkDirIfNotExists(matchedPath.outDir.toString())\n acc[cur.id.toString()] = matchedPath.outDir.toString()\n }\n }\n return acc\n }, {} as CompilationSetMapping)\n}\n","import ts from 'typescript'\nimport type { AWST } from '../awst/nodes'\nimport type { CompilationSet } from '../awst_build/models/contract-class-model'\nimport { LogLevel } from '../logger'\nimport type { CompileOptions } from '../options'\nimport type { SourceFileMapping } from '../parser'\nimport type { AbsolutePath } from '../util/absolute-path'\nimport { buildCompilationSetMapping } from './build-compilation-set-mapping'\nimport { deserializeAndLog } from './log-deserializer'\nimport { PuyaService } from './puya-service'\nimport { resolvePuyaPath } from './resolve-puya-path'\n\nexport async function puyaCompile({\n moduleAwst,\n programDirectory,\n sourceFiles,\n options,\n compilationSet,\n}: {\n moduleAwst: AWST[]\n programDirectory: AbsolutePath\n sourceFiles: SourceFileMapping\n options: CompileOptions\n compilationSet: CompilationSet\n}) {\n const puyaPath = await resolvePuyaPath(options)\n const puyaService = PuyaService.getInstance({ puyaPath })\n const puyaOptions = options.buildPuyaOptions(\n buildCompilationSetMapping({\n awst: moduleAwst,\n inputPaths: options.filePaths,\n compilationSet,\n }),\n )\n\n const response = await puyaService.compile({\n awst: moduleAwst,\n options: puyaOptions,\n base_path: programDirectory.toString(),\n log_level: getPuyaLogLevel(options.logLevel),\n source_annotations: getSourceFileContents(sourceFiles),\n })\n // TODO: approval tests could be sped up by caching puyaService and only shutting down once tests are complete\n await puyaService.shutdown()\n for (const log of response.logs) {\n deserializeAndLog(log)\n }\n}\n\nfunction getPuyaLogLevel(logLevel: LogLevel): string {\n switch (logLevel) {\n case LogLevel.Debug:\n return 'debug'\n case LogLevel.Info:\n return 'info'\n case LogLevel.Warning:\n return 'warning'\n case LogLevel.Error:\n return 'error'\n case LogLevel.Critical:\n return 'critical'\n }\n}\nfunction getSourceFileContents(sourceFiles: SourceFileMapping) {\n return Object.fromEntries(\n Object.entries(sourceFiles).map(([key, value]) => {\n const source = ts.isSourceFile(value) ? value.getFullText().replace(/\\r\\n/g, '\\n').split(/\\n/g) : value\n return [key, source] as const\n }),\n )\n}\n","import type ts from 'typescript'\nimport type { AWST } from './awst/nodes'\nimport { validateAwst } from './awst/validation'\nimport { buildAwst } from './awst_build'\nimport type { CompilationSet } from './awst_build/models/contract-class-model'\nimport { registerPTypes } from './awst_build/ptypes/register'\nimport { typeRegistry } from './awst_build/type-registry'\nimport { appVersion } from './cli/app-version'\nimport { logger, LoggingContext } from './logger'\nimport type { CompileOptions } from './options'\nimport { createTsProgram } from './parser'\nimport { puyaCompile } from './puya'\nimport type { AbsolutePath } from './util/absolute-path'\n\nexport type CompileResult = {\n programDirectory: AbsolutePath\n awst?: AWST[]\n ast?: Record<string, ts.SourceFile>\n compilationSet?: CompilationSet\n}\n\nexport async function compile(options: CompileOptions): Promise<CompileResult> {\n const loggerCtx = LoggingContext.current\n registerPTypes(typeRegistry)\n logger.info(undefined, appVersion({ withAVMVersion: false }))\n const programResult = createTsProgram(options)\n if (loggerCtx.hasErrors()) {\n logger.info(undefined, 'Compilation halted due to parse errors')\n return {\n programDirectory: programResult.programDirectory,\n ast: programResult.sourceFiles,\n }\n }\n const { moduleAwst, compilationSet } = buildAwst(programResult, options)\n validateAwst(moduleAwst)\n\n if (loggerCtx.hasErrors()) {\n logger.info(undefined, 'Compilation halted due to errors')\n return {\n programDirectory: programResult.programDirectory,\n awst: moduleAwst,\n ast: programResult.sourceFiles,\n compilationSet,\n }\n }\n if (!options.dryRun) {\n await puyaCompile({\n options,\n moduleAwst,\n programDirectory: programResult.programDirectory,\n compilationSet,\n sourceFiles: programResult.sourceFiles,\n })\n }\n\n return {\n programDirectory: programResult.programDirectory,\n awst: moduleAwst,\n ast: programResult.sourceFiles,\n compilationSet,\n }\n}\n"],"names":[],"mappings":";;;;AAKM,SAAU,0BAA0B,CAAC,EACzC,IAAI,EACJ,UAAU,EACV,cAAc,GAKf,EAAA;IACC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,cAAc,C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AAM,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7D,IAAA,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC;AAC9C,IAAA,IAAI,SAAS,CAAC,SAAS,EAAE,EAAE;AACzB,QAAA,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,wCAAwC,CAAC;QAChE,OAAO;YACL,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;YAChD,GAAG,EAAE,aAAa,CAAC,WAAW;SAC/B;IACH;AACA,IAAA,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC;IACxE,YAAY,CAAC,UAAU,CAAC;AAExB,IAAA,IAAI,SAAS,CAAC,SAAS,EAAE,EAAE;AACzB,QAAA,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,kCAAkC,CAAC;QAC1D,OAAO;YACL,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;AAChD,YAAA,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,aAAa,CAAC,WAAW;YAC9B,cAAc;SACf;IACH;AACA,IAAA,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;AACnB,QAAA,MAAM,WAAW,CAAC;YAChB,OAAO;YACP,UAAU;YACV,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;YAChD,cAAc;YACd,WAAW,EAAE,aAAa,CAAC,WAAW;AACvC,SAAA,CAAC;IACJ;IAEA,OAAO;QACL,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;AAChD,QAAA,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,aAAa,CAAC,WAAW;QAC9B,cAAc;KACf;AACH;;;;"}
1
+ {"version":3,"file":"compile-aQuHq9aX.js","sources":["../src/puya/build-compilation-set-mapping.ts","../src/puya/index.ts","../src/compile.ts"],"sourcesContent":["import type { AWST } from '../awst/nodes'\nimport type { CompilationSet } from '../awst_build/models/contract-class-model'\nimport type { AlgoFile, CompilationSetMapping } from '../options'\nimport { mkDirIfNotExists } from '../util'\n\nexport function buildCompilationSetMapping({\n awst,\n inputPaths,\n compilationSet,\n}: {\n awst: AWST[]\n inputPaths: AlgoFile[]\n compilationSet: CompilationSet\n}): CompilationSetMapping {\n const setIds = new Set(compilationSet.compilationOutputSet.map((s) => s.id))\n\n return awst.reduce((acc, cur) => {\n if (setIds.has(cur.id.toString())) {\n const matchedPath = inputPaths.find((p) => cur.sourceLocation.file && p.sourceFile.equals(cur.sourceLocation.file))\n if (matchedPath) {\n mkDirIfNotExists(matchedPath.outDir.toString())\n acc[cur.id.toString()] = matchedPath.outDir.toString()\n }\n }\n return acc\n }, {} as CompilationSetMapping)\n}\n","import ts from 'typescript'\nimport type { AWST } from '../awst/nodes'\nimport type { CompilationSet } from '../awst_build/models/contract-class-model'\nimport { LogLevel } from '../logger'\nimport type { CompileOptions } from '../options'\nimport type { SourceFileMapping } from '../parser'\nimport type { AbsolutePath } from '../util/absolute-path'\nimport { buildCompilationSetMapping } from './build-compilation-set-mapping'\nimport { deserializeAndLog } from './log-deserializer'\nimport { PuyaService } from './puya-service'\nimport { resolvePuyaPath } from './resolve-puya-path'\n\nexport async function puyaCompile({\n moduleAwst,\n programDirectory,\n sourceFiles,\n options,\n compilationSet,\n}: {\n moduleAwst: AWST[]\n programDirectory: AbsolutePath\n sourceFiles: SourceFileMapping\n options: CompileOptions\n compilationSet: CompilationSet\n}) {\n const puyaPath = await resolvePuyaPath(options)\n const puyaService = PuyaService.getInstance({ puyaPath })\n const puyaOptions = options.buildPuyaOptions(\n buildCompilationSetMapping({\n awst: moduleAwst,\n inputPaths: options.filePaths,\n compilationSet,\n }),\n )\n\n const response = await puyaService.compile({\n awst: moduleAwst,\n options: puyaOptions,\n base_path: programDirectory.toString(),\n log_level: getPuyaLogLevel(options.logLevel),\n source_annotations: getSourceFileContents(sourceFiles),\n })\n // TODO: approval tests could be sped up by caching puyaService and only shutting down once tests are complete\n await puyaService.shutdown()\n for (const log of response.logs) {\n deserializeAndLog(log)\n }\n}\n\nfunction getPuyaLogLevel(logLevel: LogLevel): string {\n switch (logLevel) {\n case LogLevel.Debug:\n return 'debug'\n case LogLevel.Info:\n return 'info'\n case LogLevel.Warning:\n return 'warning'\n case LogLevel.Error:\n return 'error'\n case LogLevel.Critical:\n return 'critical'\n }\n}\nfunction getSourceFileContents(sourceFiles: SourceFileMapping) {\n return Object.fromEntries(\n Object.entries(sourceFiles).map(([key, value]) => {\n const source = ts.isSourceFile(value) ? value.getFullText().replace(/\\r\\n/g, '\\n').split(/\\n/g) : value\n return [key, source] as const\n }),\n )\n}\n","import type ts from 'typescript'\nimport type { AWST } from './awst/nodes'\nimport { validateAwst } from './awst/validation'\nimport { buildAwst } from './awst_build'\nimport type { CompilationSet } from './awst_build/models/contract-class-model'\nimport { registerPTypes } from './awst_build/ptypes/register'\nimport { typeRegistry } from './awst_build/type-registry'\nimport { appVersion } from './cli/app-version'\nimport { logger, LoggingContext } from './logger'\nimport type { CompileOptions } from './options'\nimport { createTsProgram } from './parser'\nimport { puyaCompile } from './puya'\nimport type { AbsolutePath } from './util/absolute-path'\n\nexport type CompileResult = {\n programDirectory: AbsolutePath\n awst?: AWST[]\n ast?: Record<string, ts.SourceFile>\n compilationSet?: CompilationSet\n}\n\nexport async function compile(options: CompileOptions): Promise<CompileResult> {\n const loggerCtx = LoggingContext.current\n registerPTypes(typeRegistry)\n logger.info(undefined, appVersion({ withAVMVersion: false }))\n const programResult = createTsProgram(options)\n if (loggerCtx.hasErrors()) {\n logger.info(undefined, 'Compilation halted due to parse errors')\n return {\n programDirectory: programResult.programDirectory,\n ast: programResult.sourceFiles,\n }\n }\n const { moduleAwst, compilationSet } = buildAwst(programResult, options)\n validateAwst(moduleAwst)\n\n if (loggerCtx.hasErrors()) {\n logger.info(undefined, 'Compilation halted due to errors')\n return {\n programDirectory: programResult.programDirectory,\n awst: moduleAwst,\n ast: programResult.sourceFiles,\n compilationSet,\n }\n }\n if (!options.dryRun) {\n await puyaCompile({\n options,\n moduleAwst,\n programDirectory: programResult.programDirectory,\n compilationSet,\n sourceFiles: programResult.sourceFiles,\n })\n }\n\n return {\n programDirectory: programResult.programDirectory,\n awst: moduleAwst,\n ast: programResult.sourceFiles,\n compilationSet,\n }\n}\n"],"names":[],"mappings":";;;;AAKM,SAAU,0BAA0B,CAAC,EACzC,IAAI,EACJ,UAAU,EACV,cAAc,GAKf,EAAA;IACC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAE5E,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAI;AAC9B,QAAA,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE;AACjC,YAAA,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YACnH,IAAI,WAAW,EAAE;gBACf,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC/C,gBAAA,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE;YACxD;QACF;AACA,QAAA,OAAO,GAAG;IACZ,CAAC,EAAE,EAA2B,CAAC;AACjC;;ACdO,eAAe,WAAW,CAAC,EAChC,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,cAAc,GAOf,EAAA;AACC,IAAA,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC;IAC/C,MAAM,WAAW,GAAG,WAAW,CAAC,WAA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,aAAa,CAAC,WAAW;AACvC,SAAA,CAAC;IACJ;IAEA,OAAO;QACL,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;AAChD,QAAA,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,aAAa,CAAC,WAAW;QAC9B,cAAc;KACf;AACH;;;;"}
@@ -1,5 +1,5 @@
1
1
  import chalk from 'chalk';
2
- import { i as isMinLevel, L as LogLevel, a as LoggingContext } from './resolve-puya-path-LGppZCBg.js';
2
+ import { i as isMinLevel, L as LogLevel, a as LoggingContext } from './resolve-puya-path-YORRh-ku.js';
3
3
 
4
4
  const levelConfig = {
5
5
  /* eslint-disable no-console */
@@ -44,4 +44,4 @@ class ConsoleLogSink {
44
44
  }
45
45
 
46
46
  export { ConsoleLogSink as C };
47
- //# sourceMappingURL=console-log-sink-CMYe8JXy.js.map
47
+ //# sourceMappingURL=console-log-sink-C0u_GjoF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"console-log-sink-CMYe8JXy.js","sources":["../src/logger/sinks/console-log-sink.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { SourceLocation } from '../../awst/source-location'\nimport type { LogEvent } from '../index'\nimport { isMinLevel, LoggingContext, LogLevel } from '../index'\nimport type { LogSink } from './index'\nimport type { AbsolutePath } from '../../util/absolute-path'\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(\n public readonly minLogLevel: LogLevel,\n private readonly pathsRelativeTo?: AbsolutePath,\n ) {}\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({ pathsRelativeTo: this.pathsRelativeTo })\n const indentSize = sourceLocationText.length + logEvent.level.length + 4\n\n const sourceSummary = isMinLevel(logEvent.level, LogLevel.Warning) ? this.getSourceSummary(logEvent.sourceLocation, indentSize) : ''\n logText = `${sourceLocationText} ${logText}${sourceSummary}`\n }\n if (isMinLevel(LogLevel.Debug, this.minLogLevel) && logEvent.stack) {\n logText += `\\n ${logEvent.stack}`\n }\n config.writeFn(logText)\n }\n\n getSourceSummary(sourceLocation: SourceLocation, indent: number): string {\n const sourceFile = sourceLocation.file && LoggingContext.current.sourcesByPath[sourceLocation.file.toString()]\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"],"names":[],"mappings":";;;AAQA,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,OAAO,CAAC,KAAK,EAAE;AACrD,IAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,C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zB;IAEA,gBAAgB,CAAC,cAA8B,EAAE,MAAc,EAAA;AAC7D,QAAA,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,IAAI,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC9G,QAAA,IAAI,CAAC,UAAU,IAAI,cAAc,CAAC,KAAK,KAAK,MAAM;AAAE,YAAA,OAAO,EAAE;QAE7D,MAAM,IAAI,GAAG,UAAU,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,CAAC;AAChD,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE;QACpC,MAAM,MAAM,GAAG,CAAA,EAAG,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA,CAAA,EAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA,CAAE;QAClL,MAAM,WAAW,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;QAC5C,OAAO,CAAA,EAAA,EAAK,WAAW,CAAA,EAAG,WAAW,KAAK,WAAW,CAAA,EAAG,MAAM,CAAA,CAAE;IAClE;AACD;;;;"}
1
+ {"version":3,"file":"console-log-sink-C0u_GjoF.js","sources":["../src/logger/sinks/console-log-sink.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { SourceLocation } from '../../awst/source-location'\nimport type { LogEvent } from '../index'\nimport { isMinLevel, LoggingContext, LogLevel } from '../index'\nimport type { LogSink } from './index'\nimport type { AbsolutePath } from '../../util/absolute-path'\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(\n public readonly minLogLevel: LogLevel,\n private readonly pathsRelativeTo?: AbsolutePath,\n ) {}\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({ pathsRelativeTo: this.pathsRelativeTo })\n const indentSize = sourceLocationText.length + logEvent.level.length + 4\n\n const sourceSummary = isMinLevel(logEvent.level, LogLevel.Warning) ? this.getSourceSummary(logEvent.sourceLocation, indentSize) : ''\n logText = `${sourceLocationText} ${logText}${sourceSummary}`\n }\n if (isMinLevel(LogLevel.Debug, this.minLogLevel) && logEvent.stack) {\n logText += `\\n ${logEvent.stack}`\n }\n config.writeFn(logText)\n }\n\n getSourceSummary(sourceLocation: SourceLocation, indent: number): string {\n const sourceFile = sourceLocation.file && LoggingContext.current.sourcesByPath[sourceLocation.file.toString()]\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"],"names":[],"mappings":";;;AAQA,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,O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mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { u as uint8ArrayToBigInt, b as uint8ArrayToBase64, c as uint8ArrayToBase32, d as uint8ArrayToUtf8, e as base64ToUint8Array, f as base32ToUint8Array, g as bigIntToUint8Array, h as utf8ToUint8Array } from './resolve-puya-path-LGppZCBg.js';
2
- export { a as LoggingContext } from './resolve-puya-path-LGppZCBg.js';
3
- import { A as ABICompatibleInstanceType, a as ALL_OP_ENUMS, b as ARC4ArrayType, c as ARC4BoolClass, d as ARC4EncodedType, e as ARC4InstanceType, f as ARC4StrClass, g as ARC4StructClass, h as ARC4StructType, i as ARC4TupleType, j as AccountFunction, k as AddressClass, l as AnyPType, m as ApplicationFunctionType, n as ApplicationTxnFunction, o as ApprovalProgram, p as Arc4TupleGeneric, q as ArrayGeneric, r as ArrayLiteralPType, s as ArrayPType, t as AssetConfigTxnFunction, u as AssetFreezeTxnFunction, v as AssetFunction, w as AssetTransferTxnFunction, B as BaseContractClassType, x as BigIntLiteralPType, y as BigIntPType, z as BigUintFunction, C as BooleanFunction, D as BoxGeneric, E as BoxMapGeneric, F as BoxMapPType, G as BoxPType, H as ByteClass, I as BytesFunction, J as BytesGeneric, K as BytesPType, L as ClassMethodDecoratorContext, M as ClearStateProgram, N as ClusteredContractClassType, O as ClusteredPrototype, P as ContractClassPType, Q as ContractProxyGeneric, R as ContractProxyType, S as DynamicArrayGeneric, T as DynamicArrayType, U as DynamicBytesConstructor, V as DynamicBytesType, W as FixedArrayGeneric, X as FixedArrayPType, Y as FunctionPType, Z as GeneratorGeneric, _ as GeneratorType, $ as GenericPType, a0 as GlobalStateGeneric, a1 as GlobalStateType, a2 as GroupTransactionPType, a3 as ImmutableObjectPType, a4 as InnerTransactionPType, a5 as InstanceType, a6 as InternalType, a7 as IntersectionPType, a8 as IntrinsicEnumType, a9 as IntrinsicFunctionGroupType, aa as IntrinsicFunctionGroupTypeType, ab as IntrinsicFunctionType, ac as IntrinsicFunctionTypeType, ad as IterableIteratorGeneric, ae as IterableIteratorType, af as ItxnParamsPType, ag as KeyRegistrationTxnFunction, ah as LibClassType, ai as LibFunctionType, aj as LibObjType, ak as LocalStateGeneric, al as LocalStateType, am as LogicSigPType, an as MutableObjectPType, ao as MutableTuplePType, ap as NamespacePType, aq as NumberPType, ar as NumericLiteralPType, as as ObjectLiteralPType, at as ObjectWithOptionalFieldsType, au as PType, av as PaymentTxnFunction, aw as PolytypeClassMethodHelper, ax as PromiseGeneric, ay as PromiseType, az as ReadonlyArrayGeneric, aA as ReadonlyArrayPType, aB as ReadonlyGeneric, aC as ReadonlyTuplePType, aD as ReferenceArrayGeneric, aE as ReferenceArrayType, aF as StaticArrayGeneric, aG as StaticArrayType, aH as StaticBytesGeneric, aI as StaticBytesType, aJ as StringFunction, aK as SuperPrototypeSelector, aL as SuperPrototypeSelectorGeneric, aM as TemplateVarFunction, aN as TransactionFunction, aO as TransactionFunctionType, aP as TransientType, aQ as TypeParameterType, aR as TypedApplicationCallResponseGeneric, aS as TypedApplicationCallResponseType, aT as UFixedNxMGeneric, aU as UFixedNxMType, aV as Uint64EnumMemberLiteralType, aW as Uint64EnumMemberType, aX as Uint64EnumType, aY as Uint64Function, aZ as UintN128Class, a_ as UintN16Class, a$ as UintN256Class, b0 as UintN32Class, b1 as UintN64Class, b2 as UintN8Class, b3 as UintNGeneric, b4 as UintNType, b5 as UnionPType, b6 as UnsupportedType, b7 as abiCallFunction, b8 as accountPType, b9 as anyGtxnType, ba as anyItxnParamsType, bb as anyItxnType, bc as anyPType, bd as applicationCallGtxnType, be as applicationCallItxnFn, bf as applicationCallItxnParamsType, bg as applicationItxnType, bh as applicationPType, bi as arc28EmitFunction, bj as arc4AbiMethodDecorator, bk as arc4AddressAlias, bl as arc4BareMethodDecorator, bm as arc4BaseContractType, bn as arc4BooleanType, bo as arc4ByteAlias, bp as arc4StringType, bq as arc4StructBaseType, br as arc4Uint64, bs as assertFunction, bt as assertMatchFunction, bu as assetConfigGtxnType, bv as assetConfigItxnFn, bw as assetConfigItxnParamsType, bx as assetConfigItxnType, by as assetFreezeGtxnType, bz as assetFreezeItxnFn, bA as assetFreezeItxnParamsType, bB as assetFreezeItxnType, bC as assetPType, bD as assetTransferGtxnType, bE as assetTransferItxnFn, bF as assetTransferItxnParamsType, bG as assetTransferItxnType, bH as base64PType, bI as baseContractType, bJ as bigIntPType, bK as biguintPType, bL as boolPType, bM as bytesPType, bN as bzeroFunction, bO as cloneFunctionPType, bP as compileArc4Function, bQ as compileFunctionType, bR as compiledContractType, bS as compiledLogicSigType, bT as contractOptionsDecorator, bU as convertBytesFunction, bV as decodeArc4Function, bW as ecPType, bX as ecdsaPType, bY as encodeArc4Function, bZ as ensureBudgetFunction, b_ as errFunction, b$ as esSymbol, c0 as inputOnlyObjects, c1 as isArrayType, c2 as isObjectType, c3 as isTupleLike, c4 as itoaMethod, c5 as itxnComposePType, c6 as keyRegistrationGtxnType, c7 as keyRegistrationItxnFn, c8 as keyRegistrationItxnParamsType, c9 as keyRegistrationItxnType, ca as logFunction, cb as logicSigBaseType, cc as logicSigOptionsDecorator, cd as matchFunction, ce as methodSelectorFunction, cf as mimcConfigurationsPType, cg as neverPType, ch as nullPType, ci as numberPType, cj as onCompleteActionType, ck as opUpFeeSourceType, cl as paymentGtxnType, cm as paymentItxnFn, cn as paymentItxnParamsType, co as paymentItxnType, cp as ptypeToArc4EncodedType, cq as readonlyDecorator, cr as sizeOfFunction, cs as stringPType, ct as submitGroupItxnFunction, cu as transactionTypeType, cv as uint64PType, cw as undefinedPType, cx as unknownPType, cy as urangeFunction, cz as validateEncodingFunctionPType, cA as voidPType, cB as vrfVerifyPType, cC as uint8ArrayToHex, cD as hexToUint8Array } from './options-DLW_Tu42.js';
4
- export { cK as AbsolutePath, cJ as CompileOptions, cE as SourceLocation, cH as TypeResolver, cI as processInputPaths, cF as registerPTypes, cG as typeRegistry } from './options-DLW_Tu42.js';
5
- export { c as compile } from './compile-9vC7vSko.js';
1
+ import { u as uint8ArrayToBigInt, b as uint8ArrayToBase64, c as uint8ArrayToBase32, d as uint8ArrayToUtf8, e as base64ToUint8Array, f as base32ToUint8Array, g as bigIntToUint8Array, h as utf8ToUint8Array } from './resolve-puya-path-YORRh-ku.js';
2
+ export { a as LoggingContext } from './resolve-puya-path-YORRh-ku.js';
3
+ import { A as ABICompatibleInstanceType, a as ALL_OP_ENUMS, b as ARC4ArrayType, c as ARC4BoolClass, d as ARC4EncodedType, e as ARC4InstanceType, f as ARC4StrClass, g as ARC4StructClass, h as ARC4StructType, i as ARC4TupleType, j as AccountFunction, k as AddressClass, l as AnyPType, m as ApplicationFunctionType, n as ApplicationTxnFunction, o as ApprovalProgram, p as Arc4TupleGeneric, q as ArrayGeneric, r as ArrayLiteralPType, s as ArrayPType, t as AssetConfigTxnFunction, u as AssetFreezeTxnFunction, v as AssetFunction, w as AssetTransferTxnFunction, B as BaseContractClassType, x as BigIntLiteralPType, y as BigIntPType, z as BigUintFunction, C as BooleanFunction, D as BoxGeneric, E as BoxMapGeneric, F as BoxMapPType, G as BoxPType, H as ByteClass, I as BytesFunction, J as BytesGeneric, K as BytesPType, L as ClassMethodDecoratorContext, M as ClearStateProgram, N as ClusteredContractClassType, O as ClusteredPrototype, P as ContractClassPType, Q as ContractProxyGeneric, R as ContractProxyType, S as DynamicArrayGeneric, T as DynamicArrayType, U as DynamicBytesConstructor, V as DynamicBytesType, W as FixedArrayGeneric, X as FixedArrayPType, Y as FunctionPType, Z as GeneratorGeneric, _ as GeneratorType, $ as GenericPType, a0 as GlobalStateGeneric, a1 as GlobalStateType, a2 as GroupTransactionPType, a3 as ImmutableObjectPType, a4 as InnerTransactionPType, a5 as InstanceType, a6 as InternalType, a7 as IntersectionPType, a8 as IntrinsicEnumType, a9 as IntrinsicFunctionGroupType, aa as IntrinsicFunctionGroupTypeType, ab as IntrinsicFunctionType, ac as IntrinsicFunctionTypeType, ad as IterableIteratorGeneric, ae as IterableIteratorType, af as ItxnParamsPType, ag as KeyRegistrationTxnFunction, ah as LibClassType, ai as LibFunctionType, aj as LibObjType, ak as LocalStateGeneric, al as LocalStateType, am as LogicSigPType, an as MutableObjectPType, ao as MutableTuplePType, ap as NamespacePType, aq as NumberPType, ar as NumericLiteralPType, as as ObjectLiteralPType, at as ObjectWithOptionalFieldsType, au as PType, av as PaymentTxnFunction, aw as PolytypeClassMethodHelper, ax as PromiseGeneric, ay as PromiseType, az as ReadonlyArrayGeneric, aA as ReadonlyArrayPType, aB as ReadonlyGeneric, aC as ReadonlyTuplePType, aD as ReferenceArrayGeneric, aE as ReferenceArrayType, aF as StaticArrayGeneric, aG as StaticArrayType, aH as StaticBytesGeneric, aI as StaticBytesType, aJ as StringFunction, aK as SuperPrototypeSelector, aL as SuperPrototypeSelectorGeneric, aM as TemplateVarFunction, aN as TransactionFunction, aO as TransactionFunctionType, aP as TransientType, aQ as TypeParameterType, aR as TypedApplicationCallResponseGeneric, aS as TypedApplicationCallResponseType, aT as UFixedNxMGeneric, aU as UFixedNxMType, aV as Uint64EnumMemberLiteralType, aW as Uint64EnumMemberType, aX as Uint64EnumType, aY as Uint64Function, aZ as UintN128Class, a_ as UintN16Class, a$ as UintN256Class, b0 as UintN32Class, b1 as UintN64Class, b2 as UintN8Class, b3 as UintNGeneric, b4 as UintNType, b5 as UnionPType, b6 as UnsupportedType, b7 as abiCallFunction, b8 as accountPType, b9 as anyGtxnType, ba as anyItxnParamsType, bb as anyItxnType, bc as anyPType, bd as applicationCallGtxnType, be as applicationCallItxnFn, bf as applicationCallItxnParamsType, bg as applicationItxnType, bh as applicationPType, bi as arc28EmitFunction, bj as arc4AbiMethodDecorator, bk as arc4AddressAlias, bl as arc4BareMethodDecorator, bm as arc4BaseContractType, bn as arc4BooleanType, bo as arc4ByteAlias, bp as arc4StringType, bq as arc4StructBaseType, br as arc4Uint64, bs as assertFunction, bt as assertMatchFunction, bu as assetConfigGtxnType, bv as assetConfigItxnFn, bw as assetConfigItxnParamsType, bx as assetConfigItxnType, by as assetFreezeGtxnType, bz as assetFreezeItxnFn, bA as assetFreezeItxnParamsType, bB as assetFreezeItxnType, bC as assetPType, bD as assetTransferGtxnType, bE as assetTransferItxnFn, bF as assetTransferItxnParamsType, bG as assetTransferItxnType, bH as base64PType, bI as baseContractType, bJ as bigIntPType, bK as biguintPType, bL as boolPType, bM as bytesPType, bN as bzeroFunction, bO as cloneFunctionPType, bP as compileArc4Function, bQ as compileFunctionType, bR as compiledContractType, bS as compiledLogicSigType, bT as contractOptionsDecorator, bU as convertBytesFunction, bV as decodeArc4Function, bW as ecPType, bX as ecdsaPType, bY as encodeArc4Function, bZ as ensureBudgetFunction, b_ as errFunction, b$ as esSymbol, c0 as inputOnlyObjects, c1 as isArrayType, c2 as isObjectType, c3 as isTupleLike, c4 as itoaMethod, c5 as itxnComposePType, c6 as keyRegistrationGtxnType, c7 as keyRegistrationItxnFn, c8 as keyRegistrationItxnParamsType, c9 as keyRegistrationItxnType, ca as logFunction, cb as logicSigBaseType, cc as logicSigOptionsDecorator, cd as matchFunction, ce as methodSelectorFunction, cf as mimcConfigurationsPType, cg as neverPType, ch as nullPType, ci as numberPType, cj as onCompleteActionType, ck as opUpFeeSourceType, cl as paymentGtxnType, cm as paymentItxnFn, cn as paymentItxnParamsType, co as paymentItxnType, cp as ptypeToArc4EncodedType, cq as readonlyDecorator, cr as sizeOfFunction, cs as stringPType, ct as submitGroupItxnFunction, cu as transactionTypeType, cv as uint64PType, cw as undefinedPType, cx as unknownPType, cy as urangeFunction, cz as validateEncodingFunctionPType, cA as voidPType, cB as vrfVerifyPType, cC as uint8ArrayToHex, cD as hexToUint8Array } from './options-bdkR01m5.js';
4
+ export { cK as AbsolutePath, cJ as CompileOptions, cE as SourceLocation, cH as TypeResolver, cI as processInputPaths, cF as registerPTypes, cG as typeRegistry } from './options-bdkR01m5.js';
5
+ export { c as compile } from './compile-aQuHq9aX.js';
6
6
  import 'tslib';
7
7
  import 'fs';
8
8
  import 'node:async_hooks';