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

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-DRDPe9MV.js} +45 -8
  3. package/analyser-service-DRDPe9MV.js.map +1 -0
  4. package/analyserService.mjs +7 -6
  5. package/analyserService.mjs.map +1 -1
  6. package/arc4-clientgen-sFEhO2LJ.js +324 -0
  7. package/arc4-clientgen-sFEhO2LJ.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-C1jtIFzd.js} +3 -3
  63. package/{check-node-version-CNvxI8_l.js.map → check-node-version-C1jtIFzd.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-D3rBypqy.js} +11 -4
  72. package/compile-D3rBypqy.js.map +1 -0
  73. package/compile.d.ts +1 -1
  74. package/constants.d.ts +7 -2
  75. package/contract-class-model-bHAozdbL.js +5456 -0
  76. package/contract-class-model-bHAozdbL.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-lB3ucfHV.js} +2666 -8407
  86. package/options-lB3ucfHV.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-CxwX2Y7m.js} +9 -45
  94. package/resolve-puya-path-CxwX2Y7m.js.map +1 -0
  95. package/semver-DSCCFKAJ.js +45 -0
  96. package/semver-DSCCFKAJ.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-Dz5YVLPa.js +63 -0
  102. package/util-Dz5YVLPa.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
package/README.md CHANGED
@@ -10,9 +10,11 @@ Algorand TypeScript is compiled for execution on the AVM by PuyaTs, a TypeScript
10
10
 
11
11
  ## Documentation
12
12
 
13
- - [Language Guide](https://algorandfoundation.github.io/puya-ts/documents/Algorand_TypeScript_Language_Guide.html)
14
- - [API Docs](https://algorandfoundation.github.io/puya-ts/modules.html)
15
- - [CLI Guide](https://algorandfoundation.github.io/puya-ts/documents/Compiler_CLI_Guide.html)
13
+ - [Language Guide](https://algorandfoundation.github.io/puya-ts/language-guide/)
14
+ - [API Reference](https://algorandfoundation.github.io/puya-ts/api/)
15
+ - [CLI Guide](https://algorandfoundation.github.io/puya-ts/cli/)
16
+ - [Migration Guides](https://algorandfoundation.github.io/puya-ts/migration-guides/)
17
+ - [Release Notes](https://github.com/algorandfoundation/puya-ts/releases)
16
18
  - [Contribution Guide](CONTRIBUTING.md)
17
- - [Releases Notes](https://github.com/algorandfoundation/puya-ts/releases)
18
- - [Migration Guides to 1.0.1](https://algorandfoundation.github.io/puya-ts/documents/Algorand_TypeScript_Migration_Guides.html)
19
+
20
+ For developing the documentation site locally, see the [docs README](docs/README.md).
@@ -1,6 +1,7 @@
1
1
  import require$$3__default, { randomUUID } from 'crypto';
2
2
  import { parentPort, workerData, Worker } from 'node:worker_threads';
3
- import { cU as AbsolutePath, d9 as DefaultMap, cO as registerPTypes, cP as typeRegistry, cT as CompileOptions, c_ as createTsProgram, db as relinquishThread, cS as LoggingContext, c$ as buildAwst, d0 as validateAwst, cX as deserializeAndLog, C as Constants, d7 as InternalError, cY as LogLevel, cZ as logger, cW as PuyaService, dc as isIn, dd as LogSource, cR as processInputPaths } from './options-COFRHTFQ.js';
3
+ import { f as AbsolutePath, b2 as LoggingContext, aa as Constants, aI as InternalError, b0 as LogLevel, ds as logger, de as isIn, b1 as LogSource } from './contract-class-model-bHAozdbL.js';
4
+ import { D as DefaultMap, a2 as registerPTypes, a6 as typeRegistry, C as CompileOptions, R as createTsProgram, a3 as relinquishThread, N as buildAwst, a8 as validateAwst, X as deserializeAndLog, P as PuyaService, a1 as processInputPaths } from './options-lB3ucfHV.js';
4
5
  import pathe__default from 'pathe';
5
6
  import ts from 'typescript';
6
7
  import require$$0$2 from 'node:util';
@@ -80,8 +81,8 @@ function buildDependencyGraph(program) {
80
81
 
81
82
  function createTypedMessagePort(x) {
82
83
  return {
83
- postMessage(message) {
84
- x.postMessage(message);
84
+ postMessage(message, transfer) {
85
+ x.postMessage(message, transfer ?? []);
85
86
  },
86
87
  onMessage(listener) {
87
88
  x.on('message', listener);
@@ -11123,6 +11124,33 @@ function mapPosition(position) {
11123
11124
  };
11124
11125
  }
11125
11126
 
11127
+ function LogExceptions(target) {
11128
+ return function (...args) {
11129
+ try {
11130
+ const result = target.apply(this, args);
11131
+ if (result instanceof Promise) {
11132
+ return result.catch((e) => {
11133
+ logCaughtExpression(e);
11134
+ process.exit(1);
11135
+ });
11136
+ }
11137
+ return result;
11138
+ }
11139
+ catch (e) {
11140
+ logCaughtExpression(e);
11141
+ process.exit(1);
11142
+ }
11143
+ };
11144
+ }
11145
+ function logCaughtExpression(e) {
11146
+ if (e instanceof Error) {
11147
+ logger.error(e);
11148
+ }
11149
+ else {
11150
+ logger.error(undefined, `Unknown error ${e}`);
11151
+ }
11152
+ }
11153
+
11126
11154
  function normalisedUri(args) {
11127
11155
  if ('fsPath' in args) {
11128
11156
  const resolvedFileName = globSync(args.fsPath, { absolute: true })[0];
@@ -11268,11 +11296,18 @@ if (parentPort) {
11268
11296
  ]);
11269
11297
  new AnalyseWorker(typedPort, workerData);
11270
11298
  }
11299
+ function resolveTsxModulePath() {
11300
+ const resolve = import.meta.resolve ?? require.resolve;
11301
+ const tsx = resolve('tsx');
11302
+ if (tsx.startsWith('file://')) {
11303
+ return URI.parse(tsx).fsPath;
11304
+ }
11305
+ return tsx;
11306
+ }
11271
11307
  function buildWorker({ workerData }) {
11272
11308
  const workerFile = import.meta.filename ?? __filename;
11273
11309
  if (workerFile.endsWith('.ts')) {
11274
- const resolve = import.meta.resolve ?? require.resolve;
11275
- const tsx = resolve('tsx');
11310
+ const tsx = resolveTsxModulePath();
11276
11311
  return new Worker(workerFile, {
11277
11312
  execArgv: ['--require', tsx],
11278
11313
  workerData,
@@ -11286,7 +11321,9 @@ function buildWorker({ workerData }) {
11286
11321
  }
11287
11322
  function createAnalyserService(options) {
11288
11323
  const worker = buildWorker({ workerData: options });
11289
- worker.on('error', (err) => logger.error(err));
11324
+ worker.on('error', (err) => {
11325
+ logCaughtExpression(err);
11326
+ });
11290
11327
  const typedWorker = createTypedMessagePort(worker);
11291
11328
  const responses = new Map();
11292
11329
  typedWorker.onMessage((message) => {
@@ -11336,5 +11373,5 @@ function createAnalyserService(options) {
11336
11373
  };
11337
11374
  }
11338
11375
 
11339
- export { createNormalisedTextDocumentConnection as a, createAnalyserService as c, isCodeFixData as i, normalisedUri as n, requireMain as r };
11340
- //# sourceMappingURL=analyser-service-_vXhzOY0.js.map
11376
+ export { LogExceptions as L, createNormalisedTextDocumentConnection as a, createAnalyserService as c, isCodeFixData as i, logCaughtExpression as l, normalisedUri as n, requireMain as r };
11377
+ //# sourceMappingURL=analyser-service-DRDPe9MV.js.map