@taqueria/plugin-ligo 0.26.28-rc → 0.27.0-rc

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
@@ -55,6 +55,16 @@ Lastly, `taq compile hello.mligo` will compile `hello.mligo` and emit `hello.tz`
55
55
 
56
56
  The `--json` flag will make the task emit JSON-encoded Michelson instead of pure Michelson `.tz`
57
57
 
58
+ ## The `taq compile-all` Task
59
+
60
+ Basic usage is:
61
+
62
+ ```shell
63
+ taq compile-all
64
+ ```
65
+
66
+ It works just like the `compile` task but it compiles all main contracts, a.k.a contracts with a `main` function.
67
+
58
68
  ## The `taq test` Task
59
69
 
60
70
  Basic usage is:
package/_readme.eta CHANGED
@@ -60,6 +60,16 @@ Lastly, `taq compile hello.mligo` will compile `hello.mligo` and emit `hello.tz`
60
60
 
61
61
  The `--json` flag will make the task emit JSON-encoded Michelson instead of pure Michelson `.tz`
62
62
 
63
+ ## The `taq compile-all` Task
64
+
65
+ Basic usage is:
66
+
67
+ ```shell
68
+ taq compile-all
69
+ ```
70
+
71
+ It works just like the `compile` task but it compiles all main contracts, a.k.a contracts with a `main` function.
72
+
63
73
  ## The `taq test` Task
64
74
 
65
75
  Basic usage is:
package/common.ts CHANGED
@@ -11,14 +11,18 @@ export interface CompileOpts extends ProxyTaskArgs.t {
11
11
  json: boolean;
12
12
  }
13
13
 
14
+ export interface CompileAllOpts extends ProxyTaskArgs.t {
15
+ json: boolean;
16
+ }
17
+
14
18
  export interface TestOpts extends RequestArgs.t {
15
19
  task?: string;
16
20
  sourceFile?: string;
17
21
  }
18
22
 
19
- export type IntersectionOpts = LigoOpts & CompileOpts & TestOpts;
23
+ export type IntersectionOpts = LigoOpts & CompileOpts & CompileAllOpts & TestOpts;
20
24
 
21
- type UnionOpts = LigoOpts | CompileOpts | TestOpts;
25
+ type UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;
22
26
 
23
27
  // Should point to the latest stable version, so it needs to be updated as part of our release process.
24
28
  const LIGO_DEFAULT_IMAGE = 'ligolang/ligo:0.57.0';
@@ -27,7 +31,10 @@ const LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';
27
31
 
28
32
  export const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);
29
33
 
30
- export const getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): string =>
34
+ export const getInputFilenameAbsPath = (parsedArgs: UnionOpts, sourceFile: string): string =>
35
+ join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts', sourceFile);
36
+
37
+ export const getInputFilenameRelPath = (parsedArgs: UnionOpts, sourceFile: string): string =>
31
38
  join(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);
32
39
 
33
40
  export const emitExternalError = (err: unknown, sourceFile: string): void => {
package/compile-all.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { sendErr, sendJsonRes } from '@taqueria/node-sdk';
2
+ import glob from 'fast-glob';
3
+ import { readFile } from 'fs/promises';
4
+ import { join } from 'path';
5
+ import { CompileAllOpts as Opts, CompileOpts, getInputFilenameAbsPath } from './common';
6
+ import { compileContractWithStorageAndParameter, TableRow } from './compile';
7
+
8
+ const isMainContract = (parsedArgs: Opts, contactFilename: string): Promise<boolean> =>
9
+ readFile(getInputFilenameAbsPath(parsedArgs, contactFilename), 'utf8')
10
+ .then(data => /(const|let|function)\s+main/.test(data));
11
+
12
+ const compileAll = async (parsedArgs: Opts): Promise<void> => {
13
+ let p: Promise<TableRow[]>[] = [];
14
+
15
+ const contractFilenames = await glob(
16
+ ['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],
17
+ { cwd: join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts'), absolute: false },
18
+ );
19
+
20
+ for (const filename of contractFilenames) {
21
+ if (await isMainContract(parsedArgs, filename)) {
22
+ p.push(compileContractWithStorageAndParameter(parsedArgs as CompileOpts, filename));
23
+ }
24
+ }
25
+
26
+ return Promise.all(p).then(tables => tables.flat()).then(sendJsonRes).catch(err => sendErr(err, false));
27
+ };
28
+
29
+ export default compileAll;
package/compile.ts CHANGED
@@ -1,9 +1,15 @@
1
1
  import { execCmd, getArch, getArtifactsDir, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
2
2
  import { access, readFile, writeFile } from 'fs/promises';
3
3
  import { basename, extname, join } from 'path';
4
- import { CompileOpts as Opts, emitExternalError, getInputFilename, getLigoDockerImage } from './common';
4
+ import {
5
+ CompileOpts as Opts,
6
+ emitExternalError,
7
+ getInputFilenameAbsPath,
8
+ getInputFilenameRelPath,
9
+ getLigoDockerImage,
10
+ } from './common';
5
11
 
6
- type TableRow = { contract: string; artifact: string };
12
+ export type TableRow = { contract: string; artifact: string };
7
13
 
8
14
  export type ExprKind = 'storage' | 'default_storage' | 'parameter';
9
15
 
@@ -67,7 +73,7 @@ const getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string =>
67
73
  if (!projectDir) throw `No project directory provided`;
68
74
  const baseCmd =
69
75
  `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;
70
- const inputFile = getInputFilename(parsedArgs, sourceFile);
76
+ const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
71
77
  const outputFile = `-o ${getOutputContractFilename(parsedArgs, sourceFile)}`;
72
78
  const flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';
73
79
  const cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}`;
@@ -80,7 +86,7 @@ const getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprK
80
86
  const compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';
81
87
  const baseCmd =
82
88
  `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;
83
- const inputFile = getInputFilename(parsedArgs, sourceFile);
89
+ const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
84
90
  const outputFile = `-o ${getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
85
91
  const flags = isOutputFormatJSON(parsedArgs) ? ' --michelson-format json ' : '';
86
92
  const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags}`;
@@ -127,7 +133,7 @@ const compileExpr = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind) =
127
133
  });
128
134
 
129
135
  const getExprNames = (parsedArgs: Opts, sourceFile: string): Promise<string[]> =>
130
- readFile(getInputFilename(parsedArgs, sourceFile), 'utf8')
136
+ readFile(getInputFilenameAbsPath(parsedArgs, sourceFile), 'utf8')
131
137
  .then(data => data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
132
138
 
133
139
  const compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>
@@ -154,7 +160,7 @@ const compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind):
154
160
  // TODO: Just for backwards compatibility. Can be deleted in the future.
155
161
  const tryLegacyStorageNamingConvention = (parsedArgs: Opts, sourceFile: string) => {
156
162
  const storageListFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;
157
- const storageListFilename = getInputFilename(parsedArgs, storageListFile);
163
+ const storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);
158
164
  return access(storageListFilename).then(() => {
159
165
  sendWarn(
160
166
  `Warning: The naming convention of "<CONTRACT>.storages.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.storageList.<EXTENSION>". Please adjust your storage file names accordingly\n`,
@@ -166,7 +172,7 @@ const tryLegacyStorageNamingConvention = (parsedArgs: Opts, sourceFile: string)
166
172
  // TODO: Just for backwards compatibility. Can be deleted in the future.
167
173
  const tryLegacyParameterNamingConvention = (parsedArgs: Opts, sourceFile: string) => {
168
174
  const parameterListFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;
169
- const parameterListFilename = getInputFilename(parsedArgs, parameterListFile);
175
+ const parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);
170
176
  return access(parameterListFilename).then(() => {
171
177
  sendWarn(
172
178
  `Warning: The naming convention of "<CONTRACT>.parameters.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.parameterList.<EXTENSION>". Please adjust your parameter file names accordingly\n`,
@@ -206,12 +212,15 @@ const initContentForParameter = (sourceFile: string): string => {
206
212
  return linkToContract + instruction + syntax;
207
213
  };
208
214
 
209
- const compileContractWithStorageAndParameter = async (parsedArgs: Opts, sourceFile: string): Promise<TableRow[]> => {
215
+ export const compileContractWithStorageAndParameter = async (
216
+ parsedArgs: Opts,
217
+ sourceFile: string,
218
+ ): Promise<TableRow[]> => {
210
219
  const contractCompileResult = await compileContract(parsedArgs, sourceFile);
211
220
  if (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];
212
221
 
213
222
  const storageListFile = `${removeExt(sourceFile)}.storageList${extractExt(sourceFile)}`;
214
- const storageListFilename = getInputFilename(parsedArgs, storageListFile);
223
+ const storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);
215
224
  const storageCompileResult = await (access(storageListFilename)
216
225
  .then(() => compileExprs(parsedArgs, storageListFile, 'storage'))
217
226
  .catch(() => tryLegacyStorageNamingConvention(parsedArgs, sourceFile))
@@ -219,11 +228,11 @@ const compileContractWithStorageAndParameter = async (parsedArgs: Opts, sourceFi
219
228
  sendWarn(
220
229
  `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`,
221
230
  );
222
- writeFile(join(parsedArgs.config.projectDir, storageListFilename), initContentForStorage(sourceFile), 'utf8');
231
+ writeFile(storageListFilename, initContentForStorage(sourceFile), 'utf8');
223
232
  }));
224
233
 
225
234
  const parameterListFile = `${removeExt(sourceFile)}.parameterList${extractExt(sourceFile)}`;
226
- const parameterListFilename = getInputFilename(parsedArgs, parameterListFile);
235
+ const parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);
227
236
  const parameterCompileResult = await (access(parameterListFilename)
228
237
  .then(() => compileExprs(parsedArgs, parameterListFile, 'parameter'))
229
238
  .catch(() => tryLegacyParameterNamingConvention(parsedArgs, sourceFile))
@@ -231,7 +240,7 @@ const compileContractWithStorageAndParameter = async (parsedArgs: Opts, sourceFi
231
240
  sendWarn(
232
241
  `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`,
233
242
  );
234
- writeFile(join(parsedArgs.config.projectDir, parameterListFilename), initContentForParameter(sourceFile), 'utf8');
243
+ writeFile(parameterListFilename, initContentForParameter(sourceFile), 'utf8');
235
244
  }));
236
245
 
237
246
  let compileResults: TableRow[] = [contractCompileResult];
package/createContract.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { experimental, sendAsyncErr } from '@taqueria/node-sdk';
1
+ import { sendAsyncErr } from '@taqueria/node-sdk';
2
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';
@@ -8,10 +8,6 @@ interface Opts extends RequestArgs.t {
8
8
  syntax?: string;
9
9
  }
10
10
 
11
- const registerContract = (arg: Opts, contractName: string) => {
12
- experimental.registerContract(arg, contractName);
13
- };
14
-
15
11
  const getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {
16
12
  const matchResult = contractName.match(/\.[^.]+$/);
17
13
  const ext = matchResult ? matchResult[0].substring(1) : null;
@@ -40,8 +36,7 @@ const createContract = (args: RequestArgs.t) => {
40
36
  const syntax = unsafeOpts.syntax;
41
37
  const contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;
42
38
  return getLigoTemplate(contractName, syntax)
43
- .then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template))
44
- .then(_ => registerContract(unsafeOpts, contractName));
39
+ .then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template));
45
40
  };
46
41
 
47
42
  export default createContract;
package/index.js CHANGED
@@ -1,7 +1,25 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
 
3
21
  // index.ts
4
- var import_node_sdk7 = require("@taqueria/node-sdk");
22
+ var import_node_sdk8 = require("@taqueria/node-sdk");
5
23
 
6
24
  // createContract.ts
7
25
  var import_node_sdk = require("@taqueria/node-sdk");
@@ -116,9 +134,6 @@ const main = ([action, store] : [parameter, storage]) : ret => {
116
134
  `;
117
135
 
118
136
  // createContract.ts
119
- var registerContract = (arg, contractName) => {
120
- import_node_sdk.experimental.registerContract(arg, contractName);
121
- };
122
137
  var getLigoTemplate = async (contractName, syntax) => {
123
138
  const matchResult = contractName.match(/\.[^.]+$/);
124
139
  const ext = matchResult ? matchResult[0].substring(1) : null;
@@ -151,12 +166,12 @@ var createContract = (args) => {
151
166
  const contractName = unsafeOpts.sourceFileName;
152
167
  const syntax = unsafeOpts.syntax;
153
168
  const contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;
154
- return getLigoTemplate(contractName, syntax).then((ligo_template) => (0, import_promises.writeFile)(`${contractsDir}/${contractName}`, ligo_template)).then((_) => registerContract(unsafeOpts, contractName));
169
+ return getLigoTemplate(contractName, syntax).then((ligo_template) => (0, import_promises.writeFile)(`${contractsDir}/${contractName}`, ligo_template));
155
170
  };
156
171
  var createContract_default = createContract;
157
172
 
158
173
  // main.ts
159
- var import_node_sdk6 = require("@taqueria/node-sdk");
174
+ var import_node_sdk7 = require("@taqueria/node-sdk");
160
175
 
161
176
  // common.ts
162
177
  var import_node_sdk2 = require("@taqueria/node-sdk");
@@ -164,7 +179,8 @@ var import_path = require("path");
164
179
  var LIGO_DEFAULT_IMAGE = "ligolang/ligo:0.57.0";
165
180
  var LIGO_IMAGE_ENV_VAR = "TAQ_LIGO_IMAGE";
166
181
  var getLigoDockerImage = () => (0, import_node_sdk2.getDockerImage)(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);
167
- var getInputFilename = (parsedArgs, sourceFile) => (0, import_path.join)(parsedArgs.config.contractsDir ?? "contracts", sourceFile);
182
+ var getInputFilenameAbsPath = (parsedArgs, sourceFile) => (0, import_path.join)(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? "contracts", sourceFile);
183
+ var getInputFilenameRelPath = (parsedArgs, sourceFile) => (0, import_path.join)(parsedArgs.config.contractsDir ?? "contracts", sourceFile);
168
184
  var emitExternalError = (err, sourceFile) => {
169
185
  (0, import_node_sdk2.sendErr)(`
170
186
  === Error messages for ${sourceFile} ===`);
@@ -215,7 +231,7 @@ var getCompileContractCmd = (parsedArgs, sourceFile) => {
215
231
  if (!projectDir)
216
232
  throw `No project directory provided`;
217
233
  const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;
218
- const inputFile = getInputFilename(parsedArgs, sourceFile);
234
+ const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
219
235
  const outputFile = `-o ${getOutputContractFilename(parsedArgs, sourceFile)}`;
220
236
  const flags = isOutputFormatJSON(parsedArgs) ? " --michelson-format json " : "";
221
237
  const cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}`;
@@ -227,7 +243,7 @@ var getCompileExprCmd = (parsedArgs, sourceFile, exprKind, exprName) => {
227
243
  throw `No project directory provided`;
228
244
  const compilerType = isStorageKind(exprKind) ? "storage" : "parameter";
229
245
  const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;
230
- const inputFile = getInputFilename(parsedArgs, sourceFile);
246
+ const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
231
247
  const outputFile = `-o ${getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
232
248
  const flags = isOutputFormatJSON(parsedArgs) ? " --michelson-format json " : "";
233
249
  const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags}`;
@@ -261,7 +277,7 @@ var compileExpr = (parsedArgs, sourceFile, exprKind) => (exprName) => (0, import
261
277
  artifact: COMPILE_ERR_MSG
262
278
  };
263
279
  });
264
- var getExprNames = (parsedArgs, sourceFile) => (0, import_promises2.readFile)(getInputFilename(parsedArgs, sourceFile), "utf8").then((data) => data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
280
+ var getExprNames = (parsedArgs, sourceFile) => (0, import_promises2.readFile)(getInputFilenameAbsPath(parsedArgs, sourceFile), "utf8").then((data) => data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
265
281
  var compileExprs = (parsedArgs, sourceFile, exprKind) => getExprNames(parsedArgs, sourceFile).then((exprNames) => {
266
282
  if (exprNames.length === 0)
267
283
  return [];
@@ -281,7 +297,7 @@ var compileExprs = (parsedArgs, sourceFile, exprKind) => getExprNames(parsedArgs
281
297
  }).then(mergeArtifactsOutput(sourceFile));
282
298
  var tryLegacyStorageNamingConvention = (parsedArgs, sourceFile) => {
283
299
  const storageListFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;
284
- const storageListFilename = getInputFilename(parsedArgs, storageListFile);
300
+ const storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);
285
301
  return (0, import_promises2.access)(storageListFilename).then(() => {
286
302
  (0, import_node_sdk3.sendWarn)(
287
303
  `Warning: The naming convention of "<CONTRACT>.storages.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.storageList.<EXTENSION>". Please adjust your storage file names accordingly
@@ -292,7 +308,7 @@ var tryLegacyStorageNamingConvention = (parsedArgs, sourceFile) => {
292
308
  };
293
309
  var tryLegacyParameterNamingConvention = (parsedArgs, sourceFile) => {
294
310
  const parameterListFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;
295
- const parameterListFilename = getInputFilename(parsedArgs, parameterListFile);
311
+ const parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);
296
312
  return (0, import_promises2.access)(parameterListFilename).then(() => {
297
313
  (0, import_node_sdk3.sendWarn)(
298
314
  `Warning: The naming convention of "<CONTRACT>.parameters.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.parameterList.<EXTENSION>". Please adjust your parameter file names accordingly
@@ -340,22 +356,22 @@ var compileContractWithStorageAndParameter = async (parsedArgs, sourceFile) => {
340
356
  if (contractCompileResult.artifact === COMPILE_ERR_MSG)
341
357
  return [contractCompileResult];
342
358
  const storageListFile = `${removeExt(sourceFile)}.storageList${extractExt(sourceFile)}`;
343
- const storageListFilename = getInputFilename(parsedArgs, storageListFile);
359
+ const storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);
344
360
  const storageCompileResult = await (0, import_promises2.access)(storageListFilename).then(() => compileExprs(parsedArgs, storageListFile, "storage")).catch(() => tryLegacyStorageNamingConvention(parsedArgs, sourceFile)).catch(() => {
345
361
  (0, import_node_sdk3.sendWarn)(
346
362
  `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
347
363
  `
348
364
  );
349
- (0, import_promises2.writeFile)((0, import_path2.join)(parsedArgs.config.projectDir, storageListFilename), initContentForStorage(sourceFile), "utf8");
365
+ (0, import_promises2.writeFile)(storageListFilename, initContentForStorage(sourceFile), "utf8");
350
366
  });
351
367
  const parameterListFile = `${removeExt(sourceFile)}.parameterList${extractExt(sourceFile)}`;
352
- const parameterListFilename = getInputFilename(parsedArgs, parameterListFile);
368
+ const parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);
353
369
  const parameterCompileResult = await (0, import_promises2.access)(parameterListFilename).then(() => compileExprs(parsedArgs, parameterListFile, "parameter")).catch(() => tryLegacyParameterNamingConvention(parsedArgs, sourceFile)).catch(() => {
354
370
  (0, import_node_sdk3.sendWarn)(
355
371
  `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
356
372
  `
357
373
  );
358
- (0, import_promises2.writeFile)((0, import_path2.join)(parsedArgs.config.projectDir, parameterListFilename), initContentForParameter(sourceFile), "utf8");
374
+ (0, import_promises2.writeFile)(parameterListFilename, initContentForParameter(sourceFile), "utf8");
359
375
  });
360
376
  let compileResults = [contractCompileResult];
361
377
  if (storageCompileResult)
@@ -393,8 +409,29 @@ var compile = (parsedArgs) => {
393
409
  };
394
410
  var compile_default = compile;
395
411
 
396
- // ligo.ts
412
+ // compile-all.ts
397
413
  var import_node_sdk4 = require("@taqueria/node-sdk");
414
+ var import_fast_glob = __toESM(require("fast-glob"));
415
+ var import_promises3 = require("fs/promises");
416
+ var import_path3 = require("path");
417
+ var isMainContract = (parsedArgs, contactFilename) => (0, import_promises3.readFile)(getInputFilenameAbsPath(parsedArgs, contactFilename), "utf8").then((data) => /(const|let|function)\s+main/.test(data));
418
+ var compileAll = async (parsedArgs) => {
419
+ let p = [];
420
+ const contractFilenames = await (0, import_fast_glob.default)(
421
+ ["**/*.ligo", "**/*.religo", "**/*.mligo", "**/*.jsligo"],
422
+ { cwd: (0, import_path3.join)(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? "contracts"), absolute: false }
423
+ );
424
+ for (const filename of contractFilenames) {
425
+ if (await isMainContract(parsedArgs, filename)) {
426
+ p.push(compileContractWithStorageAndParameter(parsedArgs, filename));
427
+ }
428
+ }
429
+ return Promise.all(p).then((tables) => tables.flat()).then(import_node_sdk4.sendJsonRes).catch((err) => (0, import_node_sdk4.sendErr)(err, false));
430
+ };
431
+ var compile_all_default = compileAll;
432
+
433
+ // ligo.ts
434
+ var import_node_sdk5 = require("@taqueria/node-sdk");
398
435
  var getArbitraryLigoCmd = (parsedArgs, userArgs) => {
399
436
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
400
437
  if (!projectDir)
@@ -411,29 +448,29 @@ var getArbitraryLigoCmd = (parsedArgs, userArgs) => {
411
448
  envVars
412
449
  ];
413
450
  };
414
- var runArbitraryLigoCmd = (parsedArgs, cmd) => (0, import_node_sdk4.getArch)().then(() => getArbitraryLigoCmd(parsedArgs, cmd)).then(([cmd2, envVars]) => (0, import_node_sdk4.spawnCmd)(cmd2, envVars)).then(
451
+ var runArbitraryLigoCmd = (parsedArgs, cmd) => (0, import_node_sdk5.getArch)().then(() => getArbitraryLigoCmd(parsedArgs, cmd)).then(([cmd2, envVars]) => (0, import_node_sdk5.spawnCmd)(cmd2, envVars)).then(
415
452
  (code) => code !== null && code === 0 ? `Command "${cmd}" ran successfully by LIGO` : `Command "${cmd}" failed. Please check your command`
416
- ).catch((err) => (0, import_node_sdk4.sendAsyncErr)(`An internal error has occurred: ${err.message}`));
453
+ ).catch((err) => (0, import_node_sdk5.sendAsyncErr)(`An internal error has occurred: ${err.message}`));
417
454
  var ligo = (parsedArgs) => {
418
455
  const args = parsedArgs.command;
419
- return runArbitraryLigoCmd(parsedArgs, args).then(import_node_sdk4.sendRes).catch((err) => (0, import_node_sdk4.sendAsyncErr)(err, false));
456
+ return runArbitraryLigoCmd(parsedArgs, args).then(import_node_sdk5.sendRes).catch((err) => (0, import_node_sdk5.sendAsyncErr)(err, false));
420
457
  };
421
458
  var ligo_default = ligo;
422
459
 
423
460
  // test.ts
424
- var import_node_sdk5 = require("@taqueria/node-sdk");
461
+ var import_node_sdk6 = require("@taqueria/node-sdk");
425
462
  var getTestContractCmd = (parsedArgs, sourceFile) => {
426
463
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
427
464
  if (!projectDir)
428
465
  throw `No project directory provided`;
429
466
  const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;
430
- const inputFile = getInputFilename(parsedArgs, sourceFile);
467
+ const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
431
468
  const cmd = `${baseCmd} ${inputFile}`;
432
469
  return cmd;
433
470
  };
434
- var testContract = (parsedArgs, sourceFile) => (0, import_node_sdk5.getArch)().then(() => getTestContractCmd(parsedArgs, sourceFile)).then(import_node_sdk5.execCmd).then(({ stdout, stderr }) => {
471
+ var testContract = (parsedArgs, sourceFile) => (0, import_node_sdk6.getArch)().then(() => getTestContractCmd(parsedArgs, sourceFile)).then(import_node_sdk6.execCmd).then(({ stdout, stderr }) => {
435
472
  if (stderr.length > 0)
436
- (0, import_node_sdk5.sendWarn)(stderr);
473
+ (0, import_node_sdk6.sendWarn)(stderr);
437
474
  const result = "\u{1F389} All tests passed \u{1F389}";
438
475
  return {
439
476
  contract: sourceFile,
@@ -450,9 +487,9 @@ ${result}` : result
450
487
  var test = (parsedArgs) => {
451
488
  const sourceFile = parsedArgs.sourceFile;
452
489
  if (!sourceFile)
453
- return (0, import_node_sdk5.sendAsyncErr)(`No source file provided`);
454
- return testContract(parsedArgs, sourceFile).then((result) => [result]).then(import_node_sdk5.sendJsonRes).catch(
455
- (err) => (0, import_node_sdk5.sendAsyncErr)(err, false)
490
+ return (0, import_node_sdk6.sendAsyncErr)(`No source file provided`);
491
+ return testContract(parsedArgs, sourceFile).then((result) => [result]).then(import_node_sdk6.sendJsonRes).catch(
492
+ (err) => (0, import_node_sdk6.sendAsyncErr)(err, false)
456
493
  );
457
494
  };
458
495
  var test_default = test;
@@ -465,28 +502,30 @@ var main = (parsedArgs) => {
465
502
  return ligo_default(unsafeOpts);
466
503
  case "compile":
467
504
  return compile_default(unsafeOpts);
505
+ case "compile-all":
506
+ return compile_all_default(unsafeOpts);
468
507
  case "test":
469
508
  return test_default(parsedArgs);
470
509
  case "get-image":
471
- return (0, import_node_sdk6.sendAsyncRes)(getLigoDockerImage());
510
+ return (0, import_node_sdk7.sendAsyncRes)(getLigoDockerImage());
472
511
  default:
473
- return (0, import_node_sdk6.sendAsyncErr)(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);
512
+ return (0, import_node_sdk7.sendAsyncErr)(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);
474
513
  }
475
514
  };
476
515
  var main_default = main;
477
516
 
478
517
  // index.ts
479
- import_node_sdk7.Plugin.create((i18n) => ({
518
+ import_node_sdk8.Plugin.create((i18n) => ({
480
519
  schema: "1.0",
481
520
  version: "0.1",
482
521
  alias: "ligo",
483
522
  tasks: [
484
- import_node_sdk7.Task.create({
523
+ import_node_sdk8.Task.create({
485
524
  task: "ligo",
486
525
  command: "ligo",
487
526
  description: "This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria",
488
527
  options: [
489
- import_node_sdk7.Option.create({
528
+ import_node_sdk8.Option.create({
490
529
  shortFlag: "c",
491
530
  flag: "command",
492
531
  type: "string",
@@ -497,13 +536,27 @@ import_node_sdk7.Plugin.create((i18n) => ({
497
536
  handler: "proxy",
498
537
  encoding: "none"
499
538
  }),
500
- import_node_sdk7.Task.create({
539
+ import_node_sdk8.Task.create({
501
540
  task: "compile",
502
541
  command: "compile <sourceFile>",
503
542
  aliases: ["c", "compile-ligo"],
504
543
  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",
505
544
  options: [
506
- import_node_sdk7.Option.create({
545
+ import_node_sdk8.Option.create({
546
+ flag: "json",
547
+ boolean: true,
548
+ description: "Emit JSON-encoded Michelson"
549
+ })
550
+ ],
551
+ handler: "proxy",
552
+ encoding: "json"
553
+ }),
554
+ import_node_sdk8.Task.create({
555
+ task: "compile-all",
556
+ command: "compile-all",
557
+ description: "Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found",
558
+ options: [
559
+ import_node_sdk8.Option.create({
507
560
  flag: "json",
508
561
  boolean: true,
509
562
  description: "Emit JSON-encoded Michelson"
@@ -512,14 +565,14 @@ import_node_sdk7.Plugin.create((i18n) => ({
512
565
  handler: "proxy",
513
566
  encoding: "json"
514
567
  }),
515
- import_node_sdk7.Task.create({
568
+ import_node_sdk8.Task.create({
516
569
  task: "test",
517
570
  command: "test <sourceFile>",
518
571
  description: "Test a smart contract written in LIGO",
519
572
  handler: "proxy",
520
573
  encoding: "json"
521
574
  }),
522
- import_node_sdk7.Task.create({
575
+ import_node_sdk8.Task.create({
523
576
  task: "get-image",
524
577
  command: "get-image",
525
578
  description: "Gets the name of the image to be used",
@@ -528,19 +581,19 @@ import_node_sdk7.Plugin.create((i18n) => ({
528
581
  })
529
582
  ],
530
583
  templates: [
531
- import_node_sdk7.Template.create({
584
+ import_node_sdk8.Template.create({
532
585
  template: "contract",
533
586
  command: "contract <sourceFileName>",
534
587
  description: "Create a LIGO contract with boilerplate code",
535
588
  positionals: [
536
- import_node_sdk7.PositionalArg.create({
589
+ import_node_sdk8.PositionalArg.create({
537
590
  placeholder: "sourceFileName",
538
591
  type: "string",
539
592
  description: "The name of the LIGO contract to generate"
540
593
  })
541
594
  ],
542
595
  options: [
543
- import_node_sdk7.Option.create({
596
+ import_node_sdk8.Option.create({
544
597
  shortFlag: "s",
545
598
  flag: "syntax",
546
599
  type: "string",
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\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.57.0';\n\nconst LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';\n\nexport const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);\n\nexport const 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, sendErr, 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\nexport type 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(join(parsedArgs.config.projectDir, 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(join(parsedArgs.config.projectDir, 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 => sendErr(err, false));\n};\n\nexport default compile;\nexport const ___TEST___ = {\n\tgetContractNameForExpr,\n\tgetOutputExprFilename,\n};\n","import { getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (parsedArgs: Opts, userArgs: string): [string, Record<string, string>] => {\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 [\n\t\t[binary, ...args].join(' '),\n\t\tenvVars,\n\t];\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tgetArch()\n\t\t.then(() => getArbitraryLigoCmd(parsedArgs, cmd))\n\t\t.then(([cmd, envVars]) => spawnCmd(cmd, envVars))\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { emitExternalError, 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"],"mappings":";;;AAAA,IAAAA,mBAA8D;;;ACA9D,sBAA2C;AAE3C,sBAA0B;;;ACFnB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BvB,IAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8B3B,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BxB,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AAS;AAAA,QACR,wBAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,SAAS;AAAA,UACT,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,sBAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,QAAQ;AAAA,IACT,CAAC;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACV,0BAAS,OAAO;AAAA,MACf,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,QACZ,+BAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACR,wBAAO,OAAO;AAAA,UACb,WAAW;AAAA,UACX,MAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["import_node_sdk","import_node_sdk","import_node_sdk","import_node_sdk","import_promises","import_path","import_node_sdk","cmd","import_node_sdk"]}
1
+ {"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","compile-all.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile-all',\n\t\t\tcommand: 'compile-all',\n\t\t\tdescription:\n\t\t\t\t'Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'get-image',\n\t\t\tcommand: 'get-image',\n\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\thandler: 'proxy',\n\t\t\thidden: true,\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: main,\n}), process.argv);\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template, pascaligo_template, religo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === '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};\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 compileAll from './compile-all';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: RequestArgs.t): Promise<void> => {\n\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\tswitch (unsafeOpts.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(unsafeOpts);\n\t\tcase 'compile':\n\t\t\treturn compile(unsafeOpts);\n\t\tcase 'compile-all':\n\t\t\treturn compileAll(unsafeOpts);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tcase 'get-image':\n\t\t\treturn sendAsyncRes(getLigoDockerImage());\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default main;\n","import { getDockerImage, sendErr } from '@taqueria/node-sdk';\nimport { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends ProxyTaskArgs.t {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends ProxyTaskArgs.t {\n\tsourceFile: string;\n\tjson: boolean;\n}\n\nexport interface CompileAllOpts extends ProxyTaskArgs.t {\n\tjson: boolean;\n}\n\nexport interface TestOpts extends RequestArgs.t {\n\ttask?: string;\n\tsourceFile?: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & CompileAllOpts & TestOpts;\n\ntype UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;\n\n// Should point to the latest stable version, so it needs to be updated as part of our release process.\nconst LIGO_DEFAULT_IMAGE = 'ligolang/ligo:0.57.0';\n\nconst LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';\n\nexport const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);\n\nexport const getInputFilenameAbsPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const getInputFilenameRelPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const 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, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport {\n\tCompileOpts as Opts,\n\temitExternalError,\n\tgetInputFilenameAbsPath,\n\tgetInputFilenameRelPath,\n\tgetLigoDockerImage,\n} from './common';\n\nexport type TableRow = { contract: string; artifact: string };\n\nexport type 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 = getInputFilenameRelPath(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 = getInputFilenameRelPath(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(getInputFilenameAbsPath(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 = getInputFilenameAbsPath(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 = getInputFilenameAbsPath(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\nexport const compileContractWithStorageAndParameter = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n): 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 = getInputFilenameAbsPath(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 = getInputFilenameAbsPath(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 => sendErr(err, false));\n};\n\nexport default compile;\nexport const ___TEST___ = {\n\tgetContractNameForExpr,\n\tgetOutputExprFilename,\n};\n","import { sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport glob from 'fast-glob';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\nimport { CompileAllOpts as Opts, CompileOpts, getInputFilenameAbsPath } from './common';\nimport { compileContractWithStorageAndParameter, TableRow } from './compile';\n\nconst isMainContract = (parsedArgs: Opts, contactFilename: string): Promise<boolean> =>\n\treadFile(getInputFilenameAbsPath(parsedArgs, contactFilename), 'utf8')\n\t\t.then(data => /(const|let|function)\\s+main/.test(data));\n\nconst compileAll = async (parsedArgs: Opts): Promise<void> => {\n\tlet p: Promise<TableRow[]>[] = [];\n\n\tconst contractFilenames = await glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{ cwd: join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts'), absolute: false },\n\t);\n\n\tfor (const filename of contractFilenames) {\n\t\tif (await isMainContract(parsedArgs, filename)) {\n\t\t\tp.push(compileContractWithStorageAndParameter(parsedArgs as CompileOpts, filename));\n\t\t}\n\t}\n\n\treturn Promise.all(p).then(tables => tables.flat()).then(sendJsonRes).catch(err => sendErr(err, false));\n};\n\nexport default compileAll;\n","import { getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (parsedArgs: Opts, userArgs: string): [string, Record<string, string>] => {\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 [\n\t\t[binary, ...args].join(' '),\n\t\tenvVars,\n\t];\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tgetArch()\n\t\t.then(() => getArbitraryLigoCmd(parsedArgs, cmd))\n\t\t.then(([cmd, envVars]) => spawnCmd(cmd, envVars))\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { emitExternalError, getInputFilenameRelPath, getLigoDockerImage, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst cmd = `${baseCmd} ${inputFile}`;\n\treturn cmd;\n};\n\nconst testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stdout, stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nconst test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!sourceFile) return sendAsyncErr(`No source file provided`);\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAA8D;;;ACA9D,sBAA6B;AAE7B,sBAA0B;;;ACFnB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BvB,IAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8B3B,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BxB,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ADzE/B,IAAM,kBAAkB,OAAO,cAAsB,WAAgD;AACpG,QAAM,cAAc,aAAa,MAAM,UAAU;AACjD,QAAM,MAAM,cAAc,YAAY,GAAG,UAAU,CAAC,IAAI;AAExD,MAAI,WAAW;AAAS,WAAO;AAC/B,MAAI,WAAW;AAAQ,WAAO;AAC9B,MAAI,WAAW;AA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AA,QACZ,+BAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACR,wBAAO,OAAO;AAAA,UACb,WAAW;AAAA,UACX,MAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["import_node_sdk","import_node_sdk","import_node_sdk","import_node_sdk","import_promises","import_path","import_node_sdk","import_promises","import_path","glob","import_node_sdk","cmd","import_node_sdk"]}
package/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { Option, Plugin, PositionalArg, Task, Template } from "@taqueria/node-sdk";
3
3
 
4
4
  // createContract.ts
5
- import { experimental, sendAsyncErr } from "@taqueria/node-sdk";
5
+ import { sendAsyncErr } from "@taqueria/node-sdk";
6
6
  import { writeFile } from "fs/promises";
7
7
 
8
8
  // ligo_templates.ts
@@ -114,9 +114,6 @@ const main = ([action, store] : [parameter, storage]) : ret => {
114
114
  `;
115
115
 
116
116
  // createContract.ts
117
- var registerContract = (arg, contractName) => {
118
- experimental.registerContract(arg, contractName);
119
- };
120
117
  var getLigoTemplate = async (contractName, syntax) => {
121
118
  const matchResult = contractName.match(/\.[^.]+$/);
122
119
  const ext = matchResult ? matchResult[0].substring(1) : null;
@@ -149,7 +146,7 @@ var createContract = (args) => {
149
146
  const contractName = unsafeOpts.sourceFileName;
150
147
  const syntax = unsafeOpts.syntax;
151
148
  const contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;
152
- return getLigoTemplate(contractName, syntax).then((ligo_template) => writeFile(`${contractsDir}/${contractName}`, ligo_template)).then((_) => registerContract(unsafeOpts, contractName));
149
+ return getLigoTemplate(contractName, syntax).then((ligo_template) => writeFile(`${contractsDir}/${contractName}`, ligo_template));
153
150
  };
154
151
  var createContract_default = createContract;
155
152
 
@@ -162,7 +159,8 @@ import { join } from "path";
162
159
  var LIGO_DEFAULT_IMAGE = "ligolang/ligo:0.57.0";
163
160
  var LIGO_IMAGE_ENV_VAR = "TAQ_LIGO_IMAGE";
164
161
  var getLigoDockerImage = () => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);
165
- var getInputFilename = (parsedArgs, sourceFile) => join(parsedArgs.config.contractsDir ?? "contracts", sourceFile);
162
+ var getInputFilenameAbsPath = (parsedArgs, sourceFile) => join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? "contracts", sourceFile);
163
+ var getInputFilenameRelPath = (parsedArgs, sourceFile) => join(parsedArgs.config.contractsDir ?? "contracts", sourceFile);
166
164
  var emitExternalError = (err, sourceFile) => {
167
165
  sendErr(`
168
166
  === Error messages for ${sourceFile} ===`);
@@ -213,7 +211,7 @@ var getCompileContractCmd = (parsedArgs, sourceFile) => {
213
211
  if (!projectDir)
214
212
  throw `No project directory provided`;
215
213
  const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;
216
- const inputFile = getInputFilename(parsedArgs, sourceFile);
214
+ const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
217
215
  const outputFile = `-o ${getOutputContractFilename(parsedArgs, sourceFile)}`;
218
216
  const flags = isOutputFormatJSON(parsedArgs) ? " --michelson-format json " : "";
219
217
  const cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}`;
@@ -225,7 +223,7 @@ var getCompileExprCmd = (parsedArgs, sourceFile, exprKind, exprName) => {
225
223
  throw `No project directory provided`;
226
224
  const compilerType = isStorageKind(exprKind) ? "storage" : "parameter";
227
225
  const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;
228
- const inputFile = getInputFilename(parsedArgs, sourceFile);
226
+ const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
229
227
  const outputFile = `-o ${getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
230
228
  const flags = isOutputFormatJSON(parsedArgs) ? " --michelson-format json " : "";
231
229
  const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags}`;
@@ -259,7 +257,7 @@ var compileExpr = (parsedArgs, sourceFile, exprKind) => (exprName) => getArch().
259
257
  artifact: COMPILE_ERR_MSG
260
258
  };
261
259
  });
262
- var getExprNames = (parsedArgs, sourceFile) => readFile(getInputFilename(parsedArgs, sourceFile), "utf8").then((data) => data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
260
+ var getExprNames = (parsedArgs, sourceFile) => readFile(getInputFilenameAbsPath(parsedArgs, sourceFile), "utf8").then((data) => data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
263
261
  var compileExprs = (parsedArgs, sourceFile, exprKind) => getExprNames(parsedArgs, sourceFile).then((exprNames) => {
264
262
  if (exprNames.length === 0)
265
263
  return [];
@@ -279,7 +277,7 @@ var compileExprs = (parsedArgs, sourceFile, exprKind) => getExprNames(parsedArgs
279
277
  }).then(mergeArtifactsOutput(sourceFile));
280
278
  var tryLegacyStorageNamingConvention = (parsedArgs, sourceFile) => {
281
279
  const storageListFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;
282
- const storageListFilename = getInputFilename(parsedArgs, storageListFile);
280
+ const storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);
283
281
  return access(storageListFilename).then(() => {
284
282
  sendWarn(
285
283
  `Warning: The naming convention of "<CONTRACT>.storages.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.storageList.<EXTENSION>". Please adjust your storage file names accordingly
@@ -290,7 +288,7 @@ var tryLegacyStorageNamingConvention = (parsedArgs, sourceFile) => {
290
288
  };
291
289
  var tryLegacyParameterNamingConvention = (parsedArgs, sourceFile) => {
292
290
  const parameterListFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;
293
- const parameterListFilename = getInputFilename(parsedArgs, parameterListFile);
291
+ const parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);
294
292
  return access(parameterListFilename).then(() => {
295
293
  sendWarn(
296
294
  `Warning: The naming convention of "<CONTRACT>.parameters.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.parameterList.<EXTENSION>". Please adjust your parameter file names accordingly
@@ -338,22 +336,22 @@ var compileContractWithStorageAndParameter = async (parsedArgs, sourceFile) => {
338
336
  if (contractCompileResult.artifact === COMPILE_ERR_MSG)
339
337
  return [contractCompileResult];
340
338
  const storageListFile = `${removeExt(sourceFile)}.storageList${extractExt(sourceFile)}`;
341
- const storageListFilename = getInputFilename(parsedArgs, storageListFile);
339
+ const storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);
342
340
  const storageCompileResult = await access(storageListFilename).then(() => compileExprs(parsedArgs, storageListFile, "storage")).catch(() => tryLegacyStorageNamingConvention(parsedArgs, sourceFile)).catch(() => {
343
341
  sendWarn(
344
342
  `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
345
343
  `
346
344
  );
347
- writeFile2(join2(parsedArgs.config.projectDir, storageListFilename), initContentForStorage(sourceFile), "utf8");
345
+ writeFile2(storageListFilename, initContentForStorage(sourceFile), "utf8");
348
346
  });
349
347
  const parameterListFile = `${removeExt(sourceFile)}.parameterList${extractExt(sourceFile)}`;
350
- const parameterListFilename = getInputFilename(parsedArgs, parameterListFile);
348
+ const parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);
351
349
  const parameterCompileResult = await access(parameterListFilename).then(() => compileExprs(parsedArgs, parameterListFile, "parameter")).catch(() => tryLegacyParameterNamingConvention(parsedArgs, sourceFile)).catch(() => {
352
350
  sendWarn(
353
351
  `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
354
352
  `
355
353
  );
356
- writeFile2(join2(parsedArgs.config.projectDir, parameterListFilename), initContentForParameter(sourceFile), "utf8");
354
+ writeFile2(parameterListFilename, initContentForParameter(sourceFile), "utf8");
357
355
  });
358
356
  let compileResults = [contractCompileResult];
359
357
  if (storageCompileResult)
@@ -391,6 +389,27 @@ var compile = (parsedArgs) => {
391
389
  };
392
390
  var compile_default = compile;
393
391
 
392
+ // compile-all.ts
393
+ import { sendErr as sendErr3, sendJsonRes as sendJsonRes2 } from "@taqueria/node-sdk";
394
+ import glob from "fast-glob";
395
+ import { readFile as readFile2 } from "fs/promises";
396
+ import { join as join3 } from "path";
397
+ var isMainContract = (parsedArgs, contactFilename) => readFile2(getInputFilenameAbsPath(parsedArgs, contactFilename), "utf8").then((data) => /(const|let|function)\s+main/.test(data));
398
+ var compileAll = async (parsedArgs) => {
399
+ let p = [];
400
+ const contractFilenames = await glob(
401
+ ["**/*.ligo", "**/*.religo", "**/*.mligo", "**/*.jsligo"],
402
+ { cwd: join3(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? "contracts"), absolute: false }
403
+ );
404
+ for (const filename of contractFilenames) {
405
+ if (await isMainContract(parsedArgs, filename)) {
406
+ p.push(compileContractWithStorageAndParameter(parsedArgs, filename));
407
+ }
408
+ }
409
+ return Promise.all(p).then((tables) => tables.flat()).then(sendJsonRes2).catch((err) => sendErr3(err, false));
410
+ };
411
+ var compile_all_default = compileAll;
412
+
394
413
  // ligo.ts
395
414
  import { getArch as getArch2, sendAsyncErr as sendAsyncErr3, sendRes, spawnCmd } from "@taqueria/node-sdk";
396
415
  var getArbitraryLigoCmd = (parsedArgs, userArgs) => {
@@ -419,13 +438,13 @@ var ligo = (parsedArgs) => {
419
438
  var ligo_default = ligo;
420
439
 
421
440
  // test.ts
422
- import { execCmd as execCmd2, getArch as getArch3, sendAsyncErr as sendAsyncErr4, sendJsonRes as sendJsonRes2, sendWarn as sendWarn2 } from "@taqueria/node-sdk";
441
+ import { execCmd as execCmd2, getArch as getArch3, sendAsyncErr as sendAsyncErr4, sendJsonRes as sendJsonRes3, sendWarn as sendWarn2 } from "@taqueria/node-sdk";
423
442
  var getTestContractCmd = (parsedArgs, sourceFile) => {
424
443
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
425
444
  if (!projectDir)
426
445
  throw `No project directory provided`;
427
446
  const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;
428
- const inputFile = getInputFilename(parsedArgs, sourceFile);
447
+ const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
429
448
  const cmd = `${baseCmd} ${inputFile}`;
430
449
  return cmd;
431
450
  };
@@ -449,7 +468,7 @@ var test = (parsedArgs) => {
449
468
  const sourceFile = parsedArgs.sourceFile;
450
469
  if (!sourceFile)
451
470
  return sendAsyncErr4(`No source file provided`);
452
- return testContract(parsedArgs, sourceFile).then((result) => [result]).then(sendJsonRes2).catch(
471
+ return testContract(parsedArgs, sourceFile).then((result) => [result]).then(sendJsonRes3).catch(
453
472
  (err) => sendAsyncErr4(err, false)
454
473
  );
455
474
  };
@@ -463,6 +482,8 @@ var main = (parsedArgs) => {
463
482
  return ligo_default(unsafeOpts);
464
483
  case "compile":
465
484
  return compile_default(unsafeOpts);
485
+ case "compile-all":
486
+ return compile_all_default(unsafeOpts);
466
487
  case "test":
467
488
  return test_default(parsedArgs);
468
489
  case "get-image":
@@ -510,6 +531,20 @@ Plugin.create((i18n) => ({
510
531
  handler: "proxy",
511
532
  encoding: "json"
512
533
  }),
534
+ Task.create({
535
+ task: "compile-all",
536
+ command: "compile-all",
537
+ description: "Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found",
538
+ options: [
539
+ Option.create({
540
+ flag: "json",
541
+ boolean: true,
542
+ description: "Emit JSON-encoded Michelson"
543
+ })
544
+ ],
545
+ handler: "proxy",
546
+ encoding: "json"
547
+ }),
513
548
  Task.create({
514
549
  task: "test",
515
550
  command: "test <sourceFile>",
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\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.57.0';\n\nconst LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';\n\nexport const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);\n\nexport const 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, sendErr, 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\nexport type 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(join(parsedArgs.config.projectDir, 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(join(parsedArgs.config.projectDir, 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 => sendErr(err, false));\n};\n\nexport default compile;\nexport const ___TEST___ = {\n\tgetContractNameForExpr,\n\tgetOutputExprFilename,\n};\n","import { getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (parsedArgs: Opts, userArgs: string): [string, Record<string, string>] => {\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 [\n\t\t[binary, ...args].join(' '),\n\t\tenvVars,\n\t];\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tgetArch()\n\t\t.then(() => getArbitraryLigoCmd(parsedArgs, cmd))\n\t\t.then(([cmd, envVars]) => spawnCmd(cmd, envVars))\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { emitExternalError, 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"],"mappings":";AAAA,SAAS,QAAQ,QAAQ,eAAe,MAAM,gBAAgB;;;ACA9D,SAAS,cAAc,oBAAoB;AAE3C,SAAS,iBAAiB;;;ACFnB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BvB,IAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8B3B,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BxB,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;A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;AAAA,UACX,MAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,UACb,UAAU;AAAA,QACX,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS,CAAC,KAAK,cAAc;AAAA,MAC7B,aACC;AAAA,MACD,SAAS;AAAA,QACR,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,SAAS;AAAA,UACT,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,QAAQ;AAAA,IACT,CAAC;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACV,SAAS,OAAO;AAAA,MACf,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,QACZ,cAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACR,OAAO,OAAO;AAAA,UACb,WAAW;AAAA,UACX,MAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["sendAsyncErr","sendAsyncErr","sendErr","writeFile","join","join","writeFile","sendAsyncErr","sendErr","getArch","sendAsyncErr","getArch","cmd","sendAsyncErr","execCmd","getArch","sendAsyncErr","sendJsonRes","sendWarn","getArch","execCmd","sendWarn","sendAsyncErr","sendJsonRes","sendAsyncErr"]}
1
+ {"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","compile-all.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile-all',\n\t\t\tcommand: 'compile-all',\n\t\t\tdescription:\n\t\t\t\t'Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tflag: 'json',\n\t\t\t\t\tboolean: true,\n\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'get-image',\n\t\t\tcommand: 'get-image',\n\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\thandler: 'proxy',\n\t\t\thidden: true,\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: main,\n}), process.argv);\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template, pascaligo_template, religo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === '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};\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 compileAll from './compile-all';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: RequestArgs.t): Promise<void> => {\n\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\tswitch (unsafeOpts.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(unsafeOpts);\n\t\tcase 'compile':\n\t\t\treturn compile(unsafeOpts);\n\t\tcase 'compile-all':\n\t\t\treturn compileAll(unsafeOpts);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tcase 'get-image':\n\t\t\treturn sendAsyncRes(getLigoDockerImage());\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default main;\n","import { getDockerImage, sendErr } from '@taqueria/node-sdk';\nimport { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends ProxyTaskArgs.t {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends ProxyTaskArgs.t {\n\tsourceFile: string;\n\tjson: boolean;\n}\n\nexport interface CompileAllOpts extends ProxyTaskArgs.t {\n\tjson: boolean;\n}\n\nexport interface TestOpts extends RequestArgs.t {\n\ttask?: string;\n\tsourceFile?: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & CompileAllOpts & TestOpts;\n\ntype UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;\n\n// Should point to the latest stable version, so it needs to be updated as part of our release process.\nconst LIGO_DEFAULT_IMAGE = 'ligolang/ligo:0.57.0';\n\nconst LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';\n\nexport const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);\n\nexport const getInputFilenameAbsPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const getInputFilenameRelPath = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const 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, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport {\n\tCompileOpts as Opts,\n\temitExternalError,\n\tgetInputFilenameAbsPath,\n\tgetInputFilenameRelPath,\n\tgetLigoDockerImage,\n} from './common';\n\nexport type TableRow = { contract: string; artifact: string };\n\nexport type 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 = getInputFilenameRelPath(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 = getInputFilenameRelPath(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(getInputFilenameAbsPath(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 = getInputFilenameAbsPath(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 = getInputFilenameAbsPath(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\nexport const compileContractWithStorageAndParameter = async (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n): 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 = getInputFilenameAbsPath(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 = getInputFilenameAbsPath(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 => sendErr(err, false));\n};\n\nexport default compile;\nexport const ___TEST___ = {\n\tgetContractNameForExpr,\n\tgetOutputExprFilename,\n};\n","import { sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport glob from 'fast-glob';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\nimport { CompileAllOpts as Opts, CompileOpts, getInputFilenameAbsPath } from './common';\nimport { compileContractWithStorageAndParameter, TableRow } from './compile';\n\nconst isMainContract = (parsedArgs: Opts, contactFilename: string): Promise<boolean> =>\n\treadFile(getInputFilenameAbsPath(parsedArgs, contactFilename), 'utf8')\n\t\t.then(data => /(const|let|function)\\s+main/.test(data));\n\nconst compileAll = async (parsedArgs: Opts): Promise<void> => {\n\tlet p: Promise<TableRow[]>[] = [];\n\n\tconst contractFilenames = await glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{ cwd: join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts'), absolute: false },\n\t);\n\n\tfor (const filename of contractFilenames) {\n\t\tif (await isMainContract(parsedArgs, filename)) {\n\t\t\tp.push(compileContractWithStorageAndParameter(parsedArgs as CompileOpts, filename));\n\t\t}\n\t}\n\n\treturn Promise.all(p).then(tables => tables.flat()).then(sendJsonRes).catch(err => sendErr(err, false));\n};\n\nexport default compileAll;\n","import { getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (parsedArgs: Opts, userArgs: string): [string, Record<string, string>] => {\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 [\n\t\t[binary, ...args].join(' '),\n\t\tenvVars,\n\t];\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tgetArch()\n\t\t.then(() => getArbitraryLigoCmd(parsedArgs, cmd))\n\t\t.then(([cmd, envVars]) => spawnCmd(cmd, envVars))\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { emitExternalError, getInputFilenameRelPath, getLigoDockerImage, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;\n\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\tconst cmd = `${baseCmd} ${inputFile}`;\n\treturn cmd;\n};\n\nconst testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stdout, stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nconst test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!sourceFile) return sendAsyncErr(`No source file provided`);\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"mappings":";AAAA,SAAS,QAAQ,QAAQ,eAAe,MAAM,gBAAgB;;;ACA9D,SAAS,oBAAoB;AAE7B,SAAS,iBAAiB;;;ACFnB,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BvB,IAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8B3B,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BxB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MAAM;AAAA,MACN,SAAS;AAAA,MACT,aACC;AAAA,MACD,SAAS;AAAA,QACR,OAAO,OAAO;AAAA,UACb,MAAM;AAAA,UACN,SAAS;AAAA,UACT,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,UAAU;AAAA,IACX,CAAC;AAAA,IACD,KAAK,OAAO;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,MACT,aAAa;AAAA,MACb,SAAS;AAAA,MACT,QAAQ;AAAA,IACT,CAAC;AAAA,EACF;AAAA,EACA,WAAW;AAAA,IACV,SAAS,OAAO;AAAA,MACf,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,QACZ,cAAc,OAAO;AAAA,UACpB,aAAa;AAAA,UACb,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACR,OAAO,OAAO;AAAA,UACb,WAAW;AAAA,UACX,MAAM;AAAA,UACN,MAAM;AAAA,UACN,aAAa;AAAA,QACd,CAAC;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AAAA,EACA,OAAO;AACR,IAAI,QAAQ,IAAI;","names":["sendAsyncErr","sendAsyncErr","sendErr","writeFile","join","join","writeFile","sendAsyncErr","sendErr","sendErr","sendJsonRes","readFile","join","readFile","join","sendJsonRes","sendErr","getArch","sendAsyncErr","getArch","cmd","sendAsyncErr","execCmd","getArch","sendAsyncErr","sendJsonRes","sendWarn","getArch","execCmd","sendWarn","sendAsyncErr","sendJsonRes","sendAsyncErr"]}
package/index.ts CHANGED
@@ -40,6 +40,21 @@ Plugin.create(i18n => ({
40
40
  handler: 'proxy',
41
41
  encoding: 'json',
42
42
  }),
43
+ Task.create({
44
+ task: 'compile-all',
45
+ command: 'compile-all',
46
+ description:
47
+ 'Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found',
48
+ options: [
49
+ Option.create({
50
+ flag: 'json',
51
+ boolean: true,
52
+ description: 'Emit JSON-encoded Michelson',
53
+ }),
54
+ ],
55
+ handler: 'proxy',
56
+ encoding: 'json',
57
+ }),
43
58
  Task.create({
44
59
  task: 'test',
45
60
  command: 'test <sourceFile>',
package/main.ts CHANGED
@@ -1,6 +1,7 @@
1
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
+ import compileAll from './compile-all';
4
5
  import ligo from './ligo';
5
6
  import test from './test';
6
7
 
@@ -11,6 +12,8 @@ const main = (parsedArgs: RequestArgs.t): Promise<void> => {
11
12
  return ligo(unsafeOpts);
12
13
  case 'compile':
13
14
  return compile(unsafeOpts);
15
+ case 'compile-all':
16
+ return compileAll(unsafeOpts);
14
17
  case 'test':
15
18
  return test(parsedArgs);
16
19
  case 'get-image':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-ligo",
3
- "version": "0.26.28-rc",
3
+ "version": "0.27.0-rc",
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.26.28-rc",
44
+ "@taqueria/node-sdk": "^0.27.0-rc",
45
45
  "fast-glob": "^3.2.11"
46
46
  },
47
47
  "devDependencies": {
package/test.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
2
- import { emitExternalError, getInputFilename, getLigoDockerImage, TestOpts as Opts } from './common';
2
+ import { emitExternalError, getInputFilenameRelPath, getLigoDockerImage, TestOpts as Opts } from './common';
3
3
 
4
4
  type TableRow = { contract: string; testResults: string };
5
5
 
@@ -8,7 +8,7 @@ const getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {
8
8
  if (!projectDir) throw `No project directory provided`;
9
9
  const baseCmd =
10
10
  `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;
11
- const inputFile = getInputFilename(parsedArgs, sourceFile);
11
+ const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
12
12
  const cmd = `${baseCmd} ${inputFile}`;
13
13
  return cmd;
14
14
  };