@taqueria/plugin-ligo 0.24.2 → 0.25.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Taqueria LIGO Plugin
2
2
 
3
- The LIGO plugin provides a task to compile LIGO smart contracts to Michelson `.tz` files
3
+ The LIGO plugin provides tasks to work with LIGO smart contracts such as compiling and testing
4
4
 
5
5
  ## Requirements
6
6
 
@@ -11,10 +11,14 @@ The LIGO plugin provides a task to compile LIGO smart contracts to Michelson `.t
11
11
  ## Installation
12
12
 
13
13
  To install the LIGO plugin on a Taqueria project, navigate to the project folder and run:
14
+
14
15
  ```shell
15
16
  taq install @taqueria/plugin-ligo
16
17
  ```
17
18
 
19
+ > ### :page_with_curl: Note
20
+ > You can override the Ligo version used by the plugin by creating the environment variable `TAQ_LIGO_IMAGE` and setting it to your desired Ligo Docker image
21
+
18
22
  ## The `taq compile` Task
19
23
 
20
24
  Basic usage is:
package/_readme.eta CHANGED
@@ -2,7 +2,7 @@
2
2
  # Taqueria LIGO Plugin
3
3
  <% } %>
4
4
 
5
- The LIGO plugin provides a task to compile LIGO smart contracts to Michelson `.tz` files
5
+ The LIGO plugin provides tasks to work with LIGO smart contracts such as compiling and testing
6
6
 
7
7
  ## Requirements
8
8
 
package/common.ts CHANGED
@@ -29,6 +29,7 @@ export const getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): str
29
29
  join(parsedArgs.config.contractsDir, sourceFile);
30
30
 
31
31
  export const emitExternalError = (err: unknown, sourceFile: string): void => {
32
- sendErr(`\n=== For ${sourceFile} ===`);
32
+ sendErr(`\n=== Error messages for ${sourceFile} ===`);
33
33
  err instanceof Error ? sendErr(err.message.replace(/Command failed.+?\n/, '')) : sendErr(err as any);
34
+ sendErr(`\n===`);
34
35
  };
package/compile.ts CHANGED
@@ -32,7 +32,7 @@ const removeExt = (path: string): string => {
32
32
  return path.replace(extRegex, '');
33
33
  };
34
34
 
35
- const getOutputFilename = (parsedArgs: Opts, sourceFile: string): string => {
35
+ const getOutputContractFilename = (parsedArgs: Opts, sourceFile: string): string => {
36
36
  const outputFile = basename(sourceFile, extname(sourceFile));
37
37
  return join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);
38
38
  };
@@ -50,7 +50,7 @@ const getContractNameForExpr = (sourceFile: string, exprKind: ExprKind): string
50
50
  };
51
51
 
52
52
  // If sourceFile is token.storageList.mligo, then it'll return token.storage.{storageName}.tz
53
- const getOutputExprFileName = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {
53
+ const getOutputExprFilename = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {
54
54
  const contractName = basename(getContractNameForExpr(sourceFile, exprKind), extname(sourceFile));
55
55
  const outputFile = exprKind === 'default_storage'
56
56
  ? `${contractName}.default_storage.tz`
@@ -64,7 +64,7 @@ const getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string =>
64
64
  const baseCmd =
65
65
  `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;
66
66
  const inputFile = getInputFilename(parsedArgs, sourceFile);
67
- const outputFile = `-o ${getOutputFilename(parsedArgs, sourceFile)}`;
67
+ const outputFile = `-o ${getOutputContractFilename(parsedArgs, sourceFile)}`;
68
68
  const cmd = `${baseCmd} ${inputFile} ${outputFile}`;
69
69
  return cmd;
70
70
  };
@@ -76,7 +76,7 @@ const getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprK
76
76
  const baseCmd =
77
77
  `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;
78
78
  const inputFile = getInputFilename(parsedArgs, sourceFile);
79
- const outputFile = `-o ${getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;
79
+ const outputFile = `-o ${getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
80
80
  const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;
81
81
  return cmd;
82
82
  };
@@ -89,7 +89,7 @@ const compileContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow
89
89
  if (stderr.length > 0) sendWarn(stderr);
90
90
  return {
91
91
  contract: sourceFile,
92
- artifact: getOutputFilename(parsedArgs, sourceFile),
92
+ artifact: getOutputContractFilename(parsedArgs, sourceFile),
93
93
  };
94
94
  })
95
95
  .catch(err => {
@@ -109,7 +109,7 @@ const compileExpr = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind) =
109
109
  if (stderr.length > 0) sendWarn(stderr);
110
110
  return {
111
111
  contract: sourceFile,
112
- artifact: getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName),
112
+ artifact: getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName),
113
113
  };
114
114
  })
115
115
  .catch(err => {
@@ -120,11 +120,14 @@ const compileExpr = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind) =
120
120
  };
121
121
  });
122
122
 
123
- const compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>
123
+ const getExprNames = (parsedArgs: Opts, sourceFile: string): Promise<string[]> =>
124
124
  readFile(getInputFilename(parsedArgs, sourceFile), 'utf8')
125
- .then(data => data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g))
125
+ .then(data => data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
126
+
127
+ const compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>
128
+ getExprNames(parsedArgs, sourceFile)
126
129
  .then(exprNames => {
127
- if (!exprNames) return [];
130
+ if (exprNames.length === 0) return [];
128
131
  const firstExprName = exprNames.slice(0, 1)[0];
129
132
  const restExprNames = exprNames.slice(1, exprNames.length);
130
133
  const firstExprKind = isStorageKind(exprKind) ? 'default_storage' : 'parameter';
package/index.js CHANGED
@@ -149,8 +149,9 @@ const $844cb58d66fbf6db$var$LIGO_IMAGE_ENV_VAR = "TAQ_LIGO_IMAGE";
149
149
  const $844cb58d66fbf6db$export$2b403d61ac8ea302 = ()=>(0, $kQNfl$taquerianodesdk.getDockerImage)($844cb58d66fbf6db$var$LIGO_DEFAULT_IMAGE, $844cb58d66fbf6db$var$LIGO_IMAGE_ENV_VAR);
150
150
  const $844cb58d66fbf6db$export$17f107107c3c82c6 = (parsedArgs, sourceFile)=>(0, $kQNfl$path.join)(parsedArgs.config.contractsDir, sourceFile);
151
151
  const $844cb58d66fbf6db$export$b59ff90dc389ce6d = (err, sourceFile)=>{
152
- (0, $kQNfl$taquerianodesdk.sendErr)(`\n=== For ${sourceFile} ===`);
152
+ (0, $kQNfl$taquerianodesdk.sendErr)(`\n=== Error messages for ${sourceFile} ===`);
153
153
  err instanceof Error ? (0, $kQNfl$taquerianodesdk.sendErr)(err.message.replace(/Command failed.+?\n/, "")) : (0, $kQNfl$taquerianodesdk.sendErr)(err);
154
+ (0, $kQNfl$taquerianodesdk.sendErr)(`\n===`);
154
155
  };
155
156
 
156
157
 
@@ -172,7 +173,7 @@ const $24b2f47d8f306cb3$var$removeExt = (path)=>{
172
173
  const extRegex = new RegExp($24b2f47d8f306cb3$var$extractExt(path));
173
174
  return path.replace(extRegex, "");
174
175
  };
175
- const $24b2f47d8f306cb3$var$getOutputFilename = (parsedArgs, sourceFile)=>{
176
+ const $24b2f47d8f306cb3$var$getOutputContractFilename = (parsedArgs, sourceFile)=>{
176
177
  const outputFile = (0, $kQNfl$path.basename)(sourceFile, (0, $kQNfl$path.extname)(sourceFile));
177
178
  return (0, $kQNfl$path.join)(parsedArgs.config.artifactsDir, `${outputFile}.tz`);
178
179
  };
@@ -186,7 +187,7 @@ const $24b2f47d8f306cb3$var$getContractNameForExpr = (sourceFile, exprKind)=>{
186
187
  }
187
188
  };
188
189
  // If sourceFile is token.storageList.mligo, then it'll return token.storage.{storageName}.tz
189
- const $24b2f47d8f306cb3$var$getOutputExprFileName = (parsedArgs, sourceFile, exprKind, exprName)=>{
190
+ const $24b2f47d8f306cb3$var$getOutputExprFilename = (parsedArgs, sourceFile, exprKind, exprName)=>{
190
191
  const contractName = (0, $kQNfl$path.basename)($24b2f47d8f306cb3$var$getContractNameForExpr(sourceFile, exprKind), (0, $kQNfl$path.extname)(sourceFile));
191
192
  const outputFile = exprKind === "default_storage" ? `${contractName}.default_storage.tz` : `${contractName}.${exprKind}.${exprName}.tz`;
192
193
  return (0, $kQNfl$path.join)(parsedArgs.config.artifactsDir, `${outputFile}`);
@@ -196,7 +197,7 @@ const $24b2f47d8f306cb3$var$getCompileContractCmd = (parsedArgs, sourceFile)=>{
196
197
  if (!projectDir) throw `No project directory provided`;
197
198
  const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$2b403d61ac8ea302)()} compile contract`;
198
199
  const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
199
- const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputFilename(parsedArgs, sourceFile)}`;
200
+ const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputContractFilename(parsedArgs, sourceFile)}`;
200
201
  const cmd = `${baseCmd} ${inputFile} ${outputFile}`;
201
202
  return cmd;
202
203
  };
@@ -206,7 +207,7 @@ const $24b2f47d8f306cb3$var$getCompileExprCmd = (parsedArgs, sourceFile, exprKin
206
207
  const compilerType = $24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "storage" : "parameter";
207
208
  const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$2b403d61ac8ea302)()} compile ${compilerType}`;
208
209
  const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
209
- const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;
210
+ const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
210
211
  const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;
211
212
  return cmd;
212
213
  };
@@ -214,7 +215,7 @@ const $24b2f47d8f306cb3$var$compileContract = (parsedArgs, sourceFile)=>(0, $kQN
214
215
  if (stderr.length > 0) (0, $kQNfl$taquerianodesdk.sendWarn)(stderr);
215
216
  return {
216
217
  contract: sourceFile,
217
- artifact: $24b2f47d8f306cb3$var$getOutputFilename(parsedArgs, sourceFile)
218
+ artifact: $24b2f47d8f306cb3$var$getOutputContractFilename(parsedArgs, sourceFile)
218
219
  };
219
220
  }).catch((err)=>{
220
221
  (0, $844cb58d66fbf6db$export$b59ff90dc389ce6d)(err, sourceFile);
@@ -227,7 +228,7 @@ const $24b2f47d8f306cb3$var$compileExpr = (parsedArgs, sourceFile, exprKind)=>(e
227
228
  if (stderr.length > 0) (0, $kQNfl$taquerianodesdk.sendWarn)(stderr);
228
229
  return {
229
230
  contract: sourceFile,
230
- artifact: $24b2f47d8f306cb3$var$getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)
231
+ artifact: $24b2f47d8f306cb3$var$getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)
231
232
  };
232
233
  }).catch((err)=>{
233
234
  (0, $844cb58d66fbf6db$export$b59ff90dc389ce6d)(err, sourceFile);
@@ -236,8 +237,9 @@ const $24b2f47d8f306cb3$var$compileExpr = (parsedArgs, sourceFile, exprKind)=>(e
236
237
  artifact: $24b2f47d8f306cb3$var$COMPILE_ERR_MSG
237
238
  };
238
239
  });
239
- const $24b2f47d8f306cb3$var$compileExprs = (parsedArgs, sourceFile, exprKind)=>(0, $kQNfl$fspromises.readFile)((0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile), "utf8").then((data)=>data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g)).then((exprNames)=>{
240
- if (!exprNames) return [];
240
+ const $24b2f47d8f306cb3$var$getExprNames = (parsedArgs, sourceFile)=>(0, $kQNfl$fspromises.readFile)((0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile), "utf8").then((data)=>data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
241
+ const $24b2f47d8f306cb3$var$compileExprs = (parsedArgs, sourceFile, exprKind)=>$24b2f47d8f306cb3$var$getExprNames(parsedArgs, sourceFile).then((exprNames)=>{
242
+ if (exprNames.length === 0) return [];
241
243
  const firstExprName = exprNames.slice(0, 1)[0];
242
244
  const restExprNames = exprNames.slice(1, exprNames.length);
243
245
  const firstExprKind = $24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "default_storage" : "parameter";
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;ACAA;;ACAO,MAAM,yCAAc,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAwB/B,CAAC,AAAC;AAEK,MAAM,yCAAkB,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BnC,CAAC,AAAC;AAEK,MAAM,yCAAe,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBhC,CAAC,AAAC;AAEK,MAAM,yCAAe,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBhC,CAAC,AAAC;;;ADlGF,MAAM,sCAAgB,GAAG,CAAC,GAAS,EAAE,YAAoB,GAAK;IAC7D,CAAA,GAAA,mCAAY,CAAA,CAAC,gBAAgB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;CACjD,AAAC;AAEF,MAAM,qCAAe,GAAG,OAAO,YAAoB,EAAE,MAA0B,GAAsB;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,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iCAAiC;qBAC9C,CAAC;iBACF;gBACD,OAAO,EAAE,CAAA,GAAA,wCAAc,CAAA;aACvB,CAAC;SACF;QACD,KAAK,EAAE,CAAA,GAAA,wCAAI,CAAA;KACX,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/createContract.ts","taqueria-plugin-ligo/ligo_templates.ts","taqueria-plugin-ligo/main.ts","taqueria-plugin-ligo/common.ts","taqueria-plugin-ligo/compile.ts","taqueria-plugin-ligo/ligo.ts","taqueria-plugin-ligo/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\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}), process.argv);\n","import { experimental, sendAsyncErr } from '@taqueria/node-sdk';\nimport * as RequestArgs from '@taqueria/protocol/RequestArgs';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template, pascaligo_template, religo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst registerContract = (arg: Opts, contractName: string) => {\n\texperimental.registerContract(arg, contractName);\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 === 'ligo') return pascaligo_template;\n\tif (syntax === 'religo') return religo_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 === 'ligo') return pascaligo_template;\n\t\tif (ext === 'religo') return religo_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 = (arg: Opts) => {\n\tconst contractName = arg.sourceFileName as string;\n\tconst syntax = arg.syntax;\n\tconst contractsDir = `${arg.config.projectDir}/${arg.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template))\n\t\t.then(_ => registerContract(arg, contractName));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\n\ntype parameter =\n Increment of int\n| Decrement of int\n| Reset\n\ntype return = operation list * storage\n\n// Two entrypoints\n\nlet add (store, delta : storage * int) : storage = store + delta\nlet sub (store, delta : storage * int) : storage = store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nlet main (action, store : parameter * storage) : return =\n ([] : operation list), // No operations\n (match action with\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0)\n`;\n\nexport const pascaligo_template = `\ntype storage is int\n\ntype parameter is\n Increment of int\n| Decrement of int\n| Reset\n\ntype return is list (operation) * storage\n\n// Two entrypoints\n\nfunction add (const store : storage; const delta : int) : storage is \n store + delta\n\nfunction sub (const store : storage; const delta : int) : storage is \n store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nfunction main (const action : parameter; const store : storage) : return is\n ((nil : list (operation)), // No operations\n case action of [\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0\n ])\n`;\n\nexport const religo_template = `\ntype storage = int;\n\ntype parameter =\n Increment (int)\n| Decrement (int)\n| Reset;\n\ntype return = (list (operation), storage);\n\n// Two entrypoints\n\nlet add = ((store, delta) : (storage, int)) : storage => store + delta;\nlet sub = ((store, delta) : (storage, int)) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n \nlet main = ((action, store) : (parameter, storage)) : return => {\n (([] : list (operation)), // No operations\n (switch (action) {\n | Increment (n) => add ((store, n))\n | Decrement (n) => sub ((store, n))\n | Reset => 0}))\n};\n`;\n\nexport const jsligo_template = `\ntype storage = int;\n\ntype parameter =\n [\"Increment\", int]\n| [\"Decrement\", int]\n| [\"Reset\"];\n\ntype ret = [list<operation>, storage];\n\n// Two entrypoints\n\nconst add = ([store, delta] : [storage, int]) : storage => store + delta;\nconst sub = ([store, delta] : [storage, int]) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n\nconst main = ([action, store] : [parameter, storage]) : ret => {\n return [list([]) as list<operation>, // No operations\n match (action, {\n Increment:(n: int) => add ([store, n]),\n Decrement:(n: int) => sub ([store, n]),\n Reset :() => 0})]\n};\n`;\n","import { sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: Opts): Promise<void> => {\n\tswitch (parsedArgs.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(parsedArgs);\n\t\tcase 'compile':\n\t\t\treturn compile(parsedArgs);\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(`${parsedArgs.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 { RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends RequestArgs.ProxyRequestArgs {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport interface TestOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & TestOpts;\n\ntype UnionOpts = LigoOpts | CompileOpts | 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.54.1';\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 getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir, sourceFile);\n\nexport const emitExternalError = (err: unknown, sourceFile: string): void => {\n\tsendErr(`\\n=== For ${sourceFile} ===`);\n\terr instanceof Error ? sendErr(err.message.replace(/Command failed.+?\\n/, '')) : sendErr(err as any);\n};\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport { CompileOpts as Opts, emitExternalError, getInputFilename, getLigoDockerImage } from './common';\n\ntype TableRow = { contract: string; artifact: string };\n\ntype ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nconst isLIGOFile = (sourceFile: string): boolean => /.+\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isStorageListFile = (sourceFile: string): boolean =>\n\t/.+\\.(storageList|storages)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isParameterListFile = (sourceFile: string): boolean =>\n\t/.+\\.(parameterList|parameters)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isContractFile = (sourceFile: string): boolean =>\n\tisLIGOFile(sourceFile) && !isStorageListFile(sourceFile) && !isParameterListFile(sourceFile);\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 getOutputFilename = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst outputFile = basename(sourceFile, extname(sourceFile));\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);\n};\n\n// Get the contract name that the storage/parameter file is associated with\n// e.g. If sourceFile is token.storageList.mligo, then it'll return token.mligo\nconst getContractNameForExpr = (sourceFile: string, exprKind: ExprKind): string => {\n\ttry {\n\t\treturn isStorageKind(exprKind)\n\t\t\t? sourceFile.match(/.+(?=\\.(?:storageList|storages)\\.(ligo|religo|mligo|jsligo))/)!.join('.')\n\t\t\t: sourceFile.match(/.+(?=\\.(?:parameterList|parameters)\\.(ligo|religo|mligo|jsligo))/)!.join('.');\n\t} catch (err) {\n\t\tthrow new Error(`Something went wrong internally when dealing with filename format: ${err}`);\n\t}\n};\n\n// If sourceFile is token.storageList.mligo, then it'll return token.storage.{storageName}.tz\nconst getOutputExprFileName = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = basename(getContractNameForExpr(sourceFile, exprKind), extname(sourceFile));\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage.tz`\n\t\t: `${contractName}.${exprKind}.${exprName}.tz`;\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}`);\n};\n\nconst getCompileContractCmd = (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()} compile contract`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputFilename(parsedArgs, sourceFile)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `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 = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;\n\treturn cmd;\n};\n\nconst compileContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getCompileContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: getOutputFilename(parsedArgs, sourceFile),\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\tartifact: COMPILE_ERR_MSG,\n\t\t\t};\n\t\t});\n\nconst compileExpr = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind) =>\n\t(exprName: string): Promise<TableRow> =>\n\t\tgetArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, 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\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\temitExternalError(err, sourceFile);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t\t};\n\t\t\t});\n\nconst compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>\n\treadFile(getInputFilename(parsedArgs, sourceFile), 'utf8')\n\t\t.then(data => data.match(/(?<=\\n\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g))\n\t\t.then(exprNames => {\n\t\t\tif (!exprNames) return [];\n\t\t\tconst firstExprName = exprNames.slice(0, 1)[0];\n\t\t\tconst restExprNames = exprNames.slice(1, exprNames.length);\n\t\t\tconst firstExprKind = isStorageKind(exprKind) ? 'default_storage' : 'parameter';\n\t\t\tconst restExprKind = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\t\t\tconst firstExprResult = compileExpr(parsedArgs, sourceFile, firstExprKind)(firstExprName);\n\t\t\tconst restExprResults = restExprNames.map(compileExpr(parsedArgs, sourceFile, restExprKind));\n\t\t\treturn Promise.all([firstExprResult].concat(restExprResults));\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\tartifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} values compiled`,\n\t\t\t}];\n\t\t})\n\t\t.then(mergeArtifactsOutput(sourceFile));\n\n// TODO: Just for backwards compatibility. Can be deleted in the future.\nconst tryLegacyStorageNamingConvention = (parsedArgs: Opts, sourceFile: string) => {\n\tconst storageListFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilename(parsedArgs, storageListFile);\n\treturn access(storageListFilename).then(() => {\n\t\tsendWarn(\n\t\t\t`Warning: The naming convention of \"<CONTRACT>.storages.<EXTENSION>\" is deprecated and renamed to \"<CONTRACT>.storageList.<EXTENSION>\". Please adjust your storage file names accordingly\\n`,\n\t\t);\n\t\treturn compileExprs(parsedArgs, storageListFile, 'storage');\n\t});\n};\n\n// TODO: Just for backwards compatibility. Can be deleted in the future.\nconst tryLegacyParameterNamingConvention = (parsedArgs: Opts, sourceFile: string) => {\n\tconst parameterListFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilename(parsedArgs, parameterListFile);\n\treturn access(parameterListFilename).then(() => {\n\t\tsendWarn(\n\t\t\t`Warning: The naming convention of \"<CONTRACT>.parameters.<EXTENSION>\" is deprecated and renamed to \"<CONTRACT>.parameterList.<EXTENSION>\". Please adjust your parameter file names accordingly\\n`,\n\t\t);\n\t\treturn compileExprs(parsedArgs, parameterListFile, 'parameter');\n\t});\n};\n\nconst initContentForStorage = (sourceFile: string): string => {\n\tconst linkToContract = `#include \"${sourceFile}\"\\n\\n`;\n\n\tconst instruction =\n\t\t'// Define your initial storage values as a list of LIGO variable definitions,\\n// the first of which will be considered the default value to be used for origination later on\\n';\n\n\tconst ext = extractExt(sourceFile);\n\tlet syntax = '';\n\tif (ext === '.ligo') syntax = '// E.g. const aStorageValue : aStorageType = 10;\\n\\n';\n\telse if (ext === '.religo') syntax = '// E.g. let aStorageValue : aStorageType = 10;\\n\\n';\n\telse if (ext === '.mligo') syntax = '// E.g. let aStorageValue : aStorageType = 10\\n\\n';\n\telse if (ext === '.jsligo') syntax = '// E.g. const aStorageValue : aStorageType = 10;\\n\\n';\n\n\treturn linkToContract + instruction + syntax;\n};\n\nconst initContentForParameter = (sourceFile: string): string => {\n\tconst linkToContract = `#include \"${sourceFile}\"\\n\\n`;\n\n\tconst instruction = '// Define your parameter values as a list of LIGO variable definitions\\n';\n\n\tconst ext = extractExt(sourceFile);\n\tlet syntax = '';\n\tif (ext === '.ligo') syntax = '// E.g. const aParameterValue : aParameterType = Increment(1);\\n\\n';\n\telse if (ext === '.religo') syntax = '// E.g. let aParameterValue : aParameterType = (Increment (1));\\n\\n';\n\telse if (ext === '.mligo') syntax = '// E.g. let aParameterValue : aParameterType = Increment 1\\n\\n';\n\telse if (ext === '.jsligo') syntax = '// E.g. const aParameterValue : aParameterType = (Increment (1));\\n\\n';\n\n\treturn linkToContract + instruction + syntax;\n};\n\nconst compileContractWithStorageAndParameter = async (parsedArgs: Opts, sourceFile: string): Promise<TableRow[]> => {\n\tconst contractCompileResult = await compileContract(parsedArgs, sourceFile);\n\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\n\tconst storageListFile = `${removeExt(sourceFile)}.storageList${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilename(parsedArgs, storageListFile);\n\tconst storageCompileResult = await access(storageListFilename)\n\t\t.then(() => compileExprs(parsedArgs, storageListFile, 'storage'))\n\t\t.catch(() => tryLegacyStorageNamingConvention(parsedArgs, sourceFile))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: storage file associated with \"${sourceFile}\" 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\twriteFile(storageListFilename, initContentForStorage(sourceFile), 'utf8');\n\t\t});\n\n\tconst parameterListFile = `${removeExt(sourceFile)}.parameterList${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilename(parsedArgs, parameterListFile);\n\tconst parameterCompileResult = await access(parameterListFilename)\n\t\t.then(() => compileExprs(parsedArgs, parameterListFile, 'parameter'))\n\t\t.catch(() => tryLegacyParameterNamingConvention(parsedArgs, sourceFile))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: parameter file associated with \"${sourceFile}\" 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\twriteFile(parameterListFilename, initContentForParameter(sourceFile), 'utf8');\n\t\t});\n\n\tlet compileResults: TableRow[] = [contractCompileResult];\n\tif (storageCompileResult) compileResults = compileResults.concat(storageCompileResult);\n\tif (parameterCompileResult) compileResults = compileResults.concat(parameterCompileResult);\n\treturn compileResults;\n};\n\n/*\nCompiling storage/parameter file amounts to compiling multiple expressions in that file,\nresulting in multiple rows with the same file name but different artifact names.\nThis will merge these rows into one row with just one mention of the file name.\ne.g.\n┌─────────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├─────────────────────────┼─────────────────────────────────────────────┤\n│ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │\n├─────────────────────────┼─────────────────────────────────────────────┤\n│ hello.storageList.mligo │ artifacts/hello.storage.storage2.tz │\n└─────────────────────────┴─────────────────────────────────────────────┘\n\t\t\t\t\t\t\t\tversus\n┌─────────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├─────────────────────────┼─────────────────────────────────────────────┤\n│ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │\n│ │ artifacts/hello.storage.storage2.tz │\n└─────────────────────────┴─────────────────────────────────────────────┘\n*/\nconst mergeArtifactsOutput = (sourceFile: string) =>\n\t(tableRows: TableRow[]): TableRow[] => {\n\t\tconst artifactsOutput = tableRows.reduce(\n\t\t\t(acc: string, row: TableRow) => row.artifact === COMPILE_ERR_MSG ? acc : `${acc}${row.artifact}\\n`,\n\t\t\t'',\n\t\t);\n\t\treturn [{\n\t\t\tcontract: sourceFile,\n\t\t\tartifact: artifactsOutput,\n\t\t}];\n\t};\n\nconst compile = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tlet p: Promise<TableRow[]>;\n\tif (isStorageListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');\n\telse if (isParameterListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'parameter');\n\telse if (isContractFile(sourceFile)) p = compileContractWithStorageAndParameter(parsedArgs, sourceFile);\n\telse {\n\t\treturn sendAsyncErr(\n\t\t\t`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`,\n\t\t);\n\t}\n\treturn p.then(sendJsonRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n","import { CmdArgEnv, getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (parsedArgs: Opts, userArgs: string): CmdArgEnv => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst binary = 'docker';\n\tconst baseArgs = ['run', '--rm', '-v', `${projectDir}:/project`, '-w', '/project', getLigoDockerImage()];\n\tconst processedUserArgs = userArgs.split(' ').map(arg => arg.startsWith('\\\\-') ? arg.substring(1) : arg).filter(arg =>\n\t\targ\n\t);\n\tconst args = baseArgs.concat(processedUserArgs);\n\tconst envVars = { 'DOCKER_DEFAULT_PLATFORM': 'linux/amd64' };\n\treturn [binary, args, envVars];\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tgetArch()\n\t\t.then(() => getArbitraryLigoCmd(parsedArgs, cmd))\n\t\t.then(spawnCmd)\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, getInputFilename, 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 = getInputFilename(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\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
1
+ {"mapp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AA,2BAAI,CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,mBAAmB;gBAC5B,WAAW,EAAE,uCAAuC;gBACpD,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;aAChB,CAAC;YACF,CAAA,GAAA,2BAAI,CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,WAAW;gBACpB,WAAW,EAAE,uCAAuC;gBACpD,OAAO,EAAE,OAAO;gBAChB,MAAM,EAAE,IAAI;aACZ,CAAC;SACF;QACD,SAAS,EAAE;YACV,CAAA,GAAA,+BAAQ,CAAA,CAAC,MAAM,CAAC;gBACf,QAAQ,EAAE,UAAU;gBACpB,OAAO,EAAE,2BAA2B;gBACpC,WAAW,EAAE,8CAA8C;gBAC3D,WAAW,EAAE;oBACZ,CAAA,GAAA,oCAAa,CAAA,CAAC,MAAM,CAAC;wBACpB,WAAW,EAAE,gBAAgB;wBAC7B,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,2CAA2C;qBACxD,CAAC;iBACF;gBACD,OAAO,EAAE;oBACR,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iCAAiC;qBAC9C,CAAC;iBACF;gBACD,OAAO,EAAE,CAAA,GAAA,wCAAc,CAAA;aACvB,CAAC;SACF;QACD,KAAK,EAAE,CAAA,GAAA,wCAAI,CAAA;KACX,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/createContract.ts","taqueria-plugin-ligo/ligo_templates.ts","taqueria-plugin-ligo/main.ts","taqueria-plugin-ligo/common.ts","taqueria-plugin-ligo/compile.ts","taqueria-plugin-ligo/ligo.ts","taqueria-plugin-ligo/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\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}), process.argv);\n","import { experimental, sendAsyncErr } from '@taqueria/node-sdk';\nimport * as RequestArgs from '@taqueria/protocol/RequestArgs';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template, pascaligo_template, religo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst registerContract = (arg: Opts, contractName: string) => {\n\texperimental.registerContract(arg, contractName);\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 === 'ligo') return pascaligo_template;\n\tif (syntax === 'religo') return religo_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 === 'ligo') return pascaligo_template;\n\t\tif (ext === 'religo') return religo_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 = (arg: Opts) => {\n\tconst contractName = arg.sourceFileName as string;\n\tconst syntax = arg.syntax;\n\tconst contractsDir = `${arg.config.projectDir}/${arg.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template))\n\t\t.then(_ => registerContract(arg, contractName));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\n\ntype parameter =\n Increment of int\n| Decrement of int\n| Reset\n\ntype return = operation list * storage\n\n// Two entrypoints\n\nlet add (store, delta : storage * int) : storage = store + delta\nlet sub (store, delta : storage * int) : storage = store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nlet main (action, store : parameter * storage) : return =\n ([] : operation list), // No operations\n (match action with\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0)\n`;\n\nexport const pascaligo_template = `\ntype storage is int\n\ntype parameter is\n Increment of int\n| Decrement of int\n| Reset\n\ntype return is list (operation) * storage\n\n// Two entrypoints\n\nfunction add (const store : storage; const delta : int) : storage is \n store + delta\n\nfunction sub (const store : storage; const delta : int) : storage is \n store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nfunction main (const action : parameter; const store : storage) : return is\n ((nil : list (operation)), // No operations\n case action of [\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0\n ])\n`;\n\nexport const religo_template = `\ntype storage = int;\n\ntype parameter =\n Increment (int)\n| Decrement (int)\n| Reset;\n\ntype return = (list (operation), storage);\n\n// Two entrypoints\n\nlet add = ((store, delta) : (storage, int)) : storage => store + delta;\nlet sub = ((store, delta) : (storage, int)) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n \nlet main = ((action, store) : (parameter, storage)) : return => {\n (([] : list (operation)), // No operations\n (switch (action) {\n | Increment (n) => add ((store, n))\n | Decrement (n) => sub ((store, n))\n | Reset => 0}))\n};\n`;\n\nexport const jsligo_template = `\ntype storage = int;\n\ntype parameter =\n [\"Increment\", int]\n| [\"Decrement\", int]\n| [\"Reset\"];\n\ntype ret = [list<operation>, storage];\n\n// Two entrypoints\n\nconst add = ([store, delta] : [storage, int]) : storage => store + delta;\nconst sub = ([store, delta] : [storage, int]) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n\nconst main = ([action, store] : [parameter, storage]) : ret => {\n return [list([]) as list<operation>, // No operations\n match (action, {\n Increment:(n: int) => add ([store, n]),\n Decrement:(n: int) => sub ([store, n]),\n Reset :() => 0})]\n};\n`;\n","import { sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: Opts): Promise<void> => {\n\tswitch (parsedArgs.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(parsedArgs);\n\t\tcase 'compile':\n\t\t\treturn compile(parsedArgs);\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(`${parsedArgs.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 { RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends RequestArgs.ProxyRequestArgs {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport interface TestOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & TestOpts;\n\ntype UnionOpts = LigoOpts | CompileOpts | 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.54.1';\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 getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir, sourceFile);\n\nexport const emitExternalError = (err: unknown, sourceFile: string): void => {\n\tsendErr(`\\n=== Error messages for ${sourceFile} ===`);\n\terr instanceof Error ? sendErr(err.message.replace(/Command failed.+?\\n/, '')) : sendErr(err as any);\n\tsendErr(`\\n===`);\n};\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport { CompileOpts as Opts, emitExternalError, getInputFilename, getLigoDockerImage } from './common';\n\ntype TableRow = { contract: string; artifact: string };\n\ntype ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nconst isLIGOFile = (sourceFile: string): boolean => /.+\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isStorageListFile = (sourceFile: string): boolean =>\n\t/.+\\.(storageList|storages)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isParameterListFile = (sourceFile: string): boolean =>\n\t/.+\\.(parameterList|parameters)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isContractFile = (sourceFile: string): boolean =>\n\tisLIGOFile(sourceFile) && !isStorageListFile(sourceFile) && !isParameterListFile(sourceFile);\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 getOutputContractFilename = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst outputFile = basename(sourceFile, extname(sourceFile));\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);\n};\n\n// Get the contract name that the storage/parameter file is associated with\n// e.g. If sourceFile is token.storageList.mligo, then it'll return token.mligo\nconst getContractNameForExpr = (sourceFile: string, exprKind: ExprKind): string => {\n\ttry {\n\t\treturn isStorageKind(exprKind)\n\t\t\t? sourceFile.match(/.+(?=\\.(?:storageList|storages)\\.(ligo|religo|mligo|jsligo))/)!.join('.')\n\t\t\t: sourceFile.match(/.+(?=\\.(?:parameterList|parameters)\\.(ligo|religo|mligo|jsligo))/)!.join('.');\n\t} catch (err) {\n\t\tthrow new Error(`Something went wrong internally when dealing with filename format: ${err}`);\n\t}\n};\n\n// If sourceFile is token.storageList.mligo, then it'll return token.storage.{storageName}.tz\nconst getOutputExprFilename = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = basename(getContractNameForExpr(sourceFile, exprKind), extname(sourceFile));\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage.tz`\n\t\t: `${contractName}.${exprKind}.${exprName}.tz`;\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}`);\n};\n\nconst getCompileContractCmd = (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()} compile contract`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputContractFilename(parsedArgs, sourceFile)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `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 = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;\n\treturn cmd;\n};\n\nconst compileContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getCompileContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: getOutputContractFilename(parsedArgs, sourceFile),\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\tartifact: COMPILE_ERR_MSG,\n\t\t\t};\n\t\t});\n\nconst compileExpr = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind) =>\n\t(exprName: string): Promise<TableRow> =>\n\t\tgetArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, 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\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\temitExternalError(err, sourceFile);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t\t};\n\t\t\t});\n\nconst getExprNames = (parsedArgs: Opts, sourceFile: string): Promise<string[]> =>\n\treadFile(getInputFilename(parsedArgs, sourceFile), 'utf8')\n\t\t.then(data => data.match(/(?<=\\n\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g) ?? []);\n\nconst compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>\n\tgetExprNames(parsedArgs, sourceFile)\n\t\t.then(exprNames => {\n\t\t\tif (exprNames.length === 0) return [];\n\t\t\tconst firstExprName = exprNames.slice(0, 1)[0];\n\t\t\tconst restExprNames = exprNames.slice(1, exprNames.length);\n\t\t\tconst firstExprKind = isStorageKind(exprKind) ? 'default_storage' : 'parameter';\n\t\t\tconst restExprKind = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\t\t\tconst firstExprResult = compileExpr(parsedArgs, sourceFile, firstExprKind)(firstExprName);\n\t\t\tconst restExprResults = restExprNames.map(compileExpr(parsedArgs, sourceFile, restExprKind));\n\t\t\treturn Promise.all([firstExprResult].concat(restExprResults));\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\tartifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} values compiled`,\n\t\t\t}];\n\t\t})\n\t\t.then(mergeArtifactsOutput(sourceFile));\n\n// TODO: Just for backwards compatibility. Can be deleted in the future.\nconst tryLegacyStorageNamingConvention = (parsedArgs: Opts, sourceFile: string) => {\n\tconst storageListFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilename(parsedArgs, storageListFile);\n\treturn access(storageListFilename).then(() => {\n\t\tsendWarn(\n\t\t\t`Warning: The naming convention of \"<CONTRACT>.storages.<EXTENSION>\" is deprecated and renamed to \"<CONTRACT>.storageList.<EXTENSION>\". Please adjust your storage file names accordingly\\n`,\n\t\t);\n\t\treturn compileExprs(parsedArgs, storageListFile, 'storage');\n\t});\n};\n\n// TODO: Just for backwards compatibility. Can be deleted in the future.\nconst tryLegacyParameterNamingConvention = (parsedArgs: Opts, sourceFile: string) => {\n\tconst parameterListFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilename(parsedArgs, parameterListFile);\n\treturn access(parameterListFilename).then(() => {\n\t\tsendWarn(\n\t\t\t`Warning: The naming convention of \"<CONTRACT>.parameters.<EXTENSION>\" is deprecated and renamed to \"<CONTRACT>.parameterList.<EXTENSION>\". Please adjust your parameter file names accordingly\\n`,\n\t\t);\n\t\treturn compileExprs(parsedArgs, parameterListFile, 'parameter');\n\t});\n};\n\nconst initContentForStorage = (sourceFile: string): string => {\n\tconst linkToContract = `#include \"${sourceFile}\"\\n\\n`;\n\n\tconst instruction =\n\t\t'// Define your initial storage values as a list of LIGO variable definitions,\\n// the first of which will be considered the default value to be used for origination later on\\n';\n\n\tconst ext = extractExt(sourceFile);\n\tlet syntax = '';\n\tif (ext === '.ligo') syntax = '// E.g. const aStorageValue : aStorageType = 10;\\n\\n';\n\telse if (ext === '.religo') syntax = '// E.g. let aStorageValue : aStorageType = 10;\\n\\n';\n\telse if (ext === '.mligo') syntax = '// E.g. let aStorageValue : aStorageType = 10\\n\\n';\n\telse if (ext === '.jsligo') syntax = '// E.g. const aStorageValue : aStorageType = 10;\\n\\n';\n\n\treturn linkToContract + instruction + syntax;\n};\n\nconst initContentForParameter = (sourceFile: string): string => {\n\tconst linkToContract = `#include \"${sourceFile}\"\\n\\n`;\n\n\tconst instruction = '// Define your parameter values as a list of LIGO variable definitions\\n';\n\n\tconst ext = extractExt(sourceFile);\n\tlet syntax = '';\n\tif (ext === '.ligo') syntax = '// E.g. const aParameterValue : aParameterType = Increment(1);\\n\\n';\n\telse if (ext === '.religo') syntax = '// E.g. let aParameterValue : aParameterType = (Increment (1));\\n\\n';\n\telse if (ext === '.mligo') syntax = '// E.g. let aParameterValue : aParameterType = Increment 1\\n\\n';\n\telse if (ext === '.jsligo') syntax = '// E.g. const aParameterValue : aParameterType = (Increment (1));\\n\\n';\n\n\treturn linkToContract + instruction + syntax;\n};\n\nconst compileContractWithStorageAndParameter = async (parsedArgs: Opts, sourceFile: string): Promise<TableRow[]> => {\n\tconst contractCompileResult = await compileContract(parsedArgs, sourceFile);\n\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\n\tconst storageListFile = `${removeExt(sourceFile)}.storageList${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilename(parsedArgs, storageListFile);\n\tconst storageCompileResult = await access(storageListFilename)\n\t\t.then(() => compileExprs(parsedArgs, storageListFile, 'storage'))\n\t\t.catch(() => tryLegacyStorageNamingConvention(parsedArgs, sourceFile))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: storage file associated with \"${sourceFile}\" 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\twriteFile(storageListFilename, initContentForStorage(sourceFile), 'utf8');\n\t\t});\n\n\tconst parameterListFile = `${removeExt(sourceFile)}.parameterList${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilename(parsedArgs, parameterListFile);\n\tconst parameterCompileResult = await access(parameterListFilename)\n\t\t.then(() => compileExprs(parsedArgs, parameterListFile, 'parameter'))\n\t\t.catch(() => tryLegacyParameterNamingConvention(parsedArgs, sourceFile))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: parameter file associated with \"${sourceFile}\" 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\twriteFile(parameterListFilename, initContentForParameter(sourceFile), 'utf8');\n\t\t});\n\n\tlet compileResults: TableRow[] = [contractCompileResult];\n\tif (storageCompileResult) compileResults = compileResults.concat(storageCompileResult);\n\tif (parameterCompileResult) compileResults = compileResults.concat(parameterCompileResult);\n\treturn compileResults;\n};\n\n/*\nCompiling storage/parameter file amounts to compiling multiple expressions in that file,\nresulting in multiple rows with the same file name but different artifact names.\nThis will merge these rows into one row with just one mention of the file name.\ne.g.\n┌─────────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├─────────────────────────┼─────────────────────────────────────────────┤\n│ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │\n├─────────────────────────┼─────────────────────────────────────────────┤\n│ hello.storageList.mligo │ artifacts/hello.storage.storage2.tz │\n└─────────────────────────┴─────────────────────────────────────────────┘\n\t\t\t\t\t\t\t\tversus\n┌─────────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├─────────────────────────┼─────────────────────────────────────────────┤\n│ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │\n│ │ artifacts/hello.storage.storage2.tz │\n└─────────────────────────┴─────────────────────────────────────────────┘\n*/\nconst mergeArtifactsOutput = (sourceFile: string) =>\n\t(tableRows: TableRow[]): TableRow[] => {\n\t\tconst artifactsOutput = tableRows.reduce(\n\t\t\t(acc: string, row: TableRow) => row.artifact === COMPILE_ERR_MSG ? acc : `${acc}${row.artifact}\\n`,\n\t\t\t'',\n\t\t);\n\t\treturn [{\n\t\t\tcontract: sourceFile,\n\t\t\tartifact: artifactsOutput,\n\t\t}];\n\t};\n\nconst compile = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tlet p: Promise<TableRow[]>;\n\tif (isStorageListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');\n\telse if (isParameterListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'parameter');\n\telse if (isContractFile(sourceFile)) p = compileContractWithStorageAndParameter(parsedArgs, sourceFile);\n\telse {\n\t\treturn sendAsyncErr(\n\t\t\t`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`,\n\t\t);\n\t}\n\treturn p.then(sendJsonRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n","import { CmdArgEnv, getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (parsedArgs: Opts, userArgs: string): CmdArgEnv => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst binary = 'docker';\n\tconst baseArgs = ['run', '--rm', '-v', `${projectDir}:/project`, '-w', '/project', getLigoDockerImage()];\n\tconst processedUserArgs = userArgs.split(' ').map(arg => arg.startsWith('\\\\-') ? arg.substring(1) : arg).filter(arg =>\n\t\targ\n\t);\n\tconst args = baseArgs.concat(processedUserArgs);\n\tconst envVars = { 'DOCKER_DEFAULT_PLATFORM': 'linux/amd64' };\n\treturn [binary, args, envVars];\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tgetArch()\n\t\t.then(() => getArbitraryLigoCmd(parsedArgs, cmd))\n\t\t.then(spawnCmd)\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, getInputFilename, 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 = getInputFilename(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\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-ligo",
3
- "version": "0.24.2",
3
+ "version": "0.25.0-alpha",
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/ecadlabs/taqueria#readme",
43
43
  "dependencies": {
44
- "@taqueria/node-sdk": "^0.24.2",
44
+ "@taqueria/node-sdk": "^0.25.0-alpha",
45
45
  "fast-glob": "^3.2.11"
46
46
  },
47
47
  "devDependencies": {