@algorandfoundation/puya-ts 1.2.0-beta.4 → 1.2.0-beta.40

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.
Files changed (111) hide show
  1. package/README.md +7 -5
  2. package/{analyser-service-_vXhzOY0.js → analyser-service-D0IsFlp4.js} +409 -372
  3. package/analyser-service-D0IsFlp4.js.map +1 -0
  4. package/analyserService.mjs +7 -6
  5. package/analyserService.mjs.map +1 -1
  6. package/arc4-clientgen-BMCeFyNd.js +324 -0
  7. package/arc4-clientgen-BMCeFyNd.js.map +1 -0
  8. package/arc4-clientgen.d.ts +6 -0
  9. package/awst/intrinsic-factory.d.ts +4 -2
  10. package/awst/json-serialize-awst.d.ts +0 -1
  11. package/awst/node-factory.d.ts +1 -0
  12. package/awst/nodes.d.ts +26 -15
  13. package/awst/source-location.d.ts +0 -1
  14. package/awst/to-code-visitor.d.ts +3 -2
  15. package/awst/validation/arc4-approval-calls-router.d.ts +1 -1
  16. package/awst/validation/{awst-traverser.d.ts → function-traverser.d.ts} +4 -10
  17. package/awst/wtypes.d.ts +47 -45
  18. package/awst_build/arc4-util.d.ts +1 -38
  19. package/awst_build/ast-visitors/base-visitor.d.ts +0 -1
  20. package/awst_build/ast-visitors/class-definition-visitor.d.ts +721 -1
  21. package/awst_build/ast-visitors/contract-method-visitor.d.ts +3 -5
  22. package/awst_build/ast-visitors/function-visitor.d.ts +721 -1
  23. package/awst_build/ast-visitors/text-visitor.d.ts +721 -1
  24. package/awst_build/context/awst-build-context.d.ts +1 -1
  25. package/awst_build/eb/arc28/arc-28-emit-function-builder.d.ts +1 -2
  26. package/awst_build/eb/arc4/arrays.d.ts +2 -1
  27. package/awst_build/eb/arc4/c2c.d.ts +0 -17
  28. package/awst_build/eb/arc4/uintn.d.ts +1 -1
  29. package/awst_build/eb/arc4/util.d.ts +1 -0
  30. package/awst_build/eb/array-like/arrays.d.ts +3 -2
  31. package/awst_build/eb/array-like/util.d.ts +0 -1
  32. package/awst_build/eb/bytes-expression-builder.d.ts +0 -28
  33. package/awst_build/eb/contract-builder.d.ts +0 -11
  34. package/awst_build/eb/index.d.ts +0 -2
  35. package/awst_build/eb/literal/object-literal-expression-builder.d.ts +8 -4
  36. package/awst_build/eb/logged-error-builder.d.ts +11 -0
  37. package/awst_build/eb/objects/util.d.ts +0 -2
  38. package/awst_build/eb/op-module-builder.d.ts +0 -3
  39. package/awst_build/eb/storage/box/box.d.ts +1 -21
  40. package/awst_build/eb/storage/global-map.d.ts +21 -0
  41. package/awst_build/eb/storage/local-map.d.ts +21 -0
  42. package/awst_build/eb/string-expression-builder.d.ts +0 -6
  43. package/awst_build/eb/util/resolve-compat-builder.d.ts +0 -8
  44. package/awst_build/models/decorator-data.d.ts +1 -0
  45. package/awst_build/op-metadata.d.ts +4 -3
  46. package/awst_build/ptypes/arc4-types.d.ts +11 -7
  47. package/awst_build/ptypes/base.d.ts +5 -0
  48. package/awst_build/ptypes/for-export.d.ts +0 -1
  49. package/awst_build/ptypes/index.d.ts +103 -100
  50. package/awst_build/ptypes/util.d.ts +2 -2
  51. package/awst_build/ptypes/visitor.d.ts +3 -1
  52. package/awst_build/ptypes/visitors/default-visitor.d.ts +3 -1
  53. package/awst_build/ptypes/visitors/index-type-visitor.d.ts +0 -31
  54. package/awst_build/type-resolver.d.ts +1 -1
  55. package/bin/puyats-clientgen.d.ts +2 -0
  56. package/bin/puyats-clientgen.mjs +101 -0
  57. package/bin/puyats-clientgen.mjs.map +1 -0
  58. package/bin/puyats-ls.mjs +24 -49
  59. package/bin/puyats-ls.mjs.map +1 -1
  60. package/bin/run-cli.mjs +19 -13
  61. package/bin/run-cli.mjs.map +1 -1
  62. package/{check-node-version-CNvxI8_l.js → check-node-version-BP_a9Mv8.js} +3 -3
  63. package/{check-node-version-CNvxI8_l.js.map → check-node-version-BP_a9Mv8.js.map} +1 -1
  64. package/cli/build-command.d.ts +2 -0
  65. package/cli-ls.d.ts +1 -1
  66. package/cli.d.ts +1 -1
  67. package/cli.mjs +39 -79
  68. package/cli.mjs.map +1 -1
  69. package/clientgen.d.ts +1 -0
  70. package/code-fix/{invalid-non-null-assertion.d.ts → no-op-non-null-assertion.d.ts} +1 -1
  71. package/{compile-Bz8LVwK2.js → compile-BaYaEC1Y.js} +11 -4
  72. package/compile-BaYaEC1Y.js.map +1 -0
  73. package/compile.d.ts +1 -1
  74. package/constants.d.ts +7 -2
  75. package/contract-class-model-pgJctz5F.js +5456 -0
  76. package/contract-class-model-pgJctz5F.js.map +1 -0
  77. package/errors.d.ts +1 -6
  78. package/index.d.ts +1 -2
  79. package/index.mjs +36 -26
  80. package/index.mjs.map +1 -1
  81. package/language-server/analyser-service.d.ts +0 -1
  82. package/language-server/compile-trigger-queue.d.ts +2 -2
  83. package/language-server/puya-language-server.d.ts +0 -38
  84. package/logger/index.d.ts +0 -7
  85. package/{options-COFRHTFQ.js → options-8bOJR8qx.js} +2776 -8517
  86. package/options-8bOJR8qx.js.map +1 -0
  87. package/options.d.ts +8 -3
  88. package/package.json +20 -12
  89. package/puya/check-puya-version.d.ts +0 -13
  90. package/puya/index.d.ts +1 -1
  91. package/puya/log-deserializer.d.ts +0 -2
  92. package/puya/puya-service.d.ts +5 -1
  93. package/{resolve-puya-path-DtTAMi0Y.js → resolve-puya-path-EZBzWIlE.js} +9 -45
  94. package/resolve-puya-path-EZBzWIlE.js.map +1 -0
  95. package/semver-DpFo0aCr.js +45 -0
  96. package/semver-DpFo0aCr.js.map +1 -0
  97. package/util/base-85.d.ts +1 -4
  98. package/util/generate-temp-file.d.ts +0 -8
  99. package/util/index.d.ts +1 -3
  100. package/util/typed-message-port.d.ts +2 -2
  101. package/util-JPoBh0Op.js +63 -0
  102. package/util-JPoBh0Op.js.map +1 -0
  103. package/visitor/syntax-names.d.ts +194 -194
  104. package/visitor/visitor.d.ts +4 -4
  105. package/analyser-service-_vXhzOY0.js.map +0 -1
  106. package/compile-Bz8LVwK2.js.map +0 -1
  107. package/language-server/ls-logger.d.ts +0 -11
  108. package/options-COFRHTFQ.js.map +0 -1
  109. package/resolve-puya-path-DtTAMi0Y.js.map +0 -1
  110. package/util/arc4-signature-parser.d.ts +0 -14
  111. package/util/polyfills.d.ts +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"compile-Bz8LVwK2.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 puyaService,\n}: {\n moduleAwst: AWST[]\n programDirectory: AbsolutePath\n sourceFiles: SourceFileMapping\n options: CompileOptions\n compilationSet: CompilationSet\n puyaService?: PuyaService\n}) {\n const puyaPath = await resolvePuyaPath(options)\n const localPuyaService = puyaService ?? new PuyaService({ puyaPath })\n const puyaOptions = options.buildPuyaOptions(\n buildCompilationSetMapping({\n awst: moduleAwst,\n inputPaths: options.filePaths,\n compilationSet,\n }),\n )\n\n const response = await localPuyaService.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 // Shutdown service if we created it locally\n if (puyaService === undefined) await localPuyaService.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 { PuyaService } from './puya/puya-service'\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, puyaService?: PuyaService): Promise<CompileResult> {\n const loggerCtx = LoggingContext.current\n if (options.treatWarningsAsErrors) loggerCtx.treatWarningsAsErrors = true\n\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 puyaService,\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,W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,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;YACtC,WAAW;AACZ,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,11 +0,0 @@
1
- import type * as lsp from 'vscode-languageserver/node';
2
- export declare class LsLogger {
3
- #private;
4
- private readonly connection;
5
- constructor(connection: lsp.Connection);
6
- info(message: string): void;
7
- debug(message: string): void;
8
- log(message: string): void;
9
- warn(message: string): void;
10
- error(message: string): void;
11
- }