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

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.
@@ -4,20 +4,21 @@ export interface AlgoFile {
4
4
  sourceFile: string;
5
5
  outDir: string;
6
6
  }
7
- export interface CompileOptions {
7
+ export interface PuyaTsCompileOptions {
8
8
  filePaths: AlgoFile[];
9
9
  logLevel: LogLevel;
10
10
  outputAwst: boolean;
11
11
  outputAwstJson: boolean;
12
+ skipVersionCheck: boolean;
12
13
  dryRun: boolean;
13
- getFileFromSource(sourceFile: string): AlgoFile | undefined;
14
14
  }
15
15
  export declare const buildCompileOptions: ({ paths, workingDirectory, outDir, ...rest }: {
16
16
  paths: string[];
17
17
  outputAwst: boolean;
18
18
  outDir: string;
19
19
  outputAwstJson: boolean;
20
+ skipVersionCheck: boolean;
20
21
  workingDirectory?: string;
21
22
  dryRun: boolean;
22
23
  logLevel: LogLevel;
23
- }) => CompileOptions;
24
+ }) => PuyaTsCompileOptions;
package/compile.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ import type ts from 'typescript';
2
+ import type { AWST } from './awst/nodes';
3
+ import type { CompilationSet } from './awst_build/models/contract-class-model';
4
+ import { type LogLevel } from './logger';
5
+ import type { CreateProgramResult } from './parser';
6
+ import type { PuyaPassThroughOptions } from './puya/options';
7
+ export type CompileResult = {
8
+ programDirectory: string;
9
+ awst?: AWST[];
10
+ ast?: Record<string, ts.SourceFile>;
11
+ compilationSet?: CompilationSet;
12
+ };
13
+ export type CompileArgs = {
14
+ paths: string[];
15
+ outputAwst: boolean;
16
+ outDir: string;
17
+ outputAwstJson: boolean;
18
+ skipVersionCheck?: boolean;
19
+ workingDirectory?: string;
20
+ dryRun?: boolean;
21
+ logLevel: LogLevel;
22
+ hooks?: Partial<Hooks>;
23
+ } & PuyaPassThroughOptions;
24
+ type Hooks = {
25
+ /**
26
+ * Called after TypeScript parsing, but before AWST build. Use this hook to add or remove TS AST nodes before AWST build
27
+ *
28
+ * If implemented, this method should return true to continue compilation or false to stop
29
+ * @param createProgramResult The result of TypeScript compilation
30
+ */
31
+ onProgramCreated(createProgramResult: CreateProgramResult): boolean;
32
+ /**
33
+ * Called after AWST build, but before invocation of puya. Use this hook to add or remove AWST nodes before puya build
34
+ *
35
+ * If implemented, this method should return true to continue compilation or false to stop
36
+ * @param moduleAwst All AWST nodes of the build
37
+ * @param compilationSet An array of references to AWST nodes which should result in compilation output.
38
+ */
39
+ onAwstBuilt(moduleAwst: AWST[], compilationSet: CompilationSet): boolean;
40
+ };
41
+ export declare function compile({ paths, outputAwst, outDir, outputAwstJson, skipVersionCheck, workingDirectory, dryRun, logLevel, hooks, ...passThroughOptions }: CompileArgs): Promise<CompileResult>;
42
+ export {};
package/constants.d.ts CHANGED
@@ -6,7 +6,6 @@ export declare const Constants: {
6
6
  readonly opModuleName: "@algorandfoundation/algorand-typescript/op.d.ts";
7
7
  readonly templateVarModuleName: "@algorandfoundation/algorand-typescript/template-var.d.ts";
8
8
  readonly logicSigModuleName: "@algorandfoundation/algorand-typescript/logic-sig.d.ts";
9
- readonly opTypesModuleName: "@algorandfoundation/algorand-typescript/op-types.d.ts";
10
9
  readonly baseContractModuleName: "@algorandfoundation/algorand-typescript/base-contract.d.ts";
11
10
  readonly utilModuleName: "@algorandfoundation/algorand-typescript/util.d.ts";
12
11
  readonly referenceModuleName: "@algorandfoundation/algorand-typescript/reference.d.ts";
@@ -31,6 +30,6 @@ export declare const Constants: {
31
30
  readonly encodedAddressLength: 58;
32
31
  readonly zeroAddressEncoded: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ";
33
32
  readonly supportedAvmVersions: readonly [10n, 11n];
34
- readonly targetedPuyaVersion: "4.2.0";
33
+ readonly targetedPuyaVersion: "4.2.1";
35
34
  };
36
35
  export type SupportedAvmVersion = (typeof Constants.supportedAvmVersions)[number];
package/index.d.ts CHANGED
@@ -1,14 +1,10 @@
1
- import type ts from 'typescript';
2
- import type { AWST } from './awst/nodes';
3
- import type { CompilationSet } from './awst_build/models/contract-class-model';
4
- import type { CompileOptions } from './compile-options';
5
- import type { CreateProgramResult } from './parser';
6
- import type { PuyaPassThroughOptions } from './puya/options';
7
1
  export { SourceLocation } from './awst/source-location';
8
2
  export * as ptypes from './awst_build/ptypes/for-export';
9
3
  export { registerPTypes } from './awst_build/ptypes/register';
10
4
  export { typeRegistry } from './awst_build/type-registry';
11
5
  export { TypeResolver } from './awst_build/type-resolver';
6
+ export { compile } from './compile';
7
+ export { LoggingContext } from './logger';
12
8
  export declare const encodingUtil: {
13
9
  utf8ToUint8Array: (value: string) => Uint8Array;
14
10
  bigIntToUint8Array: (val: bigint, fixedSize?: number | "dynamic") => Uint8Array;
@@ -21,27 +17,3 @@ export declare const encodingUtil: {
21
17
  uint8ArrayToBase64: (value: Uint8Array) => string;
22
18
  uint8ArrayToBigInt: (v: Uint8Array) => bigint;
23
19
  };
24
- export type CompileResult = {
25
- programDirectory: string;
26
- awst?: AWST[];
27
- ast?: Record<string, ts.SourceFile>;
28
- compilationSet?: CompilationSet;
29
- };
30
- type Hooks = {
31
- /**
32
- * Called after TypeScript parsing, but before AWST build. Use this hook to add or remove TS AST nodes before AWST build
33
- *
34
- * If implemented, this method should return true to continue compilation or false to stop
35
- * @param createProgramResult The result of TypeScript compilation
36
- */
37
- onProgramCreated(createProgramResult: CreateProgramResult): boolean;
38
- /**
39
- * Called after AWST build, but before invocation of puya. Use this hook to add or remove AWST nodes before puya build
40
- *
41
- * If implemented, this method should return true to continue compilation or false to stop
42
- * @param moduleAwst All AWST nodes of the build
43
- * @param compilationSet An array of references to AWST nodes which should result in compilation output.
44
- */
45
- onAwstBuilt(moduleAwst: AWST[], compilationSet: CompilationSet): boolean;
46
- };
47
- export declare function compile(options: CompileOptions, passThroughOptions: PuyaPassThroughOptions, hooks?: Partial<Hooks>): CompileResult;
package/index.mjs CHANGED
@@ -1,19 +1,236 @@
1
- export { S as SourceLocation, T as TypeResolver, c as compile, e as encodingUtil, f as ptypes, r as registerPTypes, t as typeRegistry } from './index-B46QirKR.js';
2
- import 'change-case';
3
- import 'node:path';
1
+ import { A as ALL_OP_ENUMS, a as ARC4BoolClass, b as ARC4EncodedType, c as ARC4InstanceType, d as ARC4StrClass, e as ARC4StructClass, f as ARC4StructType, g as ARC4TupleType, h as AccountFunction, i as AddressClass, j as AnyPType, k as ApplicationFunctionType, l as ApplicationTxnFunction, m as ApprovalProgram, n as Arc4TupleClass, o as Arc4TupleGeneric, p as ArrayLiteralPType, q as ArrayPType, r as AssetConfigTxnFunction, s as AssetFreezeTxnFunction, t as AssetFunction, u as AssetTransferTxnFunction, B as BaseContractClassType, v as BigIntLiteralPType, w as BigUintFunction, x as BooleanFunction, y as BoxFunction, z as BoxGeneric, C as BoxMapFunction, D as BoxMapGeneric, E as BoxMapPType, F as BoxPType, G as BoxRefFunction, H as BoxRefPType, I as ByteClass, J as BytesFunction, K as ClassMethodDecoratorContext, L as ClearStateProgram, M as ClusteredContractClassType, N as ClusteredPrototype, O as ContractClassPType, P as DynamicArrayConstructor, Q as DynamicArrayGeneric, R as DynamicArrayType, S as DynamicBytesConstructor, T as DynamicBytesType, U as FunctionPType, V as GeneratorGeneric, W as GeneratorType, X as GenericPType, Y as GlobalStateFunction, Z as GlobalStateGeneric, _ as GlobalStateType, $ as GroupTransactionPType, a0 as InnerTransactionPType, a1 as InstanceType, a2 as InternalType, a3 as IntersectionPType, a4 as IntrinsicEnumType, a5 as IntrinsicFunctionGroupType, a6 as IntrinsicFunctionGroupTypeType, a7 as IntrinsicFunctionType, a8 as IntrinsicFunctionTypeType, a9 as IterableIteratorGeneric, aa as IterableIteratorType, ab as ItxnParamsPType, ac as KeyRegistrationTxnFunction, ad as LibClassType, ae as LibFunctionType, af as LocalStateFunction, ag as LocalStateGeneric, ah as LocalStateType, ai as LogicSigPType, aj as NamespacePType, ak as NativeNumericType, al as NumericLiteralPType, am as ObjectPType, an as PType, ao as PaymentTxnFunction, ap as PolytypeClassMethodHelper, aq as PromiseGeneric, ar as PromiseType, as as StaticArrayConstructor, at as StaticArrayGeneric, au as StaticArrayType, av as StaticBytesConstructor, aw as StaticBytesGeneric, ax as StaticBytesType, ay as StorageProxyPType, az as StringFunction, aA as SuperPrototypeSelector, aB as SuperPrototypeSelectorGeneric, aC as TemplateVarFunction, aD as TransactionFunction, aE as TransactionFunctionType, aF as TransientType, aG as TuplePType, aH as TypeParameterType, aI as UFixedNxMClass, aJ as UFixedNxMGeneric, aK as UFixedNxMType, aL as Uint64EnumMemberType, aM as Uint64EnumType, aN as Uint64Function, aO as UintN128Class, aP as UintN16Class, aQ as UintN256Class, aR as UintN32Class, aS as UintN64Class, aT as UintN8Class, aU as UintNClass, aV as UintNGeneric, aW as UintNType, aX as UnionPType, aY as UnsupportedType, aZ as accountPType, a_ as anyGtxnType, a$ as anyPType, b0 as applicationCallGtxnType, b1 as applicationCallItxnFn, b2 as applicationCallItxnParamsType, b3 as applicationItxnType, b4 as applicationPType, b5 as arc28EmitFunction, b6 as arc4AbiMethodDecorator, b7 as arc4AddressAlias, b8 as arc4BareMethodDecorator, b9 as arc4BaseContractType, ba as arc4BooleanType, bb as arc4ByteAlias, bc as arc4StringType, bd as arc4StructBaseType, be as assertFunction, bf as assertMatchFunction, bg as assetConfigGtxnType, bh as assetConfigItxnFn, bi as assetConfigItxnParamsType, bj as assetConfigItxnType, bk as assetFreezeGtxnType, bl as assetFreezeItxnFn, bm as assetFreezeItxnParamsType, bn as assetFreezeItxnType, bo as assetPType, bp as assetTransferGtxnType, bq as assetTransferItxnFn, br as assetTransferItxnParamsType, bs as assetTransferItxnType, bt as base64PType, bu as baseContractType, bv as bigIntPType, bw as biguintPType, bx as boolPType, by as boxRefType, bz as bytesPType, bA as compileFunctionType, bB as compiledContractType, bC as compiledLogicSigType, bD as contractOptionsDecorator, bE as decodeArc4Function, bF as ecPType, bG as ecdsaPType, bH as encodeArc4Function, bI as ensureBudgetFunction, bJ as errFunction, bK as interpretAsArc4Function, bL as isAppStorageType, bM as keyRegistrationGtxnType, bN as keyRegistrationItxnFn, bO as keyRegistrationItxnParamsType, bP as keyRegistrationItxnType, bQ as logFunction, bR as logicSigBaseType, bS as logicSigOptionsDecorator, bT as methodSelectorFunction, bU as mimcConfigurationsPType, bV as neverPType, bW as nullPType, bX as numberPType, bY as onCompleteActionType, bZ as opUpFeeSourceType, b_ as paymentGtxnType, b$ as paymentItxnFn, c0 as paymentItxnParamsType, c1 as paymentItxnType, c2 as ptypeToArc4EncodedType, c3 as stringPType, c4 as submitGroupItxnFunction, c5 as transactionTypeType, c6 as uint64PType, c7 as undefinedPType, c8 as unknownPType, c9 as urangeFunction, ca as voidPType, cb as vrfVerifyPType, cc as utf8ToUint8Array, cd as bigIntToUint8Array, ce as hexToUint8Array, cf as base32ToUint8Array, cg as base64ToUint8Array, ch as uint8ArrayToUtf8, ci as uint8ArrayToHex, cj as uint8ArrayToBase32, ck as uint8ArrayToBase64, cl as uint8ArrayToBigInt } from './compile-BcG41O6Z.js';
2
+ export { cr as LoggingContext, cm as SourceLocation, cp as TypeResolver, cq as compile, cn as registerPTypes, co as typeRegistry } from './compile-BcG41O6Z.js';
3
+ import 'node:async_hooks';
4
4
  import 'typescript';
5
5
  import 'node:buffer';
6
6
  import 'node:fs';
7
7
  import 'node:util';
8
8
  import 'upath';
9
9
  import 'polytype';
10
+ import 'change-case';
11
+ import 'node:path';
10
12
  import 'tslib';
11
13
  import 'arcsecond';
14
+ import 'glob';
12
15
  import 'crypto';
13
16
  import 'fs';
14
- import 'glob';
15
17
  import 'os';
16
18
  import 'cross-spawn';
17
19
  import 'which';
18
20
  import 'zod';
21
+
22
+ /* This file aggregates all ptypes into a single export for external consumption of the compiler api */
23
+
24
+ var forExport = /*#__PURE__*/Object.freeze({
25
+ __proto__: null,
26
+ ALL_OP_ENUMS: ALL_OP_ENUMS,
27
+ ARC4BoolClass: ARC4BoolClass,
28
+ ARC4EncodedType: ARC4EncodedType,
29
+ ARC4InstanceType: ARC4InstanceType,
30
+ ARC4StrClass: ARC4StrClass,
31
+ ARC4StructClass: ARC4StructClass,
32
+ ARC4StructType: ARC4StructType,
33
+ ARC4TupleType: ARC4TupleType,
34
+ AccountFunction: AccountFunction,
35
+ AddressClass: AddressClass,
36
+ AnyPType: AnyPType,
37
+ ApplicationFunctionType: ApplicationFunctionType,
38
+ ApplicationTxnFunction: ApplicationTxnFunction,
39
+ ApprovalProgram: ApprovalProgram,
40
+ Arc4TupleClass: Arc4TupleClass,
41
+ Arc4TupleGeneric: Arc4TupleGeneric,
42
+ ArrayLiteralPType: ArrayLiteralPType,
43
+ ArrayPType: ArrayPType,
44
+ AssetConfigTxnFunction: AssetConfigTxnFunction,
45
+ AssetFreezeTxnFunction: AssetFreezeTxnFunction,
46
+ AssetFunction: AssetFunction,
47
+ AssetTransferTxnFunction: AssetTransferTxnFunction,
48
+ BaseContractClassType: BaseContractClassType,
49
+ BigIntLiteralPType: BigIntLiteralPType,
50
+ BigUintFunction: BigUintFunction,
51
+ BooleanFunction: BooleanFunction,
52
+ BoxFunction: BoxFunction,
53
+ BoxGeneric: BoxGeneric,
54
+ BoxMapFunction: BoxMapFunction,
55
+ BoxMapGeneric: BoxMapGeneric,
56
+ BoxMapPType: BoxMapPType,
57
+ BoxPType: BoxPType,
58
+ BoxRefFunction: BoxRefFunction,
59
+ BoxRefPType: BoxRefPType,
60
+ ByteClass: ByteClass,
61
+ BytesFunction: BytesFunction,
62
+ ClassMethodDecoratorContext: ClassMethodDecoratorContext,
63
+ ClearStateProgram: ClearStateProgram,
64
+ ClusteredContractClassType: ClusteredContractClassType,
65
+ ClusteredPrototype: ClusteredPrototype,
66
+ ContractClassPType: ContractClassPType,
67
+ DynamicArrayConstructor: DynamicArrayConstructor,
68
+ DynamicArrayGeneric: DynamicArrayGeneric,
69
+ DynamicArrayType: DynamicArrayType,
70
+ DynamicBytesConstructor: DynamicBytesConstructor,
71
+ DynamicBytesType: DynamicBytesType,
72
+ FunctionPType: FunctionPType,
73
+ GeneratorGeneric: GeneratorGeneric,
74
+ GeneratorType: GeneratorType,
75
+ GenericPType: GenericPType,
76
+ GlobalStateFunction: GlobalStateFunction,
77
+ GlobalStateGeneric: GlobalStateGeneric,
78
+ GlobalStateType: GlobalStateType,
79
+ GroupTransactionPType: GroupTransactionPType,
80
+ InnerTransactionPType: InnerTransactionPType,
81
+ InstanceType: InstanceType,
82
+ InternalType: InternalType,
83
+ IntersectionPType: IntersectionPType,
84
+ IntrinsicEnumType: IntrinsicEnumType,
85
+ IntrinsicFunctionGroupType: IntrinsicFunctionGroupType,
86
+ IntrinsicFunctionGroupTypeType: IntrinsicFunctionGroupTypeType,
87
+ IntrinsicFunctionType: IntrinsicFunctionType,
88
+ IntrinsicFunctionTypeType: IntrinsicFunctionTypeType,
89
+ IterableIteratorGeneric: IterableIteratorGeneric,
90
+ IterableIteratorType: IterableIteratorType,
91
+ ItxnParamsPType: ItxnParamsPType,
92
+ KeyRegistrationTxnFunction: KeyRegistrationTxnFunction,
93
+ LibClassType: LibClassType,
94
+ LibFunctionType: LibFunctionType,
95
+ LocalStateFunction: LocalStateFunction,
96
+ LocalStateGeneric: LocalStateGeneric,
97
+ LocalStateType: LocalStateType,
98
+ LogicSigPType: LogicSigPType,
99
+ NamespacePType: NamespacePType,
100
+ NativeNumericType: NativeNumericType,
101
+ NumericLiteralPType: NumericLiteralPType,
102
+ ObjectPType: ObjectPType,
103
+ PType: PType,
104
+ PaymentTxnFunction: PaymentTxnFunction,
105
+ PolytypeClassMethodHelper: PolytypeClassMethodHelper,
106
+ PromiseGeneric: PromiseGeneric,
107
+ PromiseType: PromiseType,
108
+ StaticArrayConstructor: StaticArrayConstructor,
109
+ StaticArrayGeneric: StaticArrayGeneric,
110
+ StaticArrayType: StaticArrayType,
111
+ StaticBytesConstructor: StaticBytesConstructor,
112
+ StaticBytesGeneric: StaticBytesGeneric,
113
+ StaticBytesType: StaticBytesType,
114
+ StorageProxyPType: StorageProxyPType,
115
+ StringFunction: StringFunction,
116
+ SuperPrototypeSelector: SuperPrototypeSelector,
117
+ SuperPrototypeSelectorGeneric: SuperPrototypeSelectorGeneric,
118
+ TemplateVarFunction: TemplateVarFunction,
119
+ TransactionFunction: TransactionFunction,
120
+ TransactionFunctionType: TransactionFunctionType,
121
+ TransientType: TransientType,
122
+ TuplePType: TuplePType,
123
+ TypeParameterType: TypeParameterType,
124
+ UFixedNxMClass: UFixedNxMClass,
125
+ UFixedNxMGeneric: UFixedNxMGeneric,
126
+ UFixedNxMType: UFixedNxMType,
127
+ Uint64EnumMemberType: Uint64EnumMemberType,
128
+ Uint64EnumType: Uint64EnumType,
129
+ Uint64Function: Uint64Function,
130
+ UintN128Class: UintN128Class,
131
+ UintN16Class: UintN16Class,
132
+ UintN256Class: UintN256Class,
133
+ UintN32Class: UintN32Class,
134
+ UintN64Class: UintN64Class,
135
+ UintN8Class: UintN8Class,
136
+ UintNClass: UintNClass,
137
+ UintNGeneric: UintNGeneric,
138
+ UintNType: UintNType,
139
+ UnionPType: UnionPType,
140
+ UnsupportedType: UnsupportedType,
141
+ accountPType: accountPType,
142
+ anyGtxnType: anyGtxnType,
143
+ anyPType: anyPType,
144
+ applicationCallGtxnType: applicationCallGtxnType,
145
+ applicationCallItxnFn: applicationCallItxnFn,
146
+ applicationCallItxnParamsType: applicationCallItxnParamsType,
147
+ applicationItxnType: applicationItxnType,
148
+ applicationPType: applicationPType,
149
+ arc28EmitFunction: arc28EmitFunction,
150
+ arc4AbiMethodDecorator: arc4AbiMethodDecorator,
151
+ arc4AddressAlias: arc4AddressAlias,
152
+ arc4BareMethodDecorator: arc4BareMethodDecorator,
153
+ arc4BaseContractType: arc4BaseContractType,
154
+ arc4BooleanType: arc4BooleanType,
155
+ arc4ByteAlias: arc4ByteAlias,
156
+ arc4StringType: arc4StringType,
157
+ arc4StructBaseType: arc4StructBaseType,
158
+ assertFunction: assertFunction,
159
+ assertMatchFunction: assertMatchFunction,
160
+ assetConfigGtxnType: assetConfigGtxnType,
161
+ assetConfigItxnFn: assetConfigItxnFn,
162
+ assetConfigItxnParamsType: assetConfigItxnParamsType,
163
+ assetConfigItxnType: assetConfigItxnType,
164
+ assetFreezeGtxnType: assetFreezeGtxnType,
165
+ assetFreezeItxnFn: assetFreezeItxnFn,
166
+ assetFreezeItxnParamsType: assetFreezeItxnParamsType,
167
+ assetFreezeItxnType: assetFreezeItxnType,
168
+ assetPType: assetPType,
169
+ assetTransferGtxnType: assetTransferGtxnType,
170
+ assetTransferItxnFn: assetTransferItxnFn,
171
+ assetTransferItxnParamsType: assetTransferItxnParamsType,
172
+ assetTransferItxnType: assetTransferItxnType,
173
+ base64PType: base64PType,
174
+ baseContractType: baseContractType,
175
+ bigIntPType: bigIntPType,
176
+ biguintPType: biguintPType,
177
+ boolPType: boolPType,
178
+ boxRefType: boxRefType,
179
+ bytesPType: bytesPType,
180
+ compileFunctionType: compileFunctionType,
181
+ compiledContractType: compiledContractType,
182
+ compiledLogicSigType: compiledLogicSigType,
183
+ contractOptionsDecorator: contractOptionsDecorator,
184
+ decodeArc4Function: decodeArc4Function,
185
+ ecPType: ecPType,
186
+ ecdsaPType: ecdsaPType,
187
+ encodeArc4Function: encodeArc4Function,
188
+ ensureBudgetFunction: ensureBudgetFunction,
189
+ errFunction: errFunction,
190
+ interpretAsArc4Function: interpretAsArc4Function,
191
+ isAppStorageType: isAppStorageType,
192
+ keyRegistrationGtxnType: keyRegistrationGtxnType,
193
+ keyRegistrationItxnFn: keyRegistrationItxnFn,
194
+ keyRegistrationItxnParamsType: keyRegistrationItxnParamsType,
195
+ keyRegistrationItxnType: keyRegistrationItxnType,
196
+ logFunction: logFunction,
197
+ logicSigBaseType: logicSigBaseType,
198
+ logicSigOptionsDecorator: logicSigOptionsDecorator,
199
+ methodSelectorFunction: methodSelectorFunction,
200
+ mimcConfigurationsPType: mimcConfigurationsPType,
201
+ neverPType: neverPType,
202
+ nullPType: nullPType,
203
+ numberPType: numberPType,
204
+ onCompleteActionType: onCompleteActionType,
205
+ opUpFeeSourceType: opUpFeeSourceType,
206
+ paymentGtxnType: paymentGtxnType,
207
+ paymentItxnFn: paymentItxnFn,
208
+ paymentItxnParamsType: paymentItxnParamsType,
209
+ paymentItxnType: paymentItxnType,
210
+ ptypeToArc4EncodedType: ptypeToArc4EncodedType,
211
+ stringPType: stringPType,
212
+ submitGroupItxnFunction: submitGroupItxnFunction,
213
+ transactionTypeType: transactionTypeType,
214
+ uint64PType: uint64PType,
215
+ undefinedPType: undefinedPType,
216
+ unknownPType: unknownPType,
217
+ urangeFunction: urangeFunction,
218
+ voidPType: voidPType,
219
+ vrfVerifyPType: vrfVerifyPType
220
+ });
221
+
222
+ const encodingUtil = {
223
+ utf8ToUint8Array,
224
+ bigIntToUint8Array,
225
+ hexToUint8Array,
226
+ base32ToUint8Array,
227
+ base64ToUint8Array,
228
+ uint8ArrayToUtf8,
229
+ uint8ArrayToHex,
230
+ uint8ArrayToBase32,
231
+ uint8ArrayToBase64,
232
+ uint8ArrayToBigInt,
233
+ };
234
+
235
+ export { encodingUtil, forExport as ptypes };
19
236
  //# sourceMappingURL=index.mjs.map
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/awst_build/ptypes/for-export.ts","../src/index.ts"],"sourcesContent":["/* This file aggregates all ptypes into a single export for external consumption of the compiler api */\nexport { ptypeToArc4EncodedType } from '../arc4-util'\nexport * from './arc4-types'\nexport * from './index'\n","import {\n base32ToUint8Array,\n base64ToUint8Array,\n bigIntToUint8Array,\n hexToUint8Array,\n uint8ArrayToBase32,\n uint8ArrayToBase64,\n uint8ArrayToBigInt,\n uint8ArrayToHex,\n uint8ArrayToUtf8,\n utf8ToUint8Array,\n} from './util'\n\nexport { SourceLocation } from './awst/source-location'\nexport * as ptypes from './awst_build/ptypes/for-export'\nexport { registerPTypes } from './awst_build/ptypes/register'\nexport { typeRegistry } from './awst_build/type-registry'\nexport { TypeResolver } from './awst_build/type-resolver'\nexport { compile } from './compile'\nexport { LoggingContext } from './logger'\n\nexport const encodingUtil = {\n utf8ToUint8Array,\n bigIntToUint8Array,\n hexToUint8Array,\n base32ToUint8Array,\n base64ToUint8Array,\n uint8ArrayToUtf8,\n uint8ArrayToHex,\n uint8ArrayToBase32,\n uint8ArrayToBase64,\n uint8ArrayToBigInt,\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBa,MAAA,YAAY,GAAG;IAC1B,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;;;;;"}
package/logger/index.d.ts CHANGED
@@ -30,15 +30,15 @@ declare class PuyaLogger {
30
30
  }
31
31
  export declare const logger: PuyaLogger;
32
32
  export declare const logPuyaExceptions: <T>(action: () => T, sourceLocation: SourceLocation) => T;
33
- export declare class LoggingContext implements Disposable {
33
+ export declare class LoggingContext {
34
34
  logEvents: LogEvent[];
35
35
  sourcesByPath: Record<string, string[]>;
36
36
  private constructor();
37
37
  hasErrors(): boolean;
38
38
  exitIfErrors(): void;
39
- private static contexts;
40
- static create(): Disposable & LoggingContext;
39
+ run<R>(cb: () => R): R;
40
+ private static asyncStore;
41
+ static create(): LoggingContext;
41
42
  static get current(): LoggingContext;
42
- [Symbol.dispose](): void;
43
43
  }
44
44
  export {};
package/package.json CHANGED
@@ -4,23 +4,23 @@
4
4
  "**"
5
5
  ],
6
6
  "name": "@algorandfoundation/puya-ts",
7
- "version": "1.0.0-beta.13",
7
+ "version": "1.0.0-beta.15",
8
8
  "description": "Compiles Algorand TypeScript into byte code which runs on the Algorand Virtual Machine (AVM)",
9
9
  "private": false,
10
10
  "author": "Algorand foundation",
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
13
  "arcsecond": "^5.0.0",
14
+ "argparse": "^2.0.1",
14
15
  "chalk": "^5.3.0",
15
16
  "change-case": "^5.4.4",
16
- "commander": "^12.1.0",
17
17
  "cross-spawn": "7.0.6",
18
18
  "glob": "^11.0.0",
19
19
  "polytype": "^0.17.0",
20
20
  "typescript": "^5.7.2",
21
21
  "upath": "^2.0.1",
22
22
  "which": "^5.0.0",
23
- "zod": "^3.24.0"
23
+ "zod": "^3.24.1"
24
24
  },
25
25
  "overrides": {
26
26
  "cross-spawn": "7.0.6",
package/parser/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import ts from 'typescript';
2
- import type { CompileOptions } from '../compile-options';
2
+ import type { PuyaTsCompileOptions } from '../compile-options';
3
3
  export type SourceFileMapping = Record<string, ts.SourceFile>;
4
4
  export type CreateProgramResult = {
5
5
  sourceFiles: SourceFileMapping;
6
6
  program: ts.Program;
7
7
  programDirectory: string;
8
8
  };
9
- export declare function createTsProgram(options: CompileOptions): CreateProgramResult;
9
+ export declare function createTsProgram(options: PuyaTsCompileOptions): CreateProgramResult;
@@ -3,11 +3,12 @@ export declare enum VersionCompareVerdict {
3
3
  Inconclusive = "Inconclusive",
4
4
  MajorMismatch = "MajorMismatch",
5
5
  MinorMismatch = "MinorMismatch",
6
- RevisionMismatch = "RevisionMismatch"
6
+ OlderRevision = "OlderRevision",
7
+ NewerRevision = "NewerRevision"
7
8
  }
8
- export declare function comparePuyaVersion(): {
9
+ export declare function comparePuyaVersion(): Promise<{
9
10
  target: string;
10
11
  found?: string;
11
12
  verdict: VersionCompareVerdict;
12
- };
13
- export declare function checkPuyaVersion(): void;
13
+ }>;
14
+ export declare function checkPuyaVersion(): Promise<void>;
package/puya/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import type { AWST } from '../awst/nodes';
2
2
  import type { CompilationSet } from '../awst_build/models/contract-class-model';
3
- import type { CompileOptions } from '../compile-options';
3
+ import type { PuyaTsCompileOptions } from '../compile-options';
4
4
  import type { SourceFileMapping } from '../parser';
5
5
  import type { PuyaPassThroughOptions } from './options';
6
6
  export declare function invokePuya({ moduleAwst, programDirectory, sourceFiles, compileOptions, compilationSet, passThroughOptions, }: {
7
7
  moduleAwst: AWST[];
8
8
  programDirectory: string;
9
9
  sourceFiles: SourceFileMapping;
10
- compileOptions: CompileOptions;
10
+ compileOptions: PuyaTsCompileOptions;
11
11
  compilationSet: CompilationSet;
12
12
  passThroughOptions: PuyaPassThroughOptions;
13
- }): void;
13
+ }): Promise<void>;
@@ -3,4 +3,4 @@ export declare function runPuya({ command, args, cwd, onOutput, }: {
3
3
  args: string[];
4
4
  cwd?: string;
5
5
  onOutput: (line: string) => void;
6
- }): void;
6
+ }): Promise<void>;
@@ -0,0 +1,13 @@
1
+ type InvokeCliOptions = {
2
+ command: string;
3
+ args: string[];
4
+ cwd?: string;
5
+ onReceiveLine?(line: string): void;
6
+ dontThrowOnNonzeroCode?: boolean;
7
+ };
8
+ type InvokeCliResponse = {
9
+ lines: string[];
10
+ code: number;
11
+ };
12
+ export declare function invokeCli(options: InvokeCliOptions): Promise<InvokeCliResponse>;
13
+ export {};