@taqueria/plugin-ligo 0.40.7 → 0.40.10
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/common.ts +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/index.mjs +2 -1
- package/index.mjs.map +1 -1
- package/package.json +2 -2
package/common.ts
CHANGED
|
@@ -45,7 +45,7 @@ export const formatLigoError = (err: Error): Error => {
|
|
|
45
45
|
&& result.includes('Module Contract not found with last Contract.')
|
|
46
46
|
) {
|
|
47
47
|
result =
|
|
48
|
-
`
|
|
48
|
+
`By convention, Taqueria expects you to import your contract with Contract as the module name.\nFor instance, if you have a contract in a file called "increment.mligo", in your parameter/storage list file you must include #import "Increment.mligo" "Contract" for compilation to be successful.`;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
err.message = result.replace(
|
package/index.js
CHANGED
|
@@ -104,7 +104,8 @@ var getInputFilenameRelPath = (parsedArgs, sourceFile) => (0, import_path.join)(
|
|
|
104
104
|
var formatLigoError = (err) => {
|
|
105
105
|
let result = err.message.replace(/Command failed.+?\n/, "");
|
|
106
106
|
if (result.includes("An internal error ocurred. Please, contact the developers.") && result.includes("Module Contract not found with last Contract.")) {
|
|
107
|
-
result = `
|
|
107
|
+
result = `By convention, Taqueria expects you to import your contract with Contract as the module name.
|
|
108
|
+
For instance, if you have a contract in a file called "increment.mligo", in your parameter/storage list file you must include #import "Increment.mligo" "Contract" for compilation to be successful.`;
|
|
108
109
|
}
|
|
109
110
|
err.message = result.replace(
|
|
110
111
|
"An internal error ocurred. Please, contact the developers.",
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","compile-all.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'module',\n\t\t\t\t\tshortFlag: 'm',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The LIGO module to be compiled',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile-all',\n\t\t\tcommand: 'compile-all',\n\t\t\tdescription:\n\t\t\t\t'Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'get-image',\n\t\t\tcommand: 'get-image',\n\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\thandler: 'proxy',\n\t\t\thidden: true,\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: main,\n\tpostInstall: `node ${__dirname}/postinstall.js`,\n}), process.argv);\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === 'jsligo') return jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return mligo_template;\n\t\tif (ext === 'jsligo') return jsligo_template;\n\t\treturn sendAsyncErr(\n\t\t\t`Unable to infer LIGO syntax from \"${contractName}\". Please specify a LIGO syntax via the --syntax option`,\n\t\t);\n\t} else {\n\t\treturn sendAsyncErr(`\"${syntax}\" is not a valid syntax. Please specify a valid LIGO syntax`);\n\t}\n};\n\nconst createContract = (args: RequestArgs.t) => {\n\tconst unsafeOpts = args as unknown as Opts;\n\tconst contractName = unsafeOpts.sourceFileName as string;\n\tconst syntax = unsafeOpts.syntax;\n\tconst contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\ntype return = operation list * storage\n\n(* Three entrypoints *)\n[@entry] let increment (delta : int) (store : storage) : return =\n [], store + delta\n[@entry] let decrement (delta : int) (store : storage) : return =\n [], store - delta\n[@entry] let reset (() : unit) (_ : storage) : return =\n [], 0\n`;\n\n\nexport const jsligo_template = `\ntype storage = int;\ntype ret = [list<operation>, storage];\n\n// Three entrypoints\n\n// @entry\nconst increment = (delta : int, store : storage) : ret =>\n [list([]), store + delta];\n\n// @entry\nconst decrement = (delta : int, store : storage) : ret =>\n [list([]), store - delta];\n\n// @entry\nconst reset = (_ : unit, _ : storage) : ret =>\n [list([]), 0];\n`;\n","import { RequestArgs, sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport compileAll from './compile-all';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: RequestArgs.t): Promise<void> => {\n\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\tswitch (unsafeOpts.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(unsafeOpts);\n\t\tcase 'compile':\n\t\t\treturn compile(unsafeOpts);\n\t\tcase 'compile-all':\n\t\t\treturn compileAll(unsafeOpts);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tcase 'get-image':\n\t\t\treturn sendAsyncRes(getLigoDockerImage());\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default main;\n","import { getDockerImage, sendErr } from '@taqueria/node-sdk';\nimport { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends ProxyTaskArgs.t {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends ProxyTaskArgs.t {\n\tsourceFile: string;\n\tjson: boolean;\n\tmodule?: string;\n}\n\nexport interface CompileAllOpts extends ProxyTaskArgs.t {\n\tjson: boolean;\n}\n\nexport interface TestOpts extends RequestArgs.t {\n\ttask?: string;\n\tsourceFile?: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & CompileAllOpts & TestOpts;\n\nexport type UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;\n\n// Should point to the latest stable version, so it needs to be updated as part of our release process.\nconst LIGO_DEFAULT_IMAGE = 'ligolang/ligo:0.73.0';\n\nconst LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';\n\nexport const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);\n\nexport const getInputFilenameAbsPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const getInputFilenameRelPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const formatLigoError = (err: Error): Error => {\n\tlet result = err.message.replace(/Command failed.+?\\n/, '');\n\tif (\n\t\tresult.includes('An internal error ocurred. Please, contact the developers.')\n\t\t&& result.includes('Module Contract not found with last Contract.')\n\t) {\n\t\tresult =\n\t\t\t`The contract must be imported with \"Contract\" as the namespace: #import \"path/to/contract.ligo\" \"Contract\"`;\n\t}\n\n\terr.message = result.replace(\n\t\t'An internal error ocurred. Please, contact the developers.',\n\t\t'The LIGO compiler experienced an internal error. Please contact the LIGO developers.',\n\t);\n\n\treturn err;\n};\n\nexport const emitExternalError = (errs: unknown[] | unknown, sourceFile: string): void => {\n\tsendErr(`\\n=== Error messages for ${sourceFile} ===`);\n\tconst errors = Array.isArray(errs) ? errs : [errs];\n\terrors.map(err => {\n\t\terr instanceof Error ? sendErr(err.message) : sendErr(err as any);\n\t});\n\tsendErr(`===`);\n};\n","import {\n\texecCmd,\n\tgetArch,\n\tgetArtifactsDir,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tsendRes,\n\tsendWarn,\n} from '@taqueria/node-sdk';\nimport { createReadStream } from 'fs';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport * as readline from 'readline';\nimport {\n\tCompileOpts as Opts,\n\temitExternalError,\n\tformatLigoError,\n\tgetInputFilenameAbsPath,\n\tgetInputFilenameRelPath,\n\tgetLigoDockerImage,\n\tUnionOpts,\n} from './common';\n\nexport type TableRow = { source: string; artifact: string; err?: unknown };\n\nexport type ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nexport type Syntax = 'mligo' | 'jsligo' | 'religo' | 'ligo';\n\nexport type ModuleInfo = {\n\tmoduleName: string;\n\tsourceName: string;\n\tsourceFile: string;\n\tsyntax: Syntax;\n\ttype: 'file-main' | 'file-entry' | 'module-main' | 'module-entry';\n};\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nexport const isSupportedLigoSyntax = (sourceFile: string) => /\\.(mligo|jsligo)$/.test(sourceFile);\n\nexport const isUnsupportedLigoSyntax = (sourceFile: string) => /\\.(ligo|religo)$/.test(sourceFile);\n\nexport const isLIGOFile = (sourceFile: string) =>\n\tisSupportedLigoSyntax(sourceFile) || isUnsupportedLigoSyntax(sourceFile);\n\nexport const isStorageListFile = (sourceFile: string): boolean =>\n\t/.+\\.(storageList|storages)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const isParameterListFile = (sourceFile: string): boolean =>\n\t/.+\\.(parameterList|parameters)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const listContractModules = async (parsedArgs: UnionOpts, sourceFile: string): Promise<ModuleInfo[]> => {\n\ttry {\n\t\tawait getArch();\n\t\tconst cmd = await getListDeclarationsCmd(parsedArgs, sourceFile);\n\t\tconst { stderr, stdout } = await execCmd(cmd);\n\t\tif (stderr.length > 0) return Promise.reject(stderr);\n\n\t\treturn JSON.parse(stdout).declarations.reduce(\n\t\t\t(acc: ModuleInfo[], decl: string) => {\n\t\t\t\t// We need to process delcarations (decl) like so:\n\t\t\t\t// 1. If the decl is equal to the string \"main\", then the module type is \"file-main\" and the name of the module is the sourceFile.\n\t\t\t\t// 2. If the decl is equal to $main, then the module type is \"file-entry\" and the name fo the module is the sourceFile.\n\t\t\t\t// 3. If the decl ends with .main, then the module type is \"module-main\" and the name of the module is the decl without the .main suffix.\n\t\t\t\t// 4. If the decl ends with .$main, then the module type is \"module-entry\" and the name of the module is the decl without the .$main suffix.\n\t\t\t\t// Otherwise, this is not a declaration we care about.\n\t\t\t\tconst srcFile = removeExt(basename(sourceFile));\n\t\t\t\tconst syntax = extractExt(sourceFile).replace('.', '');\n\n\t\t\t\tif (decl === 'main') {\n\t\t\t\t\treturn [...acc, { moduleName: srcFile, sourceName: sourceFile, sourceFile, type: 'file-main', syntax }];\n\t\t\t\t} else if (decl === '$main') {\n\t\t\t\t\treturn [...acc, { moduleName: srcFile, sourceName: sourceFile, sourceFile, type: 'file-entry', syntax }];\n\t\t\t\t} else if (decl.endsWith('.main')) {\n\t\t\t\t\tconst moduleName = decl.replace(/\\.main$/, '');\n\t\t\t\t\treturn [...acc, {\n\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\ttype: 'module-main',\n\t\t\t\t\t\tsyntax,\n\t\t\t\t\t}];\n\t\t\t\t} else if (decl.endsWith('.$main')) {\n\t\t\t\t\tconst moduleName = decl.replace(/\\.\\$main$/, '');\n\t\t\t\t\treturn [...acc, {\n\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\ttype: 'module-entry',\n\t\t\t\t\t\tsyntax,\n\t\t\t\t\t}];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t[],\n\t\t);\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn [];\n\t}\n};\n\nconst getListDeclarationsCmd = async (parsedArgs: UnionOpts, sourceFile: string): Promise<string> => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} info list-declarations`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst flags = '--display-format json';\n\tconst cmd = `${baseCmd} ${inputFile} ${flags}`;\n\treturn cmd;\n};\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst isOutputFormatJSON = (parsedArgs: Opts): boolean => parsedArgs.json;\n\nconst getOutputContractFilename = (parsedArgs: Opts, module: ModuleInfo): string => {\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\treturn join(getArtifactsDir(parsedArgs), `${module.moduleName}${ext}`);\n};\n\nconst getOutputExprFilename = (parsedArgs: Opts, module: ModuleInfo, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = module.moduleName;\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage${ext}`\n\t\t: `${contractName}.${exprKind}.${exprName}${ext}`;\n\treturn join(getArtifactsDir(parsedArgs), `${outputFile}`);\n};\n\nconst getCompileContractCmd = async (parsedArgs: Opts, sourceFile: string, module: ModuleInfo): Promise<string> => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputContractFilename(parsedArgs, module)}`;\n\tconst flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\tconst moduleFlag = module.type.startsWith('file-') ? '' : `-m ${module.moduleName}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}${moduleFlag}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n\texprName: string,\n): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFilename(parsedArgs, module, exprKind, exprName)}`;\n\tconst flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\n\t// Parameter and Storage list files are expected to import the smart contract file as the \"Contract\" module.\n\tconst moduleFlag = (() => {\n\t\tswitch (module.type) {\n\t\t\tcase 'file-main':\n\t\t\tcase 'file-entry':\n\t\t\t\treturn '-m Contract';\n\t\t\tdefault:\n\t\t\t\treturn `-m Contract.${module.moduleName}`;\n\t\t}\n\t})();\n\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags} ${moduleFlag}`;\n\treturn cmd;\n};\n\nconst compileContract = async (parsedArgs: Opts, sourceFile: string, module: ModuleInfo): Promise<TableRow> => {\n\ttry {\n\t\tawait getArch();\n\t\tconst cmd = await getCompileContractCmd(parsedArgs, sourceFile, module);\n\t\tconst { stderr } = await execCmd(cmd);\n\t\tif (stderr.length > 0) sendWarn(stderr);\n\n\t\treturn {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: getOutputContractFilename(parsedArgs, module),\n\t\t};\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t};\n\t}\n};\n\nconst compileExpr =\n\t(parsedArgs: Opts, sourceFile: string, module: ModuleInfo, exprKind: ExprKind) =>\n\t(exprName: string): Promise<TableRow> => {\n\t\treturn getArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, module, exprKind, exprName))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => {\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\tconst artifactName = getOutputExprFilename(parsedArgs, module, exprKind, exprName);\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: artifactName,\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: `${exprName} in ${sourceFile} not compiled`,\n\t\t\t\t\terr,\n\t\t\t\t};\n\t\t\t});\n\t};\n\nconst getExprNames = (parsedArgs: Opts, sourceFile: string): Promise<string[]> => {\n\treturn new Promise((resolve, reject) => {\n\t\tconst inputFilePath = getInputFilenameAbsPath(parsedArgs, sourceFile);\n\t\tconst readInterface = readline.createInterface({\n\t\t\tinput: createReadStream(inputFilePath),\n\t\t\toutput: process.stdout,\n\t\t});\n\n\t\tconst variableNames: string[] = [];\n\n\t\treadInterface.on('line', function(line) {\n\t\t\t// Skip lines that start with a comment\n\t\t\tif (!line.trim().startsWith('//')) {\n\t\t\t\tconst matches = line.match(/(?<=\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g);\n\t\t\t\tif (matches) {\n\t\t\t\t\tvariableNames.push(...matches);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treadInterface.on('close', function() {\n\t\t\tresolve(variableNames);\n\t\t});\n\t});\n};\n\nconst compileExprs = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n): Promise<TableRow[]> => {\n\t// Get expressions from file\n\tlet exprs = [];\n\ttry {\n\t\texprs = await getExprNames(parsedArgs, sourceFile);\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn [{\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} expressions compiled`,\n\t\t}];\n\t}\n\n\tconst results = await Promise.all(exprs.map(async (exprName, index) => {\n\t\tconst compileResult = await compileExpr(\n\t\t\tparsedArgs,\n\t\t\tsourceFile,\n\t\t\tmodule,\n\t\t\texprKind === 'storage' && index === 0 ? 'default_storage' : exprKind,\n\t\t)(exprName);\n\t\treturn compileResult;\n\t}));\n\n\t// Collect errors\n\tconst errors = results.reduce(\n\t\t(acc, result) => {\n\t\t\tif (result.err) {\n\t\t\t\t// If its not an Error object, then just add it to the list\n\t\t\t\tif (!(result.err instanceof Error)) return [...acc, result.err];\n\n\t\t\t\t// Otherwise, get all ligo errors and ensure that the list is unique\n\t\t\t\tconst ligoErrs = (acc\n\t\t\t\t\t.filter(err => err instanceof Error) as Error[])\n\t\t\t\t\t.map(err => err.message);\n\n\t\t\t\tconst formattedError = formatLigoError(result.err);\n\n\t\t\t\treturn (ligoErrs.includes(formattedError.message)) ? acc : [...acc, formattedError];\n\t\t\t}\n\t\t\treturn acc;\n\t\t},\n\t\t[] as unknown[],\n\t);\n\n\t// Collect table rows\n\tconst retval = results.map(({ source, artifact }) => ({ source, artifact }));\n\n\tif (errors.length) emitExternalError(errors, sourceFile);\n\n\treturn retval;\n};\n\n// Helper function to get the initial message based on the pair value\nconst getInitialMessage = (pair: string, module: ModuleInfo) => {\n\tconst messages = {\n\t\t'mligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t// ... any other combinations\n\t} as Record<string, string>;\n\n\treturn messages[pair] || '// This file was created by Taqueria.';\n};\n\n// Helper function to get a common message\nconst getCommonMsg = (langType: Syntax, listType: ExprKind) => {\n\tconst varKeyword = langType === 'mligo' ? 'let' : 'const';\n\tconst commonMsgForStorage = `// IMPORTANT: We suggest always explicitly typing your storage values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} storage: int = 10\\` or \\`${varKeyword} storage: Contract.storage = 10\\``;\n\n\tconst commonMsgForParameter = `// IMPORTANT: We suggest always explicitly typing your parameter values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} parameter: int = 10\\` or \\`${varKeyword} parameter: Contract.parameter = 10\\``;\n\n\treturn listType === 'storage' ? commonMsgForStorage : commonMsgForParameter;\n};\n\n// Main function to get the content for storage or parameter\nconst getContent = (moduleInfo: ModuleInfo, listType: ExprKind) => {\n\tconst linkToContract = `#import \"${moduleInfo.sourceFile}\" \"Contract\"`;\n\tconst pair = `${moduleInfo.syntax}-${moduleInfo.type}`;\n\tconst initialMsg = getInitialMessage(pair, moduleInfo);\n\tconst commonMsg = getCommonMsg(moduleInfo.syntax, listType);\n\n\treturn `${linkToContract}\\n\\n${initialMsg}\\n\\n${commonMsg}`;\n};\n\n// Usage for storage list\nconst initContentForStorage = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'storage');\n\n// Usage for parameter list\nconst initContentForParameter = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'parameter');\n\nexport const compileContractWithStorageAndParameter = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n): Promise<TableRow[]> => {\n\tconst contractCompileResult = await compileContract(parsedArgs, sourceFile, module);\n\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\tdebugger;\n\n\tconst storageListFile = `${module.moduleName}.storageList${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);\n\tconst storageCompileResult = await access(storageListFilename)\n\t\t.then(() => compileExprs(parsedArgs, storageListFile, module, 'storage'))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: storage file associated with \"${module.moduleName}\" can't be found, so \"${storageListFile}\" has been created for you. Use this file to define all initial storage values for this contract\\n`,\n\t\t\t);\n\t\t\treturn writeFile(storageListFilename, initContentForStorage(module), 'utf8');\n\t\t});\n\n\tconst parameterListFile = `${module.moduleName}.parameterList${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);\n\tconst parameterCompileResult = await access(parameterListFilename)\n\t\t.then(() => compileExprs(parsedArgs, parameterListFile, module, 'parameter'))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: parameter file associated with \"${module.moduleName}\" can't be found, so \"${parameterListFile}\" has been created for you. Use this file to define all parameter values for this contract\\n`,\n\t\t\t);\n\t\t\treturn writeFile(parameterListFilename, initContentForParameter(module), 'utf8');\n\t\t});\n\n\tconst storageArtifacts = storageCompileResult ? storageCompileResult.map(res => res.artifact).join('\\n') : '';\n\tconst parameterArtifacts = parameterCompileResult ? parameterCompileResult.map(res => res.artifact).join('\\n') : '';\n\n\tconst combinedArtifact = [\n\t\tcontractCompileResult.artifact,\n\t\tstorageArtifacts,\n\t\tparameterArtifacts,\n\t].filter(Boolean).join('\\n');\n\n\tconst combinedRow: TableRow = {\n\t\tsource: module.sourceName,\n\t\tartifact: combinedArtifact,\n\t};\n\n\treturn [combinedRow];\n};\n\nexport const compile = async (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!isLIGOFile(sourceFile)) {\n\t\tsendErr(`${sourceFile} is not a LIGO file`);\n\t\treturn;\n\t}\n\tif (isStorageListFile(sourceFile) || isParameterListFile(sourceFile)) {\n\t\tsendErr(`Storage and parameter list files are not meant to be compiled directly`);\n\t\treturn;\n\t}\n\tif (isUnsupportedLigoSyntax(sourceFile)) {\n\t\tsendErr(`Unsupported LIGO syntax detected in ${sourceFile}. Note, we only support .jsligo and .mligo files.`);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst modules = await listContractModules(parsedArgs, sourceFile);\n\t\tif (modules.length === 0) {\n\t\t\treturn sendJsonRes([\n\t\t\t\t{\n\t\t\t\t\tsource: sourceFile,\n\t\t\t\t\tartifact: `No contract modules found in \"${sourceFile}\"`,\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tlet allCompileResults: TableRow[] = [];\n\t\tfor (const module of modules) {\n\t\t\t// If we're only to compile a particular module, then we'll skip any that don't match\n\t\t\tif (parsedArgs.module && parsedArgs.module !== module.moduleName) continue;\n\n\t\t\tconst compileResults = await compileContractWithStorageAndParameter(parsedArgs, sourceFile, module);\n\t\t\tallCompileResults = allCompileResults.concat(compileResults);\n\t\t}\n\n\t\tsendJsonRes(allCompileResults, { footer: `\\nCompiled ${allCompileResults.length} contract(s) in \"${sourceFile}\"` });\n\t} catch (err) {\n\t\tsendErr(`Error processing \"${sourceFile}\": ${err}`);\n\t}\n};\n\nexport default compile;\n","import { sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport glob from 'fast-glob';\nimport { join } from 'path';\nimport { CompileAllOpts, CompileAllOpts as Opts, CompileOpts } from './common';\nimport {\n\tcompileContractWithStorageAndParameter,\n\tisParameterListFile,\n\tisStorageListFile,\n\tlistContractModules,\n\tTableRow,\n} from './compile';\n\nconst compileAll = async (parsedArgs: Opts): Promise<void> => {\n\tlet compilePromises: Promise<TableRow[]>[] = [];\n\n\tconst contractFilenames = await glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{\n\t\t\tcwd: join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts'),\n\t\t\tabsolute: false,\n\t\t},\n\t);\n\n\tfor (const filename of contractFilenames) {\n\t\tif (isStorageListFile(filename) || isParameterListFile(filename)) continue;\n\t\tconst moduleNames = await listContractModules(parsedArgs as unknown as CompileAllOpts, filename);\n\t\tfor (const moduleName of moduleNames) {\n\t\t\tcompilePromises.push(compileContractWithStorageAndParameter(parsedArgs as CompileOpts, filename, moduleName));\n\t\t}\n\t}\n\n\treturn Promise.all(compilePromises)\n\t\t.then(tables => tables.flat())\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendErr(err, false));\n};\n\nexport default compileAll;\n","import { execCmd, getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { readJsonFile, writeJsonFile } from '@taqueria/node-sdk';\nimport { join } from 'path';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (\n\tparsedArgs: Opts,\n\tuid: string,\n\tgid: string,\n\tuserArgs: string,\n): [string, Record<string, string>] => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\n\tconst userMap = uid && gid ? `${uid}:${gid}` : uid;\n\tconst userMapArgs = uid ? ['-u', userMap] : [];\n\n\tconst binary = 'docker';\n\tconst baseArgs = [\n\t\t'run',\n\t\t'--rm',\n\t\t'-v',\n\t\t`${projectDir}:/project`,\n\t\t'-w',\n\t\t'/project',\n\t\t...userMapArgs,\n\t\tgetLigoDockerImage(),\n\t];\n\tconst processedUserArgs = userArgs.split(' ').map(arg => arg.startsWith('\\\\-') ? arg.substring(1) : arg).filter(arg =>\n\t\targ\n\t);\n\tconst args = [...baseArgs, ...processedUserArgs, '--skip-analytics'];\n\tconst envVars = { 'DOCKER_DEFAULT_PLATFORM': 'linux/amd64' };\n\treturn [\n\t\t[binary, ...args].join(' '),\n\t\tenvVars,\n\t];\n};\n\nconst ensureEsyExists = async (parsedArgs: Opts): Promise<string> => {\n\tconst esyJsonPath = join(parsedArgs.projectDir, 'esy.json');\n\n\ttry {\n\t\treturn await readJsonFile(esyJsonPath);\n\t} catch {\n\t\treturn await writeJsonFile(esyJsonPath)({});\n\t}\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tensureEsyExists(parsedArgs)\n\t\t.then(getArch)\n\t\t.then(async () => {\n\t\t\tconst uid = await execCmd('id -u');\n\t\t\tconst gid = await execCmd('id -g');\n\t\t\treturn [uid.stdout.trim(), gid.stdout.trim()];\n\t\t})\n\t\t.then(([uid, gid]) => getArbitraryLigoCmd(parsedArgs, uid, gid, cmd))\n\t\t.then(([cmd, envVars]) => spawnCmd(cmd, envVars))\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { emitExternalError, getInputFilenameRelPath, getLigoDockerImage, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst cmd = `${baseCmd} ${inputFile}`;\n\treturn cmd;\n};\n\nconst testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stdout, stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nconst test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!sourceFile) return sendAsyncErr(`No source file provided`);\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAA8D;;;ACA9D,sBAA6B;AAE7B,sBAA0B;;;ACFnB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcvB,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ADJ/B,IAAM,kBAAkB,OAAO,cAAsB,WAAgD;AACpG,QAAM,cAAc,aAAa,MAAM,UAAU;AACjD,QAAM,MAAM,cAAc,YAAY,CAAC,EAAE,UAAU,CAAC,IAAI;AAExD,MAAI,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;AAAA,IACX,CAAC;AAAA,IACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,QAAQ;AAAA,IACT,CAAC;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACV,0BAAS,OAAO;AAAA,MACf,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,QACZ,+BAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACR,wBAAO,OAAO;AAAA,UACb,WAAW;AAAA,UACX,MAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AAAA,EACP,aAAa,QAAQ,SAAS;AAC/B,IAAI,QAAQ,IAAI;","names":["import_node_sdk","import_node_sdk","import_node_sdk","import_node_sdk","import_promises","import_path","module","import_node_sdk","import_path","glob","import_node_sdk","import_path","cmd","import_node_sdk"]}
|
|
1
|
+
{"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","compile-all.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'module',\n\t\t\t\t\tshortFlag: 'm',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The LIGO module to be compiled',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile-all',\n\t\t\tcommand: 'compile-all',\n\t\t\tdescription:\n\t\t\t\t'Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'get-image',\n\t\t\tcommand: 'get-image',\n\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\thandler: 'proxy',\n\t\t\thidden: true,\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: main,\n\tpostInstall: `node ${__dirname}/postinstall.js`,\n}), process.argv);\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === 'jsligo') return jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return mligo_template;\n\t\tif (ext === 'jsligo') return jsligo_template;\n\t\treturn sendAsyncErr(\n\t\t\t`Unable to infer LIGO syntax from \"${contractName}\". Please specify a LIGO syntax via the --syntax option`,\n\t\t);\n\t} else {\n\t\treturn sendAsyncErr(`\"${syntax}\" is not a valid syntax. Please specify a valid LIGO syntax`);\n\t}\n};\n\nconst createContract = (args: RequestArgs.t) => {\n\tconst unsafeOpts = args as unknown as Opts;\n\tconst contractName = unsafeOpts.sourceFileName as string;\n\tconst syntax = unsafeOpts.syntax;\n\tconst contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\ntype return = operation list * storage\n\n(* Three entrypoints *)\n[@entry] let increment (delta : int) (store : storage) : return =\n [], store + delta\n[@entry] let decrement (delta : int) (store : storage) : return =\n [], store - delta\n[@entry] let reset (() : unit) (_ : storage) : return =\n [], 0\n`;\n\n\nexport const jsligo_template = `\ntype storage = int;\ntype ret = [list<operation>, storage];\n\n// Three entrypoints\n\n// @entry\nconst increment = (delta : int, store : storage) : ret =>\n [list([]), store + delta];\n\n// @entry\nconst decrement = (delta : int, store : storage) : ret =>\n [list([]), store - delta];\n\n// @entry\nconst reset = (_ : unit, _ : storage) : ret =>\n [list([]), 0];\n`;\n","import { RequestArgs, sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport compileAll from './compile-all';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: RequestArgs.t): Promise<void> => {\n\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\tswitch (unsafeOpts.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(unsafeOpts);\n\t\tcase 'compile':\n\t\t\treturn compile(unsafeOpts);\n\t\tcase 'compile-all':\n\t\t\treturn compileAll(unsafeOpts);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tcase 'get-image':\n\t\t\treturn sendAsyncRes(getLigoDockerImage());\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default main;\n","import { getDockerImage, sendErr } from '@taqueria/node-sdk';\nimport { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends ProxyTaskArgs.t {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends ProxyTaskArgs.t {\n\tsourceFile: string;\n\tjson: boolean;\n\tmodule?: string;\n}\n\nexport interface CompileAllOpts extends ProxyTaskArgs.t {\n\tjson: boolean;\n}\n\nexport interface TestOpts extends RequestArgs.t {\n\ttask?: string;\n\tsourceFile?: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & CompileAllOpts & TestOpts;\n\nexport type UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;\n\n// Should point to the latest stable version, so it needs to be updated as part of our release process.\nconst LIGO_DEFAULT_IMAGE = 'ligolang/ligo:0.73.0';\n\nconst LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';\n\nexport const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);\n\nexport const getInputFilenameAbsPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const getInputFilenameRelPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const formatLigoError = (err: Error): Error => {\n\tlet result = err.message.replace(/Command failed.+?\\n/, '');\n\tif (\n\t\tresult.includes('An internal error ocurred. Please, contact the developers.')\n\t\t&& result.includes('Module Contract not found with last Contract.')\n\t) {\n\t\tresult =\n\t\t\t`By convention, Taqueria expects you to import your contract with Contract as the module name.\\nFor instance, if you have a contract in a file called \"increment.mligo\", in your parameter/storage list file you must include #import \"Increment.mligo\" \"Contract\" for compilation to be successful.`;\n\t}\n\n\terr.message = result.replace(\n\t\t'An internal error ocurred. Please, contact the developers.',\n\t\t'The LIGO compiler experienced an internal error. Please contact the LIGO developers.',\n\t);\n\n\treturn err;\n};\n\nexport const emitExternalError = (errs: unknown[] | unknown, sourceFile: string): void => {\n\tsendErr(`\\n=== Error messages for ${sourceFile} ===`);\n\tconst errors = Array.isArray(errs) ? errs : [errs];\n\terrors.map(err => {\n\t\terr instanceof Error ? sendErr(err.message) : sendErr(err as any);\n\t});\n\tsendErr(`===`);\n};\n","import {\n\texecCmd,\n\tgetArch,\n\tgetArtifactsDir,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tsendRes,\n\tsendWarn,\n} from '@taqueria/node-sdk';\nimport { createReadStream } from 'fs';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport * as readline from 'readline';\nimport {\n\tCompileOpts as Opts,\n\temitExternalError,\n\tformatLigoError,\n\tgetInputFilenameAbsPath,\n\tgetInputFilenameRelPath,\n\tgetLigoDockerImage,\n\tUnionOpts,\n} from './common';\n\nexport type TableRow = { source: string; artifact: string; err?: unknown };\n\nexport type ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nexport type Syntax = 'mligo' | 'jsligo' | 'religo' | 'ligo';\n\nexport type ModuleInfo = {\n\tmoduleName: string;\n\tsourceName: string;\n\tsourceFile: string;\n\tsyntax: Syntax;\n\ttype: 'file-main' | 'file-entry' | 'module-main' | 'module-entry';\n};\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nexport const isSupportedLigoSyntax = (sourceFile: string) => /\\.(mligo|jsligo)$/.test(sourceFile);\n\nexport const isUnsupportedLigoSyntax = (sourceFile: string) => /\\.(ligo|religo)$/.test(sourceFile);\n\nexport const isLIGOFile = (sourceFile: string) =>\n\tisSupportedLigoSyntax(sourceFile) || isUnsupportedLigoSyntax(sourceFile);\n\nexport const isStorageListFile = (sourceFile: string): boolean =>\n\t/.+\\.(storageList|storages)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const isParameterListFile = (sourceFile: string): boolean =>\n\t/.+\\.(parameterList|parameters)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const listContractModules = async (parsedArgs: UnionOpts, sourceFile: string): Promise<ModuleInfo[]> => {\n\ttry {\n\t\tawait getArch();\n\t\tconst cmd = await getListDeclarationsCmd(parsedArgs, sourceFile);\n\t\tconst { stderr, stdout } = await execCmd(cmd);\n\t\tif (stderr.length > 0) return Promise.reject(stderr);\n\n\t\treturn JSON.parse(stdout).declarations.reduce(\n\t\t\t(acc: ModuleInfo[], decl: string) => {\n\t\t\t\t// We need to process delcarations (decl) like so:\n\t\t\t\t// 1. If the decl is equal to the string \"main\", then the module type is \"file-main\" and the name of the module is the sourceFile.\n\t\t\t\t// 2. If the decl is equal to $main, then the module type is \"file-entry\" and the name fo the module is the sourceFile.\n\t\t\t\t// 3. If the decl ends with .main, then the module type is \"module-main\" and the name of the module is the decl without the .main suffix.\n\t\t\t\t// 4. If the decl ends with .$main, then the module type is \"module-entry\" and the name of the module is the decl without the .$main suffix.\n\t\t\t\t// Otherwise, this is not a declaration we care about.\n\t\t\t\tconst srcFile = removeExt(basename(sourceFile));\n\t\t\t\tconst syntax = extractExt(sourceFile).replace('.', '');\n\n\t\t\t\tif (decl === 'main') {\n\t\t\t\t\treturn [...acc, { moduleName: srcFile, sourceName: sourceFile, sourceFile, type: 'file-main', syntax }];\n\t\t\t\t} else if (decl === '$main') {\n\t\t\t\t\treturn [...acc, { moduleName: srcFile, sourceName: sourceFile, sourceFile, type: 'file-entry', syntax }];\n\t\t\t\t} else if (decl.endsWith('.main')) {\n\t\t\t\t\tconst moduleName = decl.replace(/\\.main$/, '');\n\t\t\t\t\treturn [...acc, {\n\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\ttype: 'module-main',\n\t\t\t\t\t\tsyntax,\n\t\t\t\t\t}];\n\t\t\t\t} else if (decl.endsWith('.$main')) {\n\t\t\t\t\tconst moduleName = decl.replace(/\\.\\$main$/, '');\n\t\t\t\t\treturn [...acc, {\n\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\ttype: 'module-entry',\n\t\t\t\t\t\tsyntax,\n\t\t\t\t\t}];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t[],\n\t\t);\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn [];\n\t}\n};\n\nconst getListDeclarationsCmd = async (parsedArgs: UnionOpts, sourceFile: string): Promise<string> => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} info list-declarations`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst flags = '--display-format json';\n\tconst cmd = `${baseCmd} ${inputFile} ${flags}`;\n\treturn cmd;\n};\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst isOutputFormatJSON = (parsedArgs: Opts): boolean => parsedArgs.json;\n\nconst getOutputContractFilename = (parsedArgs: Opts, module: ModuleInfo): string => {\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\treturn join(getArtifactsDir(parsedArgs), `${module.moduleName}${ext}`);\n};\n\nconst getOutputExprFilename = (parsedArgs: Opts, module: ModuleInfo, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = module.moduleName;\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage${ext}`\n\t\t: `${contractName}.${exprKind}.${exprName}${ext}`;\n\treturn join(getArtifactsDir(parsedArgs), `${outputFile}`);\n};\n\nconst getCompileContractCmd = async (parsedArgs: Opts, sourceFile: string, module: ModuleInfo): Promise<string> => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputContractFilename(parsedArgs, module)}`;\n\tconst flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\tconst moduleFlag = module.type.startsWith('file-') ? '' : `-m ${module.moduleName}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}${moduleFlag}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n\texprName: string,\n): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFilename(parsedArgs, module, exprKind, exprName)}`;\n\tconst flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\n\t// Parameter and Storage list files are expected to import the smart contract file as the \"Contract\" module.\n\tconst moduleFlag = (() => {\n\t\tswitch (module.type) {\n\t\t\tcase 'file-main':\n\t\t\tcase 'file-entry':\n\t\t\t\treturn '-m Contract';\n\t\t\tdefault:\n\t\t\t\treturn `-m Contract.${module.moduleName}`;\n\t\t}\n\t})();\n\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags} ${moduleFlag}`;\n\treturn cmd;\n};\n\nconst compileContract = async (parsedArgs: Opts, sourceFile: string, module: ModuleInfo): Promise<TableRow> => {\n\ttry {\n\t\tawait getArch();\n\t\tconst cmd = await getCompileContractCmd(parsedArgs, sourceFile, module);\n\t\tconst { stderr } = await execCmd(cmd);\n\t\tif (stderr.length > 0) sendWarn(stderr);\n\n\t\treturn {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: getOutputContractFilename(parsedArgs, module),\n\t\t};\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t};\n\t}\n};\n\nconst compileExpr =\n\t(parsedArgs: Opts, sourceFile: string, module: ModuleInfo, exprKind: ExprKind) =>\n\t(exprName: string): Promise<TableRow> => {\n\t\treturn getArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, module, exprKind, exprName))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => {\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\tconst artifactName = getOutputExprFilename(parsedArgs, module, exprKind, exprName);\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: artifactName,\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: `${exprName} in ${sourceFile} not compiled`,\n\t\t\t\t\terr,\n\t\t\t\t};\n\t\t\t});\n\t};\n\nconst getExprNames = (parsedArgs: Opts, sourceFile: string): Promise<string[]> => {\n\treturn new Promise((resolve, reject) => {\n\t\tconst inputFilePath = getInputFilenameAbsPath(parsedArgs, sourceFile);\n\t\tconst readInterface = readline.createInterface({\n\t\t\tinput: createReadStream(inputFilePath),\n\t\t\toutput: process.stdout,\n\t\t});\n\n\t\tconst variableNames: string[] = [];\n\n\t\treadInterface.on('line', function(line) {\n\t\t\t// Skip lines that start with a comment\n\t\t\tif (!line.trim().startsWith('//')) {\n\t\t\t\tconst matches = line.match(/(?<=\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g);\n\t\t\t\tif (matches) {\n\t\t\t\t\tvariableNames.push(...matches);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treadInterface.on('close', function() {\n\t\t\tresolve(variableNames);\n\t\t});\n\t});\n};\n\nconst compileExprs = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n): Promise<TableRow[]> => {\n\t// Get expressions from file\n\tlet exprs = [];\n\ttry {\n\t\texprs = await getExprNames(parsedArgs, sourceFile);\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn [{\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} expressions compiled`,\n\t\t}];\n\t}\n\n\tconst results = await Promise.all(exprs.map(async (exprName, index) => {\n\t\tconst compileResult = await compileExpr(\n\t\t\tparsedArgs,\n\t\t\tsourceFile,\n\t\t\tmodule,\n\t\t\texprKind === 'storage' && index === 0 ? 'default_storage' : exprKind,\n\t\t)(exprName);\n\t\treturn compileResult;\n\t}));\n\n\t// Collect errors\n\tconst errors = results.reduce(\n\t\t(acc, result) => {\n\t\t\tif (result.err) {\n\t\t\t\t// If its not an Error object, then just add it to the list\n\t\t\t\tif (!(result.err instanceof Error)) return [...acc, result.err];\n\n\t\t\t\t// Otherwise, get all ligo errors and ensure that the list is unique\n\t\t\t\tconst ligoErrs = (acc\n\t\t\t\t\t.filter(err => err instanceof Error) as Error[])\n\t\t\t\t\t.map(err => err.message);\n\n\t\t\t\tconst formattedError = formatLigoError(result.err);\n\n\t\t\t\treturn (ligoErrs.includes(formattedError.message)) ? acc : [...acc, formattedError];\n\t\t\t}\n\t\t\treturn acc;\n\t\t},\n\t\t[] as unknown[],\n\t);\n\n\t// Collect table rows\n\tconst retval = results.map(({ source, artifact }) => ({ source, artifact }));\n\n\tif (errors.length) emitExternalError(errors, sourceFile);\n\n\treturn retval;\n};\n\n// Helper function to get the initial message based on the pair value\nconst getInitialMessage = (pair: string, module: ModuleInfo) => {\n\tconst messages = {\n\t\t'mligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t// ... any other combinations\n\t} as Record<string, string>;\n\n\treturn messages[pair] || '// This file was created by Taqueria.';\n};\n\n// Helper function to get a common message\nconst getCommonMsg = (langType: Syntax, listType: ExprKind) => {\n\tconst varKeyword = langType === 'mligo' ? 'let' : 'const';\n\tconst commonMsgForStorage = `// IMPORTANT: We suggest always explicitly typing your storage values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} storage: int = 10\\` or \\`${varKeyword} storage: Contract.storage = 10\\``;\n\n\tconst commonMsgForParameter = `// IMPORTANT: We suggest always explicitly typing your parameter values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} parameter: int = 10\\` or \\`${varKeyword} parameter: Contract.parameter = 10\\``;\n\n\treturn listType === 'storage' ? commonMsgForStorage : commonMsgForParameter;\n};\n\n// Main function to get the content for storage or parameter\nconst getContent = (moduleInfo: ModuleInfo, listType: ExprKind) => {\n\tconst linkToContract = `#import \"${moduleInfo.sourceFile}\" \"Contract\"`;\n\tconst pair = `${moduleInfo.syntax}-${moduleInfo.type}`;\n\tconst initialMsg = getInitialMessage(pair, moduleInfo);\n\tconst commonMsg = getCommonMsg(moduleInfo.syntax, listType);\n\n\treturn `${linkToContract}\\n\\n${initialMsg}\\n\\n${commonMsg}`;\n};\n\n// Usage for storage list\nconst initContentForStorage = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'storage');\n\n// Usage for parameter list\nconst initContentForParameter = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'parameter');\n\nexport const compileContractWithStorageAndParameter = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n): Promise<TableRow[]> => {\n\tconst contractCompileResult = await compileContract(parsedArgs, sourceFile, module);\n\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\tdebugger;\n\n\tconst storageListFile = `${module.moduleName}.storageList${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);\n\tconst storageCompileResult = await access(storageListFilename)\n\t\t.then(() => compileExprs(parsedArgs, storageListFile, module, 'storage'))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: storage file associated with \"${module.moduleName}\" can't be found, so \"${storageListFile}\" has been created for you. Use this file to define all initial storage values for this contract\\n`,\n\t\t\t);\n\t\t\treturn writeFile(storageListFilename, initContentForStorage(module), 'utf8');\n\t\t});\n\n\tconst parameterListFile = `${module.moduleName}.parameterList${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);\n\tconst parameterCompileResult = await access(parameterListFilename)\n\t\t.then(() => compileExprs(parsedArgs, parameterListFile, module, 'parameter'))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: parameter file associated with \"${module.moduleName}\" can't be found, so \"${parameterListFile}\" has been created for you. Use this file to define all parameter values for this contract\\n`,\n\t\t\t);\n\t\t\treturn writeFile(parameterListFilename, initContentForParameter(module), 'utf8');\n\t\t});\n\n\tconst storageArtifacts = storageCompileResult ? storageCompileResult.map(res => res.artifact).join('\\n') : '';\n\tconst parameterArtifacts = parameterCompileResult ? parameterCompileResult.map(res => res.artifact).join('\\n') : '';\n\n\tconst combinedArtifact = [\n\t\tcontractCompileResult.artifact,\n\t\tstorageArtifacts,\n\t\tparameterArtifacts,\n\t].filter(Boolean).join('\\n');\n\n\tconst combinedRow: TableRow = {\n\t\tsource: module.sourceName,\n\t\tartifact: combinedArtifact,\n\t};\n\n\treturn [combinedRow];\n};\n\nexport const compile = async (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!isLIGOFile(sourceFile)) {\n\t\tsendErr(`${sourceFile} is not a LIGO file`);\n\t\treturn;\n\t}\n\tif (isStorageListFile(sourceFile) || isParameterListFile(sourceFile)) {\n\t\tsendErr(`Storage and parameter list files are not meant to be compiled directly`);\n\t\treturn;\n\t}\n\tif (isUnsupportedLigoSyntax(sourceFile)) {\n\t\tsendErr(`Unsupported LIGO syntax detected in ${sourceFile}. Note, we only support .jsligo and .mligo files.`);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst modules = await listContractModules(parsedArgs, sourceFile);\n\t\tif (modules.length === 0) {\n\t\t\treturn sendJsonRes([\n\t\t\t\t{\n\t\t\t\t\tsource: sourceFile,\n\t\t\t\t\tartifact: `No contract modules found in \"${sourceFile}\"`,\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tlet allCompileResults: TableRow[] = [];\n\t\tfor (const module of modules) {\n\t\t\t// If we're only to compile a particular module, then we'll skip any that don't match\n\t\t\tif (parsedArgs.module && parsedArgs.module !== module.moduleName) continue;\n\n\t\t\tconst compileResults = await compileContractWithStorageAndParameter(parsedArgs, sourceFile, module);\n\t\t\tallCompileResults = allCompileResults.concat(compileResults);\n\t\t}\n\n\t\tsendJsonRes(allCompileResults, { footer: `\\nCompiled ${allCompileResults.length} contract(s) in \"${sourceFile}\"` });\n\t} catch (err) {\n\t\tsendErr(`Error processing \"${sourceFile}\": ${err}`);\n\t}\n};\n\nexport default compile;\n","import { sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport glob from 'fast-glob';\nimport { join } from 'path';\nimport { CompileAllOpts, CompileAllOpts as Opts, CompileOpts } from './common';\nimport {\n\tcompileContractWithStorageAndParameter,\n\tisParameterListFile,\n\tisStorageListFile,\n\tlistContractModules,\n\tTableRow,\n} from './compile';\n\nconst compileAll = async (parsedArgs: Opts): Promise<void> => {\n\tlet compilePromises: Promise<TableRow[]>[] = [];\n\n\tconst contractFilenames = await glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{\n\t\t\tcwd: join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts'),\n\t\t\tabsolute: false,\n\t\t},\n\t);\n\n\tfor (const filename of contractFilenames) {\n\t\tif (isStorageListFile(filename) || isParameterListFile(filename)) continue;\n\t\tconst moduleNames = await listContractModules(parsedArgs as unknown as CompileAllOpts, filename);\n\t\tfor (const moduleName of moduleNames) {\n\t\t\tcompilePromises.push(compileContractWithStorageAndParameter(parsedArgs as CompileOpts, filename, moduleName));\n\t\t}\n\t}\n\n\treturn Promise.all(compilePromises)\n\t\t.then(tables => tables.flat())\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendErr(err, false));\n};\n\nexport default compileAll;\n","import { execCmd, getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { readJsonFile, writeJsonFile } from '@taqueria/node-sdk';\nimport { join } from 'path';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (\n\tparsedArgs: Opts,\n\tuid: string,\n\tgid: string,\n\tuserArgs: string,\n): [string, Record<string, string>] => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\n\tconst userMap = uid && gid ? `${uid}:${gid}` : uid;\n\tconst userMapArgs = uid ? ['-u', userMap] : [];\n\n\tconst binary = 'docker';\n\tconst baseArgs = [\n\t\t'run',\n\t\t'--rm',\n\t\t'-v',\n\t\t`${projectDir}:/project`,\n\t\t'-w',\n\t\t'/project',\n\t\t...userMapArgs,\n\t\tgetLigoDockerImage(),\n\t];\n\tconst processedUserArgs = userArgs.split(' ').map(arg => arg.startsWith('\\\\-') ? arg.substring(1) : arg).filter(arg =>\n\t\targ\n\t);\n\tconst args = [...baseArgs, ...processedUserArgs, '--skip-analytics'];\n\tconst envVars = { 'DOCKER_DEFAULT_PLATFORM': 'linux/amd64' };\n\treturn [\n\t\t[binary, ...args].join(' '),\n\t\tenvVars,\n\t];\n};\n\nconst ensureEsyExists = async (parsedArgs: Opts): Promise<string> => {\n\tconst esyJsonPath = join(parsedArgs.projectDir, 'esy.json');\n\n\ttry {\n\t\treturn await readJsonFile(esyJsonPath);\n\t} catch {\n\t\treturn await writeJsonFile(esyJsonPath)({});\n\t}\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tensureEsyExists(parsedArgs)\n\t\t.then(getArch)\n\t\t.then(async () => {\n\t\t\tconst uid = await execCmd('id -u');\n\t\t\tconst gid = await execCmd('id -g');\n\t\t\treturn [uid.stdout.trim(), gid.stdout.trim()];\n\t\t})\n\t\t.then(([uid, gid]) => getArbitraryLigoCmd(parsedArgs, uid, gid, cmd))\n\t\t.then(([cmd, envVars]) => spawnCmd(cmd, envVars))\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { emitExternalError, getInputFilenameRelPath, getLigoDockerImage, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst cmd = `${baseCmd} ${inputFile}`;\n\treturn cmd;\n};\n\nconst testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stdout, stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nconst test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!sourceFile) return sendAsyncErr(`No source file provided`);\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAA8D;;;ACA9D,sBAA6B;AAE7B,sBAA0B;;;ACFnB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcvB,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ADJ/B,IAAM,kBAAkB,OAAO,cAAsB,WAAgD;AACpG,QAAM,cAAc,aAAa,MAAM,UAAU;AACjD,QAAM,MAAM,cAAc,YAAY,CAAC,EAAE,UAAU,CAAC,IAAI;AAExD,MAAI,WAAW;AAAS,WAAO;AAC/B,MAAI,WAAW;AAAU,WAAO;AAEhC,MAAI,WAAW,QAAW;AACzB,QAAI,QAAQ;AAAS,aAAO;AAC5B,QAA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AAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,QAAQ;AAAA,IACT,CAAC;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACV,0BAAS,OAAO;AAAA,MACf,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,QACZ,+BAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACR,wBAAO,OAAO;AAAA,UACb,WAAW;AAAA,UACX,MAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AAAA,EACP,aAAa,QAAQ,SAAS;AAC/B,IAAI,QAAQ,IAAI;","names":["import_node_sdk","import_node_sdk","import_node_sdk","import_node_sdk","import_promises","import_path","module","import_node_sdk","import_path","glob","import_node_sdk","import_path","cmd","import_node_sdk"]}
|
package/index.mjs
CHANGED
|
@@ -80,7 +80,8 @@ var getInputFilenameRelPath = (parsedArgs, sourceFile) => join(parsedArgs.config
|
|
|
80
80
|
var formatLigoError = (err) => {
|
|
81
81
|
let result = err.message.replace(/Command failed.+?\n/, "");
|
|
82
82
|
if (result.includes("An internal error ocurred. Please, contact the developers.") && result.includes("Module Contract not found with last Contract.")) {
|
|
83
|
-
result = `
|
|
83
|
+
result = `By convention, Taqueria expects you to import your contract with Contract as the module name.
|
|
84
|
+
For instance, if you have a contract in a file called "increment.mligo", in your parameter/storage list file you must include #import "Increment.mligo" "Contract" for compilation to be successful.`;
|
|
84
85
|
}
|
|
85
86
|
err.message = result.replace(
|
|
86
87
|
"An internal error ocurred. Please, contact the developers.",
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","compile-all.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'module',\n\t\t\t\t\tshortFlag: 'm',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The LIGO module to be compiled',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile-all',\n\t\t\tcommand: 'compile-all',\n\t\t\tdescription:\n\t\t\t\t'Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'get-image',\n\t\t\tcommand: 'get-image',\n\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\thandler: 'proxy',\n\t\t\thidden: true,\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: main,\n\tpostInstall: `node ${__dirname}/postinstall.js`,\n}), process.argv);\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === 'jsligo') return jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return mligo_template;\n\t\tif (ext === 'jsligo') return jsligo_template;\n\t\treturn sendAsyncErr(\n\t\t\t`Unable to infer LIGO syntax from \"${contractName}\". Please specify a LIGO syntax via the --syntax option`,\n\t\t);\n\t} else {\n\t\treturn sendAsyncErr(`\"${syntax}\" is not a valid syntax. Please specify a valid LIGO syntax`);\n\t}\n};\n\nconst createContract = (args: RequestArgs.t) => {\n\tconst unsafeOpts = args as unknown as Opts;\n\tconst contractName = unsafeOpts.sourceFileName as string;\n\tconst syntax = unsafeOpts.syntax;\n\tconst contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\ntype return = operation list * storage\n\n(* Three entrypoints *)\n[@entry] let increment (delta : int) (store : storage) : return =\n [], store + delta\n[@entry] let decrement (delta : int) (store : storage) : return =\n [], store - delta\n[@entry] let reset (() : unit) (_ : storage) : return =\n [], 0\n`;\n\n\nexport const jsligo_template = `\ntype storage = int;\ntype ret = [list<operation>, storage];\n\n// Three entrypoints\n\n// @entry\nconst increment = (delta : int, store : storage) : ret =>\n [list([]), store + delta];\n\n// @entry\nconst decrement = (delta : int, store : storage) : ret =>\n [list([]), store - delta];\n\n// @entry\nconst reset = (_ : unit, _ : storage) : ret =>\n [list([]), 0];\n`;\n","import { RequestArgs, sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport compileAll from './compile-all';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: RequestArgs.t): Promise<void> => {\n\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\tswitch (unsafeOpts.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(unsafeOpts);\n\t\tcase 'compile':\n\t\t\treturn compile(unsafeOpts);\n\t\tcase 'compile-all':\n\t\t\treturn compileAll(unsafeOpts);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tcase 'get-image':\n\t\t\treturn sendAsyncRes(getLigoDockerImage());\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default main;\n","import { getDockerImage, sendErr } from '@taqueria/node-sdk';\nimport { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends ProxyTaskArgs.t {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends ProxyTaskArgs.t {\n\tsourceFile: string;\n\tjson: boolean;\n\tmodule?: string;\n}\n\nexport interface CompileAllOpts extends ProxyTaskArgs.t {\n\tjson: boolean;\n}\n\nexport interface TestOpts extends RequestArgs.t {\n\ttask?: string;\n\tsourceFile?: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & CompileAllOpts & TestOpts;\n\nexport type UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;\n\n// Should point to the latest stable version, so it needs to be updated as part of our release process.\nconst LIGO_DEFAULT_IMAGE = 'ligolang/ligo:0.73.0';\n\nconst LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';\n\nexport const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);\n\nexport const getInputFilenameAbsPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const getInputFilenameRelPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const formatLigoError = (err: Error): Error => {\n\tlet result = err.message.replace(/Command failed.+?\\n/, '');\n\tif (\n\t\tresult.includes('An internal error ocurred. Please, contact the developers.')\n\t\t&& result.includes('Module Contract not found with last Contract.')\n\t) {\n\t\tresult =\n\t\t\t`The contract must be imported with \"Contract\" as the namespace: #import \"path/to/contract.ligo\" \"Contract\"`;\n\t}\n\n\terr.message = result.replace(\n\t\t'An internal error ocurred. Please, contact the developers.',\n\t\t'The LIGO compiler experienced an internal error. Please contact the LIGO developers.',\n\t);\n\n\treturn err;\n};\n\nexport const emitExternalError = (errs: unknown[] | unknown, sourceFile: string): void => {\n\tsendErr(`\\n=== Error messages for ${sourceFile} ===`);\n\tconst errors = Array.isArray(errs) ? errs : [errs];\n\terrors.map(err => {\n\t\terr instanceof Error ? sendErr(err.message) : sendErr(err as any);\n\t});\n\tsendErr(`===`);\n};\n","import {\n\texecCmd,\n\tgetArch,\n\tgetArtifactsDir,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tsendRes,\n\tsendWarn,\n} from '@taqueria/node-sdk';\nimport { createReadStream } from 'fs';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport * as readline from 'readline';\nimport {\n\tCompileOpts as Opts,\n\temitExternalError,\n\tformatLigoError,\n\tgetInputFilenameAbsPath,\n\tgetInputFilenameRelPath,\n\tgetLigoDockerImage,\n\tUnionOpts,\n} from './common';\n\nexport type TableRow = { source: string; artifact: string; err?: unknown };\n\nexport type ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nexport type Syntax = 'mligo' | 'jsligo' | 'religo' | 'ligo';\n\nexport type ModuleInfo = {\n\tmoduleName: string;\n\tsourceName: string;\n\tsourceFile: string;\n\tsyntax: Syntax;\n\ttype: 'file-main' | 'file-entry' | 'module-main' | 'module-entry';\n};\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nexport const isSupportedLigoSyntax = (sourceFile: string) => /\\.(mligo|jsligo)$/.test(sourceFile);\n\nexport const isUnsupportedLigoSyntax = (sourceFile: string) => /\\.(ligo|religo)$/.test(sourceFile);\n\nexport const isLIGOFile = (sourceFile: string) =>\n\tisSupportedLigoSyntax(sourceFile) || isUnsupportedLigoSyntax(sourceFile);\n\nexport const isStorageListFile = (sourceFile: string): boolean =>\n\t/.+\\.(storageList|storages)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const isParameterListFile = (sourceFile: string): boolean =>\n\t/.+\\.(parameterList|parameters)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const listContractModules = async (parsedArgs: UnionOpts, sourceFile: string): Promise<ModuleInfo[]> => {\n\ttry {\n\t\tawait getArch();\n\t\tconst cmd = await getListDeclarationsCmd(parsedArgs, sourceFile);\n\t\tconst { stderr, stdout } = await execCmd(cmd);\n\t\tif (stderr.length > 0) return Promise.reject(stderr);\n\n\t\treturn JSON.parse(stdout).declarations.reduce(\n\t\t\t(acc: ModuleInfo[], decl: string) => {\n\t\t\t\t// We need to process delcarations (decl) like so:\n\t\t\t\t// 1. If the decl is equal to the string \"main\", then the module type is \"file-main\" and the name of the module is the sourceFile.\n\t\t\t\t// 2. If the decl is equal to $main, then the module type is \"file-entry\" and the name fo the module is the sourceFile.\n\t\t\t\t// 3. If the decl ends with .main, then the module type is \"module-main\" and the name of the module is the decl without the .main suffix.\n\t\t\t\t// 4. If the decl ends with .$main, then the module type is \"module-entry\" and the name of the module is the decl without the .$main suffix.\n\t\t\t\t// Otherwise, this is not a declaration we care about.\n\t\t\t\tconst srcFile = removeExt(basename(sourceFile));\n\t\t\t\tconst syntax = extractExt(sourceFile).replace('.', '');\n\n\t\t\t\tif (decl === 'main') {\n\t\t\t\t\treturn [...acc, { moduleName: srcFile, sourceName: sourceFile, sourceFile, type: 'file-main', syntax }];\n\t\t\t\t} else if (decl === '$main') {\n\t\t\t\t\treturn [...acc, { moduleName: srcFile, sourceName: sourceFile, sourceFile, type: 'file-entry', syntax }];\n\t\t\t\t} else if (decl.endsWith('.main')) {\n\t\t\t\t\tconst moduleName = decl.replace(/\\.main$/, '');\n\t\t\t\t\treturn [...acc, {\n\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\ttype: 'module-main',\n\t\t\t\t\t\tsyntax,\n\t\t\t\t\t}];\n\t\t\t\t} else if (decl.endsWith('.$main')) {\n\t\t\t\t\tconst moduleName = decl.replace(/\\.\\$main$/, '');\n\t\t\t\t\treturn [...acc, {\n\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\ttype: 'module-entry',\n\t\t\t\t\t\tsyntax,\n\t\t\t\t\t}];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t[],\n\t\t);\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn [];\n\t}\n};\n\nconst getListDeclarationsCmd = async (parsedArgs: UnionOpts, sourceFile: string): Promise<string> => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} info list-declarations`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst flags = '--display-format json';\n\tconst cmd = `${baseCmd} ${inputFile} ${flags}`;\n\treturn cmd;\n};\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst isOutputFormatJSON = (parsedArgs: Opts): boolean => parsedArgs.json;\n\nconst getOutputContractFilename = (parsedArgs: Opts, module: ModuleInfo): string => {\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\treturn join(getArtifactsDir(parsedArgs), `${module.moduleName}${ext}`);\n};\n\nconst getOutputExprFilename = (parsedArgs: Opts, module: ModuleInfo, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = module.moduleName;\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage${ext}`\n\t\t: `${contractName}.${exprKind}.${exprName}${ext}`;\n\treturn join(getArtifactsDir(parsedArgs), `${outputFile}`);\n};\n\nconst getCompileContractCmd = async (parsedArgs: Opts, sourceFile: string, module: ModuleInfo): Promise<string> => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputContractFilename(parsedArgs, module)}`;\n\tconst flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\tconst moduleFlag = module.type.startsWith('file-') ? '' : `-m ${module.moduleName}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}${moduleFlag}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n\texprName: string,\n): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFilename(parsedArgs, module, exprKind, exprName)}`;\n\tconst flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\n\t// Parameter and Storage list files are expected to import the smart contract file as the \"Contract\" module.\n\tconst moduleFlag = (() => {\n\t\tswitch (module.type) {\n\t\t\tcase 'file-main':\n\t\t\tcase 'file-entry':\n\t\t\t\treturn '-m Contract';\n\t\t\tdefault:\n\t\t\t\treturn `-m Contract.${module.moduleName}`;\n\t\t}\n\t})();\n\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags} ${moduleFlag}`;\n\treturn cmd;\n};\n\nconst compileContract = async (parsedArgs: Opts, sourceFile: string, module: ModuleInfo): Promise<TableRow> => {\n\ttry {\n\t\tawait getArch();\n\t\tconst cmd = await getCompileContractCmd(parsedArgs, sourceFile, module);\n\t\tconst { stderr } = await execCmd(cmd);\n\t\tif (stderr.length > 0) sendWarn(stderr);\n\n\t\treturn {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: getOutputContractFilename(parsedArgs, module),\n\t\t};\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t};\n\t}\n};\n\nconst compileExpr =\n\t(parsedArgs: Opts, sourceFile: string, module: ModuleInfo, exprKind: ExprKind) =>\n\t(exprName: string): Promise<TableRow> => {\n\t\treturn getArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, module, exprKind, exprName))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => {\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\tconst artifactName = getOutputExprFilename(parsedArgs, module, exprKind, exprName);\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: artifactName,\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: `${exprName} in ${sourceFile} not compiled`,\n\t\t\t\t\terr,\n\t\t\t\t};\n\t\t\t});\n\t};\n\nconst getExprNames = (parsedArgs: Opts, sourceFile: string): Promise<string[]> => {\n\treturn new Promise((resolve, reject) => {\n\t\tconst inputFilePath = getInputFilenameAbsPath(parsedArgs, sourceFile);\n\t\tconst readInterface = readline.createInterface({\n\t\t\tinput: createReadStream(inputFilePath),\n\t\t\toutput: process.stdout,\n\t\t});\n\n\t\tconst variableNames: string[] = [];\n\n\t\treadInterface.on('line', function(line) {\n\t\t\t// Skip lines that start with a comment\n\t\t\tif (!line.trim().startsWith('//')) {\n\t\t\t\tconst matches = line.match(/(?<=\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g);\n\t\t\t\tif (matches) {\n\t\t\t\t\tvariableNames.push(...matches);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treadInterface.on('close', function() {\n\t\t\tresolve(variableNames);\n\t\t});\n\t});\n};\n\nconst compileExprs = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n): Promise<TableRow[]> => {\n\t// Get expressions from file\n\tlet exprs = [];\n\ttry {\n\t\texprs = await getExprNames(parsedArgs, sourceFile);\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn [{\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} expressions compiled`,\n\t\t}];\n\t}\n\n\tconst results = await Promise.all(exprs.map(async (exprName, index) => {\n\t\tconst compileResult = await compileExpr(\n\t\t\tparsedArgs,\n\t\t\tsourceFile,\n\t\t\tmodule,\n\t\t\texprKind === 'storage' && index === 0 ? 'default_storage' : exprKind,\n\t\t)(exprName);\n\t\treturn compileResult;\n\t}));\n\n\t// Collect errors\n\tconst errors = results.reduce(\n\t\t(acc, result) => {\n\t\t\tif (result.err) {\n\t\t\t\t// If its not an Error object, then just add it to the list\n\t\t\t\tif (!(result.err instanceof Error)) return [...acc, result.err];\n\n\t\t\t\t// Otherwise, get all ligo errors and ensure that the list is unique\n\t\t\t\tconst ligoErrs = (acc\n\t\t\t\t\t.filter(err => err instanceof Error) as Error[])\n\t\t\t\t\t.map(err => err.message);\n\n\t\t\t\tconst formattedError = formatLigoError(result.err);\n\n\t\t\t\treturn (ligoErrs.includes(formattedError.message)) ? acc : [...acc, formattedError];\n\t\t\t}\n\t\t\treturn acc;\n\t\t},\n\t\t[] as unknown[],\n\t);\n\n\t// Collect table rows\n\tconst retval = results.map(({ source, artifact }) => ({ source, artifact }));\n\n\tif (errors.length) emitExternalError(errors, sourceFile);\n\n\treturn retval;\n};\n\n// Helper function to get the initial message based on the pair value\nconst getInitialMessage = (pair: string, module: ModuleInfo) => {\n\tconst messages = {\n\t\t'mligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t// ... any other combinations\n\t} as Record<string, string>;\n\n\treturn messages[pair] || '// This file was created by Taqueria.';\n};\n\n// Helper function to get a common message\nconst getCommonMsg = (langType: Syntax, listType: ExprKind) => {\n\tconst varKeyword = langType === 'mligo' ? 'let' : 'const';\n\tconst commonMsgForStorage = `// IMPORTANT: We suggest always explicitly typing your storage values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} storage: int = 10\\` or \\`${varKeyword} storage: Contract.storage = 10\\``;\n\n\tconst commonMsgForParameter = `// IMPORTANT: We suggest always explicitly typing your parameter values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} parameter: int = 10\\` or \\`${varKeyword} parameter: Contract.parameter = 10\\``;\n\n\treturn listType === 'storage' ? commonMsgForStorage : commonMsgForParameter;\n};\n\n// Main function to get the content for storage or parameter\nconst getContent = (moduleInfo: ModuleInfo, listType: ExprKind) => {\n\tconst linkToContract = `#import \"${moduleInfo.sourceFile}\" \"Contract\"`;\n\tconst pair = `${moduleInfo.syntax}-${moduleInfo.type}`;\n\tconst initialMsg = getInitialMessage(pair, moduleInfo);\n\tconst commonMsg = getCommonMsg(moduleInfo.syntax, listType);\n\n\treturn `${linkToContract}\\n\\n${initialMsg}\\n\\n${commonMsg}`;\n};\n\n// Usage for storage list\nconst initContentForStorage = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'storage');\n\n// Usage for parameter list\nconst initContentForParameter = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'parameter');\n\nexport const compileContractWithStorageAndParameter = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n): Promise<TableRow[]> => {\n\tconst contractCompileResult = await compileContract(parsedArgs, sourceFile, module);\n\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\tdebugger;\n\n\tconst storageListFile = `${module.moduleName}.storageList${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);\n\tconst storageCompileResult = await access(storageListFilename)\n\t\t.then(() => compileExprs(parsedArgs, storageListFile, module, 'storage'))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: storage file associated with \"${module.moduleName}\" can't be found, so \"${storageListFile}\" has been created for you. Use this file to define all initial storage values for this contract\\n`,\n\t\t\t);\n\t\t\treturn writeFile(storageListFilename, initContentForStorage(module), 'utf8');\n\t\t});\n\n\tconst parameterListFile = `${module.moduleName}.parameterList${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);\n\tconst parameterCompileResult = await access(parameterListFilename)\n\t\t.then(() => compileExprs(parsedArgs, parameterListFile, module, 'parameter'))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: parameter file associated with \"${module.moduleName}\" can't be found, so \"${parameterListFile}\" has been created for you. Use this file to define all parameter values for this contract\\n`,\n\t\t\t);\n\t\t\treturn writeFile(parameterListFilename, initContentForParameter(module), 'utf8');\n\t\t});\n\n\tconst storageArtifacts = storageCompileResult ? storageCompileResult.map(res => res.artifact).join('\\n') : '';\n\tconst parameterArtifacts = parameterCompileResult ? parameterCompileResult.map(res => res.artifact).join('\\n') : '';\n\n\tconst combinedArtifact = [\n\t\tcontractCompileResult.artifact,\n\t\tstorageArtifacts,\n\t\tparameterArtifacts,\n\t].filter(Boolean).join('\\n');\n\n\tconst combinedRow: TableRow = {\n\t\tsource: module.sourceName,\n\t\tartifact: combinedArtifact,\n\t};\n\n\treturn [combinedRow];\n};\n\nexport const compile = async (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!isLIGOFile(sourceFile)) {\n\t\tsendErr(`${sourceFile} is not a LIGO file`);\n\t\treturn;\n\t}\n\tif (isStorageListFile(sourceFile) || isParameterListFile(sourceFile)) {\n\t\tsendErr(`Storage and parameter list files are not meant to be compiled directly`);\n\t\treturn;\n\t}\n\tif (isUnsupportedLigoSyntax(sourceFile)) {\n\t\tsendErr(`Unsupported LIGO syntax detected in ${sourceFile}. Note, we only support .jsligo and .mligo files.`);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst modules = await listContractModules(parsedArgs, sourceFile);\n\t\tif (modules.length === 0) {\n\t\t\treturn sendJsonRes([\n\t\t\t\t{\n\t\t\t\t\tsource: sourceFile,\n\t\t\t\t\tartifact: `No contract modules found in \"${sourceFile}\"`,\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tlet allCompileResults: TableRow[] = [];\n\t\tfor (const module of modules) {\n\t\t\t// If we're only to compile a particular module, then we'll skip any that don't match\n\t\t\tif (parsedArgs.module && parsedArgs.module !== module.moduleName) continue;\n\n\t\t\tconst compileResults = await compileContractWithStorageAndParameter(parsedArgs, sourceFile, module);\n\t\t\tallCompileResults = allCompileResults.concat(compileResults);\n\t\t}\n\n\t\tsendJsonRes(allCompileResults, { footer: `\\nCompiled ${allCompileResults.length} contract(s) in \"${sourceFile}\"` });\n\t} catch (err) {\n\t\tsendErr(`Error processing \"${sourceFile}\": ${err}`);\n\t}\n};\n\nexport default compile;\n","import { sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport glob from 'fast-glob';\nimport { join } from 'path';\nimport { CompileAllOpts, CompileAllOpts as Opts, CompileOpts } from './common';\nimport {\n\tcompileContractWithStorageAndParameter,\n\tisParameterListFile,\n\tisStorageListFile,\n\tlistContractModules,\n\tTableRow,\n} from './compile';\n\nconst compileAll = async (parsedArgs: Opts): Promise<void> => {\n\tlet compilePromises: Promise<TableRow[]>[] = [];\n\n\tconst contractFilenames = await glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{\n\t\t\tcwd: join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts'),\n\t\t\tabsolute: false,\n\t\t},\n\t);\n\n\tfor (const filename of contractFilenames) {\n\t\tif (isStorageListFile(filename) || isParameterListFile(filename)) continue;\n\t\tconst moduleNames = await listContractModules(parsedArgs as unknown as CompileAllOpts, filename);\n\t\tfor (const moduleName of moduleNames) {\n\t\t\tcompilePromises.push(compileContractWithStorageAndParameter(parsedArgs as CompileOpts, filename, moduleName));\n\t\t}\n\t}\n\n\treturn Promise.all(compilePromises)\n\t\t.then(tables => tables.flat())\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendErr(err, false));\n};\n\nexport default compileAll;\n","import { execCmd, getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { readJsonFile, writeJsonFile } from '@taqueria/node-sdk';\nimport { join } from 'path';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (\n\tparsedArgs: Opts,\n\tuid: string,\n\tgid: string,\n\tuserArgs: string,\n): [string, Record<string, string>] => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\n\tconst userMap = uid && gid ? `${uid}:${gid}` : uid;\n\tconst userMapArgs = uid ? ['-u', userMap] : [];\n\n\tconst binary = 'docker';\n\tconst baseArgs = [\n\t\t'run',\n\t\t'--rm',\n\t\t'-v',\n\t\t`${projectDir}:/project`,\n\t\t'-w',\n\t\t'/project',\n\t\t...userMapArgs,\n\t\tgetLigoDockerImage(),\n\t];\n\tconst processedUserArgs = userArgs.split(' ').map(arg => arg.startsWith('\\\\-') ? arg.substring(1) : arg).filter(arg =>\n\t\targ\n\t);\n\tconst args = [...baseArgs, ...processedUserArgs, '--skip-analytics'];\n\tconst envVars = { 'DOCKER_DEFAULT_PLATFORM': 'linux/amd64' };\n\treturn [\n\t\t[binary, ...args].join(' '),\n\t\tenvVars,\n\t];\n};\n\nconst ensureEsyExists = async (parsedArgs: Opts): Promise<string> => {\n\tconst esyJsonPath = join(parsedArgs.projectDir, 'esy.json');\n\n\ttry {\n\t\treturn await readJsonFile(esyJsonPath);\n\t} catch {\n\t\treturn await writeJsonFile(esyJsonPath)({});\n\t}\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tensureEsyExists(parsedArgs)\n\t\t.then(getArch)\n\t\t.then(async () => {\n\t\t\tconst uid = await execCmd('id -u');\n\t\t\tconst gid = await execCmd('id -g');\n\t\t\treturn [uid.stdout.trim(), gid.stdout.trim()];\n\t\t})\n\t\t.then(([uid, gid]) => getArbitraryLigoCmd(parsedArgs, uid, gid, cmd))\n\t\t.then(([cmd, envVars]) => spawnCmd(cmd, envVars))\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { emitExternalError, getInputFilenameRelPath, getLigoDockerImage, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst cmd = `${baseCmd} ${inputFile}`;\n\treturn cmd;\n};\n\nconst testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stdout, stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nconst test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!sourceFile) return sendAsyncErr(`No source file provided`);\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"mappings":";AAAA,SAAS,QAAQ,QAAQ,eAAe,MAAM,gBAAgB;;;ACA9D,SAAS,oBAAoB;AAE7B,SAAS,iBAAiB;;;ACFnB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcvB,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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N,SAAS;AAAA,UACT,aAAa;AAAA,QACd,CAAC;AAAA,QACD,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,WAAW;AAAA,UACX,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aACC;AAAA,MACD,SAAS;AAAA,QACR,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,SAAS;AAAA,UACT,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,QAAQ;AAAA,IACT,CAAC;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACV,SAAS,OAAO;AAAA,MACf,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,QACZ,cAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACR,OAAO,OAAO;AAAA,UACb,WAAW;AAAA,UACX,MAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AAAA,EACP,aAAa,QAAQ,SAAS;AAC/B,IAAI,QAAQ,IAAI;","names":["sendAsyncErr","sendErr","writeFile","join","join","writeFile","sendErr","sendErr","sendJsonRes","join","join","sendJsonRes","sendErr","execCmd","getArch","sendAsyncErr","sendRes","join","join","getArch","execCmd","cmd","sendAsyncErr","sendRes","execCmd","getArch","sendAsyncErr","sendJsonRes","sendWarn","getArch","execCmd","sendWarn","sendAsyncErr","sendJsonRes","sendAsyncErr"]}
|
|
1
|
+
{"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","compile-all.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'module',\n\t\t\t\t\tshortFlag: 'm',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The LIGO module to be compiled',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile-all',\n\t\t\tcommand: 'compile-all',\n\t\t\tdescription:\n\t\t\t\t'Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'get-image',\n\t\t\tcommand: 'get-image',\n\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\thandler: 'proxy',\n\t\t\thidden: true,\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: main,\n\tpostInstall: `node ${__dirname}/postinstall.js`,\n}), process.argv);\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === 'jsligo') return jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return mligo_template;\n\t\tif (ext === 'jsligo') return jsligo_template;\n\t\treturn sendAsyncErr(\n\t\t\t`Unable to infer LIGO syntax from \"${contractName}\". Please specify a LIGO syntax via the --syntax option`,\n\t\t);\n\t} else {\n\t\treturn sendAsyncErr(`\"${syntax}\" is not a valid syntax. Please specify a valid LIGO syntax`);\n\t}\n};\n\nconst createContract = (args: RequestArgs.t) => {\n\tconst unsafeOpts = args as unknown as Opts;\n\tconst contractName = unsafeOpts.sourceFileName as string;\n\tconst syntax = unsafeOpts.syntax;\n\tconst contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\ntype return = operation list * storage\n\n(* Three entrypoints *)\n[@entry] let increment (delta : int) (store : storage) : return =\n [], store + delta\n[@entry] let decrement (delta : int) (store : storage) : return =\n [], store - delta\n[@entry] let reset (() : unit) (_ : storage) : return =\n [], 0\n`;\n\n\nexport const jsligo_template = `\ntype storage = int;\ntype ret = [list<operation>, storage];\n\n// Three entrypoints\n\n// @entry\nconst increment = (delta : int, store : storage) : ret =>\n [list([]), store + delta];\n\n// @entry\nconst decrement = (delta : int, store : storage) : ret =>\n [list([]), store - delta];\n\n// @entry\nconst reset = (_ : unit, _ : storage) : ret =>\n [list([]), 0];\n`;\n","import { RequestArgs, sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport compileAll from './compile-all';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: RequestArgs.t): Promise<void> => {\n\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\tswitch (unsafeOpts.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(unsafeOpts);\n\t\tcase 'compile':\n\t\t\treturn compile(unsafeOpts);\n\t\tcase 'compile-all':\n\t\t\treturn compileAll(unsafeOpts);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tcase 'get-image':\n\t\t\treturn sendAsyncRes(getLigoDockerImage());\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default main;\n","import { getDockerImage, sendErr } from '@taqueria/node-sdk';\nimport { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends ProxyTaskArgs.t {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends ProxyTaskArgs.t {\n\tsourceFile: string;\n\tjson: boolean;\n\tmodule?: string;\n}\n\nexport interface CompileAllOpts extends ProxyTaskArgs.t {\n\tjson: boolean;\n}\n\nexport interface TestOpts extends RequestArgs.t {\n\ttask?: string;\n\tsourceFile?: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & CompileAllOpts & TestOpts;\n\nexport type UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;\n\n// Should point to the latest stable version, so it needs to be updated as part of our release process.\nconst LIGO_DEFAULT_IMAGE = 'ligolang/ligo:0.73.0';\n\nconst LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';\n\nexport const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);\n\nexport const getInputFilenameAbsPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const getInputFilenameRelPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const formatLigoError = (err: Error): Error => {\n\tlet result = err.message.replace(/Command failed.+?\\n/, '');\n\tif (\n\t\tresult.includes('An internal error ocurred. Please, contact the developers.')\n\t\t&& result.includes('Module Contract not found with last Contract.')\n\t) {\n\t\tresult =\n\t\t\t`By convention, Taqueria expects you to import your contract with Contract as the module name.\\nFor instance, if you have a contract in a file called \"increment.mligo\", in your parameter/storage list file you must include #import \"Increment.mligo\" \"Contract\" for compilation to be successful.`;\n\t}\n\n\terr.message = result.replace(\n\t\t'An internal error ocurred. Please, contact the developers.',\n\t\t'The LIGO compiler experienced an internal error. Please contact the LIGO developers.',\n\t);\n\n\treturn err;\n};\n\nexport const emitExternalError = (errs: unknown[] | unknown, sourceFile: string): void => {\n\tsendErr(`\\n=== Error messages for ${sourceFile} ===`);\n\tconst errors = Array.isArray(errs) ? errs : [errs];\n\terrors.map(err => {\n\t\terr instanceof Error ? sendErr(err.message) : sendErr(err as any);\n\t});\n\tsendErr(`===`);\n};\n","import {\n\texecCmd,\n\tgetArch,\n\tgetArtifactsDir,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tsendRes,\n\tsendWarn,\n} from '@taqueria/node-sdk';\nimport { createReadStream } from 'fs';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport * as readline from 'readline';\nimport {\n\tCompileOpts as Opts,\n\temitExternalError,\n\tformatLigoError,\n\tgetInputFilenameAbsPath,\n\tgetInputFilenameRelPath,\n\tgetLigoDockerImage,\n\tUnionOpts,\n} from './common';\n\nexport type TableRow = { source: string; artifact: string; err?: unknown };\n\nexport type ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nexport type Syntax = 'mligo' | 'jsligo' | 'religo' | 'ligo';\n\nexport type ModuleInfo = {\n\tmoduleName: string;\n\tsourceName: string;\n\tsourceFile: string;\n\tsyntax: Syntax;\n\ttype: 'file-main' | 'file-entry' | 'module-main' | 'module-entry';\n};\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nexport const isSupportedLigoSyntax = (sourceFile: string) => /\\.(mligo|jsligo)$/.test(sourceFile);\n\nexport const isUnsupportedLigoSyntax = (sourceFile: string) => /\\.(ligo|religo)$/.test(sourceFile);\n\nexport const isLIGOFile = (sourceFile: string) =>\n\tisSupportedLigoSyntax(sourceFile) || isUnsupportedLigoSyntax(sourceFile);\n\nexport const isStorageListFile = (sourceFile: string): boolean =>\n\t/.+\\.(storageList|storages)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const isParameterListFile = (sourceFile: string): boolean =>\n\t/.+\\.(parameterList|parameters)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const listContractModules = async (parsedArgs: UnionOpts, sourceFile: string): Promise<ModuleInfo[]> => {\n\ttry {\n\t\tawait getArch();\n\t\tconst cmd = await getListDeclarationsCmd(parsedArgs, sourceFile);\n\t\tconst { stderr, stdout } = await execCmd(cmd);\n\t\tif (stderr.length > 0) return Promise.reject(stderr);\n\n\t\treturn JSON.parse(stdout).declarations.reduce(\n\t\t\t(acc: ModuleInfo[], decl: string) => {\n\t\t\t\t// We need to process delcarations (decl) like so:\n\t\t\t\t// 1. If the decl is equal to the string \"main\", then the module type is \"file-main\" and the name of the module is the sourceFile.\n\t\t\t\t// 2. If the decl is equal to $main, then the module type is \"file-entry\" and the name fo the module is the sourceFile.\n\t\t\t\t// 3. If the decl ends with .main, then the module type is \"module-main\" and the name of the module is the decl without the .main suffix.\n\t\t\t\t// 4. If the decl ends with .$main, then the module type is \"module-entry\" and the name of the module is the decl without the .$main suffix.\n\t\t\t\t// Otherwise, this is not a declaration we care about.\n\t\t\t\tconst srcFile = removeExt(basename(sourceFile));\n\t\t\t\tconst syntax = extractExt(sourceFile).replace('.', '');\n\n\t\t\t\tif (decl === 'main') {\n\t\t\t\t\treturn [...acc, { moduleName: srcFile, sourceName: sourceFile, sourceFile, type: 'file-main', syntax }];\n\t\t\t\t} else if (decl === '$main') {\n\t\t\t\t\treturn [...acc, { moduleName: srcFile, sourceName: sourceFile, sourceFile, type: 'file-entry', syntax }];\n\t\t\t\t} else if (decl.endsWith('.main')) {\n\t\t\t\t\tconst moduleName = decl.replace(/\\.main$/, '');\n\t\t\t\t\treturn [...acc, {\n\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\ttype: 'module-main',\n\t\t\t\t\t\tsyntax,\n\t\t\t\t\t}];\n\t\t\t\t} else if (decl.endsWith('.$main')) {\n\t\t\t\t\tconst moduleName = decl.replace(/\\.\\$main$/, '');\n\t\t\t\t\treturn [...acc, {\n\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\ttype: 'module-entry',\n\t\t\t\t\t\tsyntax,\n\t\t\t\t\t}];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t[],\n\t\t);\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn [];\n\t}\n};\n\nconst getListDeclarationsCmd = async (parsedArgs: UnionOpts, sourceFile: string): Promise<string> => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} info list-declarations`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst flags = '--display-format json';\n\tconst cmd = `${baseCmd} ${inputFile} ${flags}`;\n\treturn cmd;\n};\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst isOutputFormatJSON = (parsedArgs: Opts): boolean => parsedArgs.json;\n\nconst getOutputContractFilename = (parsedArgs: Opts, module: ModuleInfo): string => {\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\treturn join(getArtifactsDir(parsedArgs), `${module.moduleName}${ext}`);\n};\n\nconst getOutputExprFilename = (parsedArgs: Opts, module: ModuleInfo, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = module.moduleName;\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage${ext}`\n\t\t: `${contractName}.${exprKind}.${exprName}${ext}`;\n\treturn join(getArtifactsDir(parsedArgs), `${outputFile}`);\n};\n\nconst getCompileContractCmd = async (parsedArgs: Opts, sourceFile: string, module: ModuleInfo): Promise<string> => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputContractFilename(parsedArgs, module)}`;\n\tconst flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\tconst moduleFlag = module.type.startsWith('file-') ? '' : `-m ${module.moduleName}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}${moduleFlag}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n\texprName: string,\n): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw new Error(`No project directory provided`);\n\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFilename(parsedArgs, module, exprKind, exprName)}`;\n\tconst flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\n\t// Parameter and Storage list files are expected to import the smart contract file as the \"Contract\" module.\n\tconst moduleFlag = (() => {\n\t\tswitch (module.type) {\n\t\t\tcase 'file-main':\n\t\t\tcase 'file-entry':\n\t\t\t\treturn '-m Contract';\n\t\t\tdefault:\n\t\t\t\treturn `-m Contract.${module.moduleName}`;\n\t\t}\n\t})();\n\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags} ${moduleFlag}`;\n\treturn cmd;\n};\n\nconst compileContract = async (parsedArgs: Opts, sourceFile: string, module: ModuleInfo): Promise<TableRow> => {\n\ttry {\n\t\tawait getArch();\n\t\tconst cmd = await getCompileContractCmd(parsedArgs, sourceFile, module);\n\t\tconst { stderr } = await execCmd(cmd);\n\t\tif (stderr.length > 0) sendWarn(stderr);\n\n\t\treturn {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: getOutputContractFilename(parsedArgs, module),\n\t\t};\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t};\n\t}\n};\n\nconst compileExpr =\n\t(parsedArgs: Opts, sourceFile: string, module: ModuleInfo, exprKind: ExprKind) =>\n\t(exprName: string): Promise<TableRow> => {\n\t\treturn getArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, module, exprKind, exprName))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => {\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\tconst artifactName = getOutputExprFilename(parsedArgs, module, exprKind, exprName);\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: artifactName,\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: `${exprName} in ${sourceFile} not compiled`,\n\t\t\t\t\terr,\n\t\t\t\t};\n\t\t\t});\n\t};\n\nconst getExprNames = (parsedArgs: Opts, sourceFile: string): Promise<string[]> => {\n\treturn new Promise((resolve, reject) => {\n\t\tconst inputFilePath = getInputFilenameAbsPath(parsedArgs, sourceFile);\n\t\tconst readInterface = readline.createInterface({\n\t\t\tinput: createReadStream(inputFilePath),\n\t\t\toutput: process.stdout,\n\t\t});\n\n\t\tconst variableNames: string[] = [];\n\n\t\treadInterface.on('line', function(line) {\n\t\t\t// Skip lines that start with a comment\n\t\t\tif (!line.trim().startsWith('//')) {\n\t\t\t\tconst matches = line.match(/(?<=\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g);\n\t\t\t\tif (matches) {\n\t\t\t\t\tvariableNames.push(...matches);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treadInterface.on('close', function() {\n\t\t\tresolve(variableNames);\n\t\t});\n\t});\n};\n\nconst compileExprs = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n): Promise<TableRow[]> => {\n\t// Get expressions from file\n\tlet exprs = [];\n\ttry {\n\t\texprs = await getExprNames(parsedArgs, sourceFile);\n\t} catch (err) {\n\t\temitExternalError(err, sourceFile);\n\t\treturn [{\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} expressions compiled`,\n\t\t}];\n\t}\n\n\tconst results = await Promise.all(exprs.map(async (exprName, index) => {\n\t\tconst compileResult = await compileExpr(\n\t\t\tparsedArgs,\n\t\t\tsourceFile,\n\t\t\tmodule,\n\t\t\texprKind === 'storage' && index === 0 ? 'default_storage' : exprKind,\n\t\t)(exprName);\n\t\treturn compileResult;\n\t}));\n\n\t// Collect errors\n\tconst errors = results.reduce(\n\t\t(acc, result) => {\n\t\t\tif (result.err) {\n\t\t\t\t// If its not an Error object, then just add it to the list\n\t\t\t\tif (!(result.err instanceof Error)) return [...acc, result.err];\n\n\t\t\t\t// Otherwise, get all ligo errors and ensure that the list is unique\n\t\t\t\tconst ligoErrs = (acc\n\t\t\t\t\t.filter(err => err instanceof Error) as Error[])\n\t\t\t\t\t.map(err => err.message);\n\n\t\t\t\tconst formattedError = formatLigoError(result.err);\n\n\t\t\t\treturn (ligoErrs.includes(formattedError.message)) ? acc : [...acc, formattedError];\n\t\t\t}\n\t\t\treturn acc;\n\t\t},\n\t\t[] as unknown[],\n\t);\n\n\t// Collect table rows\n\tconst retval = results.map(({ source, artifact }) => ({ source, artifact }));\n\n\tif (errors.length) emitExternalError(errors, sourceFile);\n\n\treturn retval;\n};\n\n// Helper function to get the initial message based on the pair value\nconst getInitialMessage = (pair: string, module: ModuleInfo) => {\n\tconst messages = {\n\t\t'mligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t// ... any other combinations\n\t} as Record<string, string>;\n\n\treturn messages[pair] || '// This file was created by Taqueria.';\n};\n\n// Helper function to get a common message\nconst getCommonMsg = (langType: Syntax, listType: ExprKind) => {\n\tconst varKeyword = langType === 'mligo' ? 'let' : 'const';\n\tconst commonMsgForStorage = `// IMPORTANT: We suggest always explicitly typing your storage values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} storage: int = 10\\` or \\`${varKeyword} storage: Contract.storage = 10\\``;\n\n\tconst commonMsgForParameter = `// IMPORTANT: We suggest always explicitly typing your parameter values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} parameter: int = 10\\` or \\`${varKeyword} parameter: Contract.parameter = 10\\``;\n\n\treturn listType === 'storage' ? commonMsgForStorage : commonMsgForParameter;\n};\n\n// Main function to get the content for storage or parameter\nconst getContent = (moduleInfo: ModuleInfo, listType: ExprKind) => {\n\tconst linkToContract = `#import \"${moduleInfo.sourceFile}\" \"Contract\"`;\n\tconst pair = `${moduleInfo.syntax}-${moduleInfo.type}`;\n\tconst initialMsg = getInitialMessage(pair, moduleInfo);\n\tconst commonMsg = getCommonMsg(moduleInfo.syntax, listType);\n\n\treturn `${linkToContract}\\n\\n${initialMsg}\\n\\n${commonMsg}`;\n};\n\n// Usage for storage list\nconst initContentForStorage = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'storage');\n\n// Usage for parameter list\nconst initContentForParameter = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'parameter');\n\nexport const compileContractWithStorageAndParameter = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n\tmodule: ModuleInfo,\n): Promise<TableRow[]> => {\n\tconst contractCompileResult = await compileContract(parsedArgs, sourceFile, module);\n\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\tdebugger;\n\n\tconst storageListFile = `${module.moduleName}.storageList${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);\n\tconst storageCompileResult = await access(storageListFilename)\n\t\t.then(() => compileExprs(parsedArgs, storageListFile, module, 'storage'))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: storage file associated with \"${module.moduleName}\" can't be found, so \"${storageListFile}\" has been created for you. Use this file to define all initial storage values for this contract\\n`,\n\t\t\t);\n\t\t\treturn writeFile(storageListFilename, initContentForStorage(module), 'utf8');\n\t\t});\n\n\tconst parameterListFile = `${module.moduleName}.parameterList${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);\n\tconst parameterCompileResult = await access(parameterListFilename)\n\t\t.then(() => compileExprs(parsedArgs, parameterListFile, module, 'parameter'))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: parameter file associated with \"${module.moduleName}\" can't be found, so \"${parameterListFile}\" has been created for you. Use this file to define all parameter values for this contract\\n`,\n\t\t\t);\n\t\t\treturn writeFile(parameterListFilename, initContentForParameter(module), 'utf8');\n\t\t});\n\n\tconst storageArtifacts = storageCompileResult ? storageCompileResult.map(res => res.artifact).join('\\n') : '';\n\tconst parameterArtifacts = parameterCompileResult ? parameterCompileResult.map(res => res.artifact).join('\\n') : '';\n\n\tconst combinedArtifact = [\n\t\tcontractCompileResult.artifact,\n\t\tstorageArtifacts,\n\t\tparameterArtifacts,\n\t].filter(Boolean).join('\\n');\n\n\tconst combinedRow: TableRow = {\n\t\tsource: module.sourceName,\n\t\tartifact: combinedArtifact,\n\t};\n\n\treturn [combinedRow];\n};\n\nexport const compile = async (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!isLIGOFile(sourceFile)) {\n\t\tsendErr(`${sourceFile} is not a LIGO file`);\n\t\treturn;\n\t}\n\tif (isStorageListFile(sourceFile) || isParameterListFile(sourceFile)) {\n\t\tsendErr(`Storage and parameter list files are not meant to be compiled directly`);\n\t\treturn;\n\t}\n\tif (isUnsupportedLigoSyntax(sourceFile)) {\n\t\tsendErr(`Unsupported LIGO syntax detected in ${sourceFile}. Note, we only support .jsligo and .mligo files.`);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst modules = await listContractModules(parsedArgs, sourceFile);\n\t\tif (modules.length === 0) {\n\t\t\treturn sendJsonRes([\n\t\t\t\t{\n\t\t\t\t\tsource: sourceFile,\n\t\t\t\t\tartifact: `No contract modules found in \"${sourceFile}\"`,\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tlet allCompileResults: TableRow[] = [];\n\t\tfor (const module of modules) {\n\t\t\t// If we're only to compile a particular module, then we'll skip any that don't match\n\t\t\tif (parsedArgs.module && parsedArgs.module !== module.moduleName) continue;\n\n\t\t\tconst compileResults = await compileContractWithStorageAndParameter(parsedArgs, sourceFile, module);\n\t\t\tallCompileResults = allCompileResults.concat(compileResults);\n\t\t}\n\n\t\tsendJsonRes(allCompileResults, { footer: `\\nCompiled ${allCompileResults.length} contract(s) in \"${sourceFile}\"` });\n\t} catch (err) {\n\t\tsendErr(`Error processing \"${sourceFile}\": ${err}`);\n\t}\n};\n\nexport default compile;\n","import { sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport glob from 'fast-glob';\nimport { join } from 'path';\nimport { CompileAllOpts, CompileAllOpts as Opts, CompileOpts } from './common';\nimport {\n\tcompileContractWithStorageAndParameter,\n\tisParameterListFile,\n\tisStorageListFile,\n\tlistContractModules,\n\tTableRow,\n} from './compile';\n\nconst compileAll = async (parsedArgs: Opts): Promise<void> => {\n\tlet compilePromises: Promise<TableRow[]>[] = [];\n\n\tconst contractFilenames = await glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{\n\t\t\tcwd: join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts'),\n\t\t\tabsolute: false,\n\t\t},\n\t);\n\n\tfor (const filename of contractFilenames) {\n\t\tif (isStorageListFile(filename) || isParameterListFile(filename)) continue;\n\t\tconst moduleNames = await listContractModules(parsedArgs as unknown as CompileAllOpts, filename);\n\t\tfor (const moduleName of moduleNames) {\n\t\t\tcompilePromises.push(compileContractWithStorageAndParameter(parsedArgs as CompileOpts, filename, moduleName));\n\t\t}\n\t}\n\n\treturn Promise.all(compilePromises)\n\t\t.then(tables => tables.flat())\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendErr(err, false));\n};\n\nexport default compileAll;\n","import { execCmd, getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { readJsonFile, writeJsonFile } from '@taqueria/node-sdk';\nimport { join } from 'path';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (\n\tparsedArgs: Opts,\n\tuid: string,\n\tgid: string,\n\tuserArgs: string,\n): [string, Record<string, string>] => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\n\tconst userMap = uid && gid ? `${uid}:${gid}` : uid;\n\tconst userMapArgs = uid ? ['-u', userMap] : [];\n\n\tconst binary = 'docker';\n\tconst baseArgs = [\n\t\t'run',\n\t\t'--rm',\n\t\t'-v',\n\t\t`${projectDir}:/project`,\n\t\t'-w',\n\t\t'/project',\n\t\t...userMapArgs,\n\t\tgetLigoDockerImage(),\n\t];\n\tconst processedUserArgs = userArgs.split(' ').map(arg => arg.startsWith('\\\\-') ? arg.substring(1) : arg).filter(arg =>\n\t\targ\n\t);\n\tconst args = [...baseArgs, ...processedUserArgs, '--skip-analytics'];\n\tconst envVars = { 'DOCKER_DEFAULT_PLATFORM': 'linux/amd64' };\n\treturn [\n\t\t[binary, ...args].join(' '),\n\t\tenvVars,\n\t];\n};\n\nconst ensureEsyExists = async (parsedArgs: Opts): Promise<string> => {\n\tconst esyJsonPath = join(parsedArgs.projectDir, 'esy.json');\n\n\ttry {\n\t\treturn await readJsonFile(esyJsonPath);\n\t} catch {\n\t\treturn await writeJsonFile(esyJsonPath)({});\n\t}\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tensureEsyExists(parsedArgs)\n\t\t.then(getArch)\n\t\t.then(async () => {\n\t\t\tconst uid = await execCmd('id -u');\n\t\t\tconst gid = await execCmd('id -g');\n\t\t\treturn [uid.stdout.trim(), gid.stdout.trim()];\n\t\t})\n\t\t.then(([uid, gid]) => getArbitraryLigoCmd(parsedArgs, uid, gid, cmd))\n\t\t.then(([cmd, envVars]) => spawnCmd(cmd, envVars))\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { emitExternalError, getInputFilenameRelPath, getLigoDockerImage, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst cmd = `${baseCmd} ${inputFile}`;\n\treturn cmd;\n};\n\nconst testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stdout, stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nconst test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!sourceFile) return sendAsyncErr(`No source file provided`);\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"mappings":";AAAA,SAAS,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AA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AAAA,EACP,aAAa,QAAQ,SAAS;AAC/B,IAAI,QAAQ,IAAI;","names":["sendAsyncErr","sendErr","writeFile","join","join","writeFile","sendErr","sendErr","sendJsonRes","join","join","sendJsonRes","sendErr","execCmd","getArch","sendAsyncErr","sendRes","join","join","getArch","execCmd","cmd","sendAsyncErr","sendRes","execCmd","getArch","sendAsyncErr","sendJsonRes","sendWarn","getArch","execCmd","sendWarn","sendAsyncErr","sendJsonRes","sendAsyncErr"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taqueria/plugin-ligo",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.10",
|
|
4
4
|
"description": "A taqueria plugin for compiling LIGO smart contracts",
|
|
5
5
|
"targets": {
|
|
6
6
|
"default": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://github.com/pinnacle-labs/taqueria#readme",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@taqueria/node-sdk": "^0.40.
|
|
44
|
+
"@taqueria/node-sdk": "^0.40.10",
|
|
45
45
|
"fast-glob": "^3.3.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|