@taqueria/plugin-ligo 0.25.0-alpha → 0.25.4-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
@@ -53,7 +53,7 @@ Lastly, `taq compile hello.mligo` will compile `hello.mligo` and emit `hello.tz`
53
53
 
54
54
  ### Options
55
55
 
56
- None for now
56
+ The `--json` flag will make the task emit JSON-encoded Michelson instead of pure Michelson `.tz`
57
57
 
58
58
  ## The `taq test` Task
59
59
 
package/_readme.eta CHANGED
@@ -58,7 +58,7 @@ Lastly, `taq compile hello.mligo` will compile `hello.mligo` and emit `hello.tz`
58
58
 
59
59
  ### Options
60
60
 
61
- None for now
61
+ The `--json` flag will make the task emit JSON-encoded Michelson instead of pure Michelson `.tz`
62
62
 
63
63
  ## The `taq test` Task
64
64
 
package/common.ts CHANGED
@@ -1,17 +1,19 @@
1
1
  import { getDockerImage, sendErr } from '@taqueria/node-sdk';
2
- import { RequestArgs } from '@taqueria/node-sdk/types';
2
+ import { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';
3
3
  import { join } from 'path';
4
4
 
5
- export interface LigoOpts extends RequestArgs.ProxyRequestArgs {
5
+ export interface LigoOpts extends ProxyTaskArgs.t {
6
6
  command: string;
7
7
  }
8
8
 
9
- export interface CompileOpts extends RequestArgs.ProxyRequestArgs {
9
+ export interface CompileOpts extends ProxyTaskArgs.t {
10
10
  sourceFile: string;
11
+ json: boolean;
11
12
  }
12
13
 
13
- export interface TestOpts extends RequestArgs.ProxyRequestArgs {
14
- sourceFile: string;
14
+ export interface TestOpts extends RequestArgs.t {
15
+ task?: string;
16
+ sourceFile?: string;
15
17
  }
16
18
 
17
19
  export type IntersectionOpts = LigoOpts & CompileOpts & TestOpts;
@@ -26,7 +28,7 @@ const LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';
26
28
  export const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);
27
29
 
28
30
  export const getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): string =>
29
- join(parsedArgs.config.contractsDir, sourceFile);
31
+ join(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);
30
32
 
31
33
  export const emitExternalError = (err: unknown, sourceFile: string): void => {
32
34
  sendErr(`\n=== Error messages for ${sourceFile} ===`);
package/compile.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
1
+ import { execCmd, getArch, getArtifactsDir, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
2
2
  import { access, readFile, writeFile } from 'fs/promises';
3
3
  import { basename, extname, join } from 'path';
4
4
  import { CompileOpts as Opts, emitExternalError, getInputFilename, getLigoDockerImage } from './common';
@@ -32,9 +32,12 @@ const removeExt = (path: string): string => {
32
32
  return path.replace(extRegex, '');
33
33
  };
34
34
 
35
+ const isOutputFormatJSON = (parsedArgs: Opts): boolean => parsedArgs.json;
36
+
35
37
  const getOutputContractFilename = (parsedArgs: Opts, sourceFile: string): string => {
36
38
  const outputFile = basename(sourceFile, extname(sourceFile));
37
- return join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);
39
+ const ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';
40
+ return join(getArtifactsDir(parsedArgs), `${outputFile}${ext}`);
38
41
  };
39
42
 
40
43
  // Get the contract name that the storage/parameter file is associated with
@@ -52,10 +55,11 @@ const getContractNameForExpr = (sourceFile: string, exprKind: ExprKind): string
52
55
  // If sourceFile is token.storageList.mligo, then it'll return token.storage.{storageName}.tz
53
56
  const getOutputExprFilename = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {
54
57
  const contractName = basename(getContractNameForExpr(sourceFile, exprKind), extname(sourceFile));
58
+ const ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';
55
59
  const outputFile = exprKind === 'default_storage'
56
- ? `${contractName}.default_storage.tz`
57
- : `${contractName}.${exprKind}.${exprName}.tz`;
58
- return join(parsedArgs.config.artifactsDir, `${outputFile}`);
60
+ ? `${contractName}.default_storage${ext}`
61
+ : `${contractName}.${exprKind}.${exprName}${ext}`;
62
+ return join(getArtifactsDir(parsedArgs), `${outputFile}`);
59
63
  };
60
64
 
61
65
  const getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string => {
@@ -65,7 +69,8 @@ const getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string =>
65
69
  `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;
66
70
  const inputFile = getInputFilename(parsedArgs, sourceFile);
67
71
  const outputFile = `-o ${getOutputContractFilename(parsedArgs, sourceFile)}`;
68
- const cmd = `${baseCmd} ${inputFile} ${outputFile}`;
72
+ const flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';
73
+ const cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}`;
69
74
  return cmd;
70
75
  };
71
76
 
@@ -77,7 +82,8 @@ const getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprK
77
82
  `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;
78
83
  const inputFile = getInputFilename(parsedArgs, sourceFile);
79
84
  const outputFile = `-o ${getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
80
- const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;
85
+ const flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';
86
+ const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags}`;
81
87
  return cmd;
82
88
  };
83
89
 
@@ -267,7 +273,7 @@ const mergeArtifactsOutput = (sourceFile: string) =>
267
273
  };
268
274
 
269
275
  const compile = (parsedArgs: Opts): Promise<void> => {
270
- const sourceFile = parsedArgs.sourceFile;
276
+ const sourceFile = parsedArgs.sourceFile!;
271
277
  let p: Promise<TableRow[]>;
272
278
  if (isStorageListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');
273
279
  else if (isParameterListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'parameter');
package/createContract.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { experimental, sendAsyncErr } from '@taqueria/node-sdk';
2
- import * as RequestArgs from '@taqueria/protocol/RequestArgs';
2
+ import { RequestArgs } from '@taqueria/node-sdk';
3
3
  import { writeFile } from 'fs/promises';
4
4
  import { jsligo_template, mligo_template, pascaligo_template, religo_template } from './ligo_templates';
5
5
 
@@ -34,13 +34,14 @@ const getLigoTemplate = async (contractName: string, syntax: string | undefined)
34
34
  }
35
35
  };
36
36
 
37
- const createContract = (arg: Opts) => {
38
- const contractName = arg.sourceFileName as string;
39
- const syntax = arg.syntax;
40
- const contractsDir = `${arg.config.projectDir}/${arg.config.contractsDir}`;
37
+ const createContract = (args: RequestArgs.t) => {
38
+ const unsafeOpts = args as unknown as Opts;
39
+ const contractName = unsafeOpts.sourceFileName as string;
40
+ const syntax = unsafeOpts.syntax;
41
+ const contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;
41
42
  return getLigoTemplate(contractName, syntax)
42
43
  .then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template))
43
- .then(_ => registerContract(arg, contractName));
44
+ .then(_ => registerContract(unsafeOpts, contractName));
44
45
  };
45
46
 
46
47
  export default createContract;
package/index.js CHANGED
@@ -131,11 +131,12 @@ const $40622e3a438d0515$var$getLigoTemplate = async (contractName, syntax)=>{
131
131
  return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`Unable to infer LIGO syntax from "${contractName}". Please specify a LIGO syntax via the --syntax option`);
132
132
  } else return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`"${syntax}" is not a valid syntax. Please specify a valid LIGO syntax`);
133
133
  };
134
- const $40622e3a438d0515$var$createContract = (arg)=>{
135
- const contractName = arg.sourceFileName;
136
- const syntax = arg.syntax;
137
- const contractsDir = `${arg.config.projectDir}/${arg.config.contractsDir}`;
138
- return $40622e3a438d0515$var$getLigoTemplate(contractName, syntax).then((ligo_template)=>(0, $kQNfl$fspromises.writeFile)(`${contractsDir}/${contractName}`, ligo_template)).then((_)=>$40622e3a438d0515$var$registerContract(arg, contractName));
134
+ const $40622e3a438d0515$var$createContract = (args)=>{
135
+ const unsafeOpts = args;
136
+ const contractName = unsafeOpts.sourceFileName;
137
+ const syntax = unsafeOpts.syntax;
138
+ const contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;
139
+ return $40622e3a438d0515$var$getLigoTemplate(contractName, syntax).then((ligo_template)=>(0, $kQNfl$fspromises.writeFile)(`${contractsDir}/${contractName}`, ligo_template)).then((_)=>$40622e3a438d0515$var$registerContract(unsafeOpts, contractName));
139
140
  };
140
141
  var $40622e3a438d0515$export$2e2bcd8739ae039 = $40622e3a438d0515$var$createContract;
141
142
 
@@ -147,7 +148,7 @@ var $40622e3a438d0515$export$2e2bcd8739ae039 = $40622e3a438d0515$var$createContr
147
148
  const $844cb58d66fbf6db$var$LIGO_DEFAULT_IMAGE = "ligolang/ligo:0.54.1";
148
149
  const $844cb58d66fbf6db$var$LIGO_IMAGE_ENV_VAR = "TAQ_LIGO_IMAGE";
149
150
  const $844cb58d66fbf6db$export$2b403d61ac8ea302 = ()=>(0, $kQNfl$taquerianodesdk.getDockerImage)($844cb58d66fbf6db$var$LIGO_DEFAULT_IMAGE, $844cb58d66fbf6db$var$LIGO_IMAGE_ENV_VAR);
150
- const $844cb58d66fbf6db$export$17f107107c3c82c6 = (parsedArgs, sourceFile)=>(0, $kQNfl$path.join)(parsedArgs.config.contractsDir, sourceFile);
151
+ const $844cb58d66fbf6db$export$17f107107c3c82c6 = (parsedArgs, sourceFile)=>(0, $kQNfl$path.join)(parsedArgs.config.contractsDir ?? "contracts", sourceFile);
151
152
  const $844cb58d66fbf6db$export$b59ff90dc389ce6d = (err, sourceFile)=>{
152
153
  (0, $kQNfl$taquerianodesdk.sendErr)(`\n=== Error messages for ${sourceFile} ===`);
153
154
  err instanceof Error ? (0, $kQNfl$taquerianodesdk.sendErr)(err.message.replace(/Command failed.+?\n/, "")) : (0, $kQNfl$taquerianodesdk.sendErr)(err);
@@ -173,9 +174,11 @@ const $24b2f47d8f306cb3$var$removeExt = (path)=>{
173
174
  const extRegex = new RegExp($24b2f47d8f306cb3$var$extractExt(path));
174
175
  return path.replace(extRegex, "");
175
176
  };
177
+ const $24b2f47d8f306cb3$var$isOutputFormatJSON = (parsedArgs)=>parsedArgs.json;
176
178
  const $24b2f47d8f306cb3$var$getOutputContractFilename = (parsedArgs, sourceFile)=>{
177
179
  const outputFile = (0, $kQNfl$path.basename)(sourceFile, (0, $kQNfl$path.extname)(sourceFile));
178
- return (0, $kQNfl$path.join)(parsedArgs.config.artifactsDir, `${outputFile}.tz`);
180
+ const ext = $24b2f47d8f306cb3$var$isOutputFormatJSON(parsedArgs) ? ".json" : ".tz";
181
+ return (0, $kQNfl$path.join)((0, $kQNfl$taquerianodesdk.getArtifactsDir)(parsedArgs), `${outputFile}${ext}`);
179
182
  };
180
183
  // Get the contract name that the storage/parameter file is associated with
181
184
  // e.g. If sourceFile is token.storageList.mligo, then it'll return token.mligo
@@ -189,8 +192,9 @@ const $24b2f47d8f306cb3$var$getContractNameForExpr = (sourceFile, exprKind)=>{
189
192
  // If sourceFile is token.storageList.mligo, then it'll return token.storage.{storageName}.tz
190
193
  const $24b2f47d8f306cb3$var$getOutputExprFilename = (parsedArgs, sourceFile, exprKind, exprName)=>{
191
194
  const contractName = (0, $kQNfl$path.basename)($24b2f47d8f306cb3$var$getContractNameForExpr(sourceFile, exprKind), (0, $kQNfl$path.extname)(sourceFile));
192
- const outputFile = exprKind === "default_storage" ? `${contractName}.default_storage.tz` : `${contractName}.${exprKind}.${exprName}.tz`;
193
- return (0, $kQNfl$path.join)(parsedArgs.config.artifactsDir, `${outputFile}`);
195
+ const ext = $24b2f47d8f306cb3$var$isOutputFormatJSON(parsedArgs) ? ".json" : ".tz";
196
+ const outputFile = exprKind === "default_storage" ? `${contractName}.default_storage${ext}` : `${contractName}.${exprKind}.${exprName}${ext}`;
197
+ return (0, $kQNfl$path.join)((0, $kQNfl$taquerianodesdk.getArtifactsDir)(parsedArgs), `${outputFile}`);
194
198
  };
195
199
  const $24b2f47d8f306cb3$var$getCompileContractCmd = (parsedArgs, sourceFile)=>{
196
200
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
@@ -198,7 +202,8 @@ const $24b2f47d8f306cb3$var$getCompileContractCmd = (parsedArgs, sourceFile)=>{
198
202
  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`;
199
203
  const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
200
204
  const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputContractFilename(parsedArgs, sourceFile)}`;
201
- const cmd = `${baseCmd} ${inputFile} ${outputFile}`;
205
+ const flags = $24b2f47d8f306cb3$var$isOutputFormatJSON(parsedArgs) ? " --michelson-format json " : "";
206
+ const cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}`;
202
207
  return cmd;
203
208
  };
204
209
  const $24b2f47d8f306cb3$var$getCompileExprCmd = (parsedArgs, sourceFile, exprKind, exprName)=>{
@@ -208,7 +213,8 @@ const $24b2f47d8f306cb3$var$getCompileExprCmd = (parsedArgs, sourceFile, exprKin
208
213
  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}`;
209
214
  const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
210
215
  const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
211
- const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;
216
+ const flags = $24b2f47d8f306cb3$var$isOutputFormatJSON(parsedArgs) ? " --michelson-format json " : "";
217
+ const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags}`;
212
218
  return cmd;
213
219
  };
214
220
  const $24b2f47d8f306cb3$var$compileContract = (parsedArgs, sourceFile)=>(0, $kQNfl$taquerianodesdk.getArch)().then(()=>$24b2f47d8f306cb3$var$getCompileContractCmd(parsedArgs, sourceFile)).then((0, $kQNfl$taquerianodesdk.execCmd)).then(({ stderr: stderr })=>{
@@ -422,6 +428,7 @@ const $8d09eb70c0505719$var$testContract = (parsedArgs, sourceFile)=>(0, $kQNfl$
422
428
  });
423
429
  const $8d09eb70c0505719$var$test = (parsedArgs)=>{
424
430
  const sourceFile = parsedArgs.sourceFile;
431
+ if (!sourceFile) return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`No source file provided`);
425
432
  return $8d09eb70c0505719$var$testContract(parsedArgs, sourceFile).then((result)=>[
426
433
  result
427
434
  ]).then((0, $kQNfl$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $kQNfl$taquerianodesdk.sendAsyncErr)(err, false));
@@ -430,17 +437,18 @@ var $8d09eb70c0505719$export$2e2bcd8739ae039 = $8d09eb70c0505719$var$test;
430
437
 
431
438
 
432
439
  const $9c25a106900e330c$var$main = (parsedArgs)=>{
433
- switch(parsedArgs.task){
440
+ const unsafeOpts = parsedArgs;
441
+ switch(unsafeOpts.task){
434
442
  case "ligo":
435
- return (0, $0be740342372c80a$export$2e2bcd8739ae039)(parsedArgs);
443
+ return (0, $0be740342372c80a$export$2e2bcd8739ae039)(unsafeOpts);
436
444
  case "compile":
437
- return (0, $24b2f47d8f306cb3$export$2e2bcd8739ae039)(parsedArgs);
445
+ return (0, $24b2f47d8f306cb3$export$2e2bcd8739ae039)(unsafeOpts);
438
446
  case "test":
439
447
  return (0, $8d09eb70c0505719$export$2e2bcd8739ae039)(parsedArgs);
440
448
  case "get-image":
441
449
  return (0, $kQNfl$taquerianodesdk.sendAsyncRes)((0, $844cb58d66fbf6db$export$2b403d61ac8ea302)());
442
450
  default:
443
- return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`${parsedArgs.task} is not an understood task by the LIGO plugin`);
451
+ return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);
444
452
  }
445
453
  };
446
454
  var $9c25a106900e330c$export$2e2bcd8739ae039 = $9c25a106900e330c$var$main;
@@ -462,7 +470,7 @@ var $9c25a106900e330c$export$2e2bcd8739ae039 = $9c25a106900e330c$var$main;
462
470
  type: "string",
463
471
  description: "The command to be passed to the underlying LIGO binary, wrapped in quotes",
464
472
  required: true
465
- }),
473
+ })
466
474
  ],
467
475
  handler: "proxy",
468
476
  encoding: "none"
@@ -475,6 +483,13 @@ var $9c25a106900e330c$export$2e2bcd8739ae039 = $9c25a106900e330c$var$main;
475
483
  "compile-ligo"
476
484
  ],
477
485
  description: "Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found",
486
+ options: [
487
+ (0, $kQNfl$taquerianodesdk.Option).create({
488
+ flag: "json",
489
+ boolean: true,
490
+ description: "Emit JSON-encoded Michelson"
491
+ })
492
+ ],
478
493
  handler: "proxy",
479
494
  encoding: "json"
480
495
  }),
@@ -491,7 +506,7 @@ var $9c25a106900e330c$export$2e2bcd8739ae039 = $9c25a106900e330c$var$main;
491
506
  description: "Gets the name of the image to be used",
492
507
  handler: "proxy",
493
508
  hidden: true
494
- }),
509
+ })
495
510
  ],
496
511
  templates: [
497
512
  (0, $kQNfl$taquerianodesdk.Template).create({
@@ -503,7 +518,7 @@ var $9c25a106900e330c$export$2e2bcd8739ae039 = $9c25a106900e330c$var$main;
503
518
  placeholder: "sourceFileName",
504
519
  type: "string",
505
520
  description: "The name of the LIGO contract to generate"
506
- }),
521
+ })
507
522
  ],
508
523
  options: [
509
524
  (0, $kQNfl$taquerianodesdk.Option).create({
@@ -511,10 +526,10 @@ var $9c25a106900e330c$export$2e2bcd8739ae039 = $9c25a106900e330c$var$main;
511
526
  flag: "syntax",
512
527
  type: "string",
513
528
  description: "The syntax used in the contract"
514
- }),
529
+ })
515
530
  ],
516
531
  handler: (0, $40622e3a438d0515$export$2e2bcd8739ae039)
517
- }),
532
+ })
518
533
  ],
519
534
  proxy: (0, $9c25a106900e330c$export$2e2bcd8739ae039)
520
535
  }), process.argv);
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;IACpG,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,YAAY,AAAC;IACnD,MAAM,GAAG,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,AAAC;IAE7D,IAAI,MAAM,KAAK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AM,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":"../"}
1
+ {"mappings":";;;;AAAA;ACAA;;ACAO,MAAM,4CAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAwB/B,CAAC;AAEM,MAAM,4CAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BnC,CAAC;AAEM,MAAM,4CAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBhC,CAAC;AAEM,MAAM,4CAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBhC,CAAC;;;ADlGD,MAAM,yCAAmB,CAAC,KAAW,eAAyB;IAC7D,CAAA,GAAA,mCAAW,EAAE,gBAAgB,CAAC,KAAK;AACpC;AAEA,MAAM,wCAAkB,OAAO,cAAsB,SAAgD;IACpG,MAAM,cAAc,aAAa,KAAK,CAAC;IACvC,MAAM,MAAM,cAAc,WAAW,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,IAAI;IAE5D,IAAI,WAAW,SAAS,OAAO,GAAA,yCAAc;IAC7C,IAAI,WAAW,QAAQ,OAAO,GAAA,yCAAkB;IAChD,IAAI,WAAW,UAAU,OAAO,GAAA,yCAAe;IAC/C,IAAI,WAAW,UAAU,OAAO,GAAA,yCAAe;IAE/C,IAAI,WAAW,WAAW;QACzB,IAAI,QAAQ,SAAS,OAAO,GAAA,yCAAc;QAC1C,IAAI,QAAQ,QAAQ,OAAO,GAAA,yCAAkB;QAC7C,IAAI,QAAQ,UAAU,OAAO,GAAA,yCAAe;QAC5C,IAAI,QAAQ,UAAU,OAAO,GAAA,yCAAe;QAC5C,OAAO,CAAA,GAAA,mCAAW,EACjB,CAAC,kCAAkC,EAAE,aAAa,uDAAuD,CAAC;IAE5G,OACC,OAAO,CAAA,GAAA,mCAAY,AAAD,EAAE,CAAC,CAAC,EAAE,OAAO,2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b,aAAa;oBACd;iBACA;gBACD,SAAS;gBACT,UAAU;YACX;YACA,CAAA,GAAA,2BAAG,EAAE,MAAM,CAAC;gBACX,MAAM;gBACN,SAAS;gBACT,aAAa;gBACb,SAAS;gBACT,UAAU;YACX;YACA,CAAA,GAAA,2BAAG,EAAE,MAAM,CAAC;gBACX,MAAM;gBACN,SAAS;gBACT,aAAa;gBACb,SAAS;gBACT,QAAQ,IAAI;YACb;SACA;QACD,WAAW;YACV,CAAA,GAAA,+BAAO,EAAE,MAAM,CAAC;gBACf,UAAU;gBACV,SAAS;gBACT,aAAa;gBACb,aAAa;oBACZ,CAAA,GAAA,oCAAY,EAAE,MAAM,CAAC;wBACpB,aAAa;wBACb,MAAM;wBACN,aAAa;oBACd;iBACA;gBACD,SAAS;oBACR,CAAA,GAAA,6BAAK,EAAE,MAAM,CAAC;wBACb,WAAW;wBACX,MAAM;wBACN,MAAM;wBACN,aAAa;oBACd;iBACA;gBACD,SAAS,CAAA,GAAA,wCAAa;YACvB;SACA;QACD,OAAO,CAAA,GAAA,wCAAG;IACX,CAAA,GAAI,QAAQ,IAAI","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\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}), process.argv);\n","import { experimental, sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk';\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 = (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\t\t.then(_ => registerContract(unsafeOpts, 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 { RequestArgs, 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: 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 '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}\n\nexport interface TestOpts extends RequestArgs.t {\n\ttask?: string;\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 ?? 'contracts', 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, getArtifactsDir, 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 isOutputFormatJSON = (parsedArgs: Opts): boolean => parsedArgs.json;\n\nconst getOutputContractFilename = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst outputFile = basename(sourceFile, extname(sourceFile));\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\treturn join(getArtifactsDir(parsedArgs), `${outputFile}${ext}`);\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 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 = (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 flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}`;\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 flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags}`;\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\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"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
package/index.ts CHANGED
@@ -30,6 +30,13 @@ Plugin.create(i18n => ({
30
30
  aliases: ['c', 'compile-ligo'],
31
31
  description:
32
32
  'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',
33
+ options: [
34
+ Option.create({
35
+ flag: 'json',
36
+ boolean: true,
37
+ description: 'Emit JSON-encoded Michelson',
38
+ }),
39
+ ],
33
40
  handler: 'proxy',
34
41
  encoding: 'json',
35
42
  }),
package/main.ts CHANGED
@@ -1,21 +1,22 @@
1
- import { sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';
1
+ import { RequestArgs, sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';
2
2
  import { getLigoDockerImage, IntersectionOpts as Opts } from './common';
3
3
  import compile from './compile';
4
4
  import ligo from './ligo';
5
5
  import test from './test';
6
6
 
7
- const main = (parsedArgs: Opts): Promise<void> => {
8
- switch (parsedArgs.task) {
7
+ const main = (parsedArgs: RequestArgs.t): Promise<void> => {
8
+ const unsafeOpts = parsedArgs as unknown as Opts;
9
+ switch (unsafeOpts.task) {
9
10
  case 'ligo':
10
- return ligo(parsedArgs);
11
+ return ligo(unsafeOpts);
11
12
  case 'compile':
12
- return compile(parsedArgs);
13
+ return compile(unsafeOpts);
13
14
  case 'test':
14
15
  return test(parsedArgs);
15
16
  case 'get-image':
16
17
  return sendAsyncRes(getLigoDockerImage());
17
18
  default:
18
- return sendAsyncErr(`${parsedArgs.task} is not an understood task by the LIGO plugin`);
19
+ return sendAsyncErr(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);
19
20
  }
20
21
  };
21
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-ligo",
3
- "version": "0.25.0-alpha",
3
+ "version": "0.25.4-alpha",
4
4
  "description": "A taqueria plugin for compiling LIGO smart contracts",
5
5
  "targets": {
6
6
  "default": {
@@ -41,11 +41,11 @@
41
41
  },
42
42
  "homepage": "https://github.com/ecadlabs/taqueria#readme",
43
43
  "dependencies": {
44
- "@taqueria/node-sdk": "^0.25.0-alpha",
44
+ "@taqueria/node-sdk": "^0.25.4-alpha",
45
45
  "fast-glob": "^3.2.11"
46
46
  },
47
47
  "devDependencies": {
48
- "parcel": "2.6.1",
48
+ "parcel": "^2.8.0",
49
49
  "typescript": "^4.7.2"
50
50
  }
51
51
  }
package/test.ts CHANGED
@@ -35,6 +35,7 @@ const testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =
35
35
 
36
36
  const test = (parsedArgs: Opts): Promise<void> => {
37
37
  const sourceFile = parsedArgs.sourceFile;
38
+ if (!sourceFile) return sendAsyncErr(`No source file provided`);
38
39
  return testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>
39
40
  sendAsyncErr(err, false)
40
41
  );
package/tsconfig.json CHANGED
@@ -12,7 +12,9 @@
12
12
 
13
13
  /* Language and Environment */
14
14
  "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
15
+ "lib": [
16
+ "ES2021.String"
17
+ ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
18
  // "jsx": "preserve", /* Specify what JSX code is generated. */
17
19
  // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
20
  // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */