@algorandfoundation/puya-ts 1.2.0-beta.2 → 1.2.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/{analyser-service-DSK9g7zQ.js → analyser-service-CGprVWba.js} +409 -372
- package/analyser-service-CGprVWba.js.map +1 -0
- package/analyserService.mjs +7 -6
- package/analyserService.mjs.map +1 -1
- package/arc4-clientgen-C7FQSt3R.js +324 -0
- package/arc4-clientgen-C7FQSt3R.js.map +1 -0
- package/arc4-clientgen.d.ts +6 -0
- package/awst/intrinsic-factory.d.ts +4 -2
- package/awst/node-factory.d.ts +1 -0
- package/awst/nodes.d.ts +22 -2
- package/awst/to-code-visitor.d.ts +2 -0
- package/awst/validation/awst-traverser.d.ts +3 -1
- package/awst/wtypes.d.ts +8 -1
- package/awst_build/arc4-util.d.ts +1 -38
- package/awst_build/ast-visitors/contract-method-visitor.d.ts +0 -2
- package/awst_build/eb/arc28/arc-28-emit-function-builder.d.ts +1 -2
- package/awst_build/eb/arc4/uintn.d.ts +1 -1
- package/awst_build/eb/arc4/util.d.ts +1 -0
- package/awst_build/eb/array-like/util.d.ts +0 -1
- package/awst_build/eb/logged-error-builder.d.ts +11 -0
- package/awst_build/models/decorator-data.d.ts +1 -0
- package/awst_build/ptypes/for-export.d.ts +0 -1
- package/awst_build/ptypes/index.d.ts +2 -0
- package/bin/puyats-clientgen.d.ts +2 -0
- package/bin/puyats-clientgen.mjs +101 -0
- package/bin/puyats-clientgen.mjs.map +1 -0
- package/bin/puyats-ls.mjs +21 -46
- package/bin/puyats-ls.mjs.map +1 -1
- package/bin/run-cli.mjs +18 -12
- package/bin/run-cli.mjs.map +1 -1
- package/{check-node-version-BtcNqlid.js → check-node-version-DcMVGPC-.js} +3 -3
- package/{check-node-version-BtcNqlid.js.map → check-node-version-DcMVGPC-.js.map} +1 -1
- package/cli/build-command.d.ts +2 -0
- package/cli.mjs +36 -76
- package/cli.mjs.map +1 -1
- package/clientgen.d.ts +1 -0
- package/code-fix/{invalid-non-null-assertion.d.ts → no-op-non-null-assertion.d.ts} +1 -1
- package/{compile-Cj7vjDbw.js → compile-D0CpLiRh.js} +13 -4
- package/compile-D0CpLiRh.js.map +1 -0
- package/compile.d.ts +1 -1
- package/constants.d.ts +1 -1
- package/contract-class-model-CLKobHyV.js +5574 -0
- package/contract-class-model-CLKobHyV.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.mjs +17 -10
- package/index.mjs.map +1 -1
- package/logger/index.d.ts +1 -0
- package/{options-Cbipn6vL.js → options-B93nVWrL.js} +2419 -8288
- package/options-B93nVWrL.js.map +1 -0
- package/options.d.ts +4 -0
- package/package.json +13 -12
- package/puya/puya-service.d.ts +5 -1
- package/{resolve-puya-path-CsuzbFH2.js → resolve-puya-path-D7qDcdPx.js} +9 -45
- package/resolve-puya-path-D7qDcdPx.js.map +1 -0
- package/semver-BPw8lYGI.js +45 -0
- package/semver-BPw8lYGI.js.map +1 -0
- package/util/typed-message-port.d.ts +2 -2
- package/util-BhM5b2cL.js +63 -0
- package/util-BhM5b2cL.js.map +1 -0
- package/visitor/syntax-names.d.ts +190 -190
- package/analyser-service-DSK9g7zQ.js.map +0 -1
- package/compile-Cj7vjDbw.js.map +0 -1
- package/options-Cbipn6vL.js.map +0 -1
- package/puya/index.d.ts +0 -14
- package/resolve-puya-path-CsuzbFH2.js.map +0 -1
- package/util/arc4-signature-parser.d.ts +0 -14
package/compile-Cj7vjDbw.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-Cj7vjDbw.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 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,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,EACd,WAAW,GAQZ,EAAA;AACC,IAAA,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC;IAC/C,MAAM,gBAAgB,GAAG,WAAW,IAAI,IAAI,WAAW,CAAC,EAAE,QAAQ,E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