@taqueria/plugin-ligo 0.24.1 → 0.25.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,20 +1,24 @@
1
1
  # Taqueria LIGO Plugin
2
2
 
3
- The LIGO plugin provides a task to compile LIGO smart contracts to Michelson `.tz` files
3
+ The LIGO plugin provides tasks to work with LIGO smart contracts such as compiling and testing
4
4
 
5
5
  ## Requirements
6
6
 
7
- - Taqueria v0.24.0 or later
7
+ - Taqueria v0.24.2 or later
8
8
  - Node.js v16.17.1 or later
9
9
  - Docker v20.10.12 or later
10
10
 
11
11
  ## Installation
12
12
 
13
13
  To install the LIGO plugin on a Taqueria project, navigate to the project folder and run:
14
+
14
15
  ```shell
15
16
  taq install @taqueria/plugin-ligo
16
17
  ```
17
18
 
19
+ > ### :page_with_curl: Note
20
+ > You can override the Ligo version used by the plugin by creating the environment variable `TAQ_LIGO_IMAGE` and setting it to your desired Ligo Docker image
21
+
18
22
  ## The `taq compile` Task
19
23
 
20
24
  Basic usage is:
@@ -32,23 +36,20 @@ The LIGO plugin exposes a `compile` task in Taqueria which can target one LIGO c
32
36
  ### A frictionless smart contract development workflow
33
37
  Our LIGO plugin introduces a smart contract development workflow by means of two simple file naming formats
34
38
 
35
- Suppose you have a contract named `hello.mligo` and you create a file in the same directory as the contract with the naming format of `CONTRACT.storages.EXT`, where `CONTRACT` is the name of the contract this storages file is associated with and `EXT` must match the extension of the associated contract. In our case, the former is `hello` and the latter is `mligo`, so it'd be named `hello.storages.mligo`
39
+ Suppose you have a contract named `hello.mligo` and you create a file in the same directory as the contract with the naming format of `CONTRACT.storageList.EXT`, where `CONTRACT` is the name of the contract this storage list file is associated with and `EXT` must match the extension of the associated contract. In our case, the former is `hello` and the latter is `mligo`, so it'd be named `hello.storageList.mligo`
36
40
 
37
- You can define a list of LIGO variables in `hello.storages.mligo` in the form of `let VARIABLE_NAME: STORAGE_TYPE = EXPRESSION` (explicit typing is optional but recommended) and the expressions will be treated as initial storage values for `hello.mligo`
41
+ You can define a list of LIGO variables in `hello.storageList.mligo` in the form of `let VARIABLE_NAME: STORAGE_TYPE = EXPRESSION` (explicit typing is optional but recommended) and the expressions will be treated as initial storage values for `hello.mligo`
38
42
 
39
43
  > ### :page_with_curl: Note
40
44
  > Note that the form is actually mligo code. Variable definitions in other syntax variants will differ.
41
45
 
42
- Similarly with `hello.parameters.mligo` but in the form of `let VARIABLE_NAME: PARAMETER_TYPE = EXPRESSION`
46
+ Similarly with `hello.parameterList.mligo` but in the form of `let VARIABLE_NAME: PARAMETER_TYPE = EXPRESSION`
43
47
 
44
- `taq compile hello.storages.mligo` will compile each definition in `hello.storages.mligo` and will produce a Michelson `.tz` file that contains the storage value, as a Michelson expression, for each of them. If the name of a variable is `storage1`, then its emitted Michelson file will be named `hello.storage.storage1.tz`. For `taq compile hello.parameters.mligo`, the name will be `hello.parameter.param1.tz` if there's a variable named `param1` defined in `hello.parameters.mligo`
48
+ `taq compile hello.storageList.mligo` will compile each definition in `hello.storageList.mligo` and will produce a Michelson `.tz` file that contains the storage value, as a Michelson expression, for each of them. If the name of a variable is `storage1`, then its emitted Michelson file will be named `hello.storage.storage1.tz`. For `taq compile hello.parameterList.mligo`, the name will be `hello.parameter.param1.tz` if there's a variable named `param1` defined in `hello.parameterList.mligo`
45
49
 
46
- Furthermore, the first variable definition in `hello.storages.mligo` will be treated as the default storage and will produce a Michelson file named `hello.default_storage.tz` instead. The `deploy` task from the Taquito plugin will take advantage of this. Go to that plugin documentation to learn how
50
+ Furthermore, the first variable definition in `hello.storageList.mligo` will be treated as the default storage and will produce a Michelson file named `hello.default_storage.tz` instead. The `deploy` task from the Taquito plugin will take advantage of this. Go to that plugin documentation to learn how
47
51
 
48
- Lastly, `taq compile hello.mligo` will compile `hello.mligo` and emit `hello.tz`. Then it'll look for `hello.storages.mligo` and `hello.parameters.mligo` and compile them too if they are found
49
-
50
- > ### :warning: CAUTION
51
- > Make sure you name it `hello.storages.mligo` and not `hello.storage.mligo` (note the extra `s`)
52
+ Lastly, `taq compile hello.mligo` will compile `hello.mligo` and emit `hello.tz`. Then it'll look for `hello.storageList.mligo` and `hello.parameterList.mligo` and compile them too if they are found
52
53
 
53
54
  ### Options
54
55
 
package/_readme.eta CHANGED
@@ -2,21 +2,26 @@
2
2
  # Taqueria LIGO Plugin
3
3
  <% } %>
4
4
 
5
- The LIGO plugin provides a task to compile LIGO smart contracts to Michelson `.tz` files
5
+ The LIGO plugin provides tasks to work with LIGO smart contracts such as compiling and testing
6
6
 
7
7
  ## Requirements
8
8
 
9
- - Taqueria v0.24.0 or later
9
+ - Taqueria v0.24.2 or later
10
10
  - Node.js v16.17.1 or later
11
11
  - Docker v20.10.12 or later
12
12
 
13
13
  ## Installation
14
14
 
15
15
  To install the LIGO plugin on a Taqueria project, navigate to the project folder and run:
16
+
16
17
  ```shell
17
18
  taq install @taqueria/plugin-ligo
18
19
  ```
19
20
 
21
+ <%~ it.noteOpenAdmonition %>
22
+ You can override the Ligo version used by the plugin by creating the environment variable `TAQ_LIGO_IMAGE` and setting it to your desired Ligo Docker image
23
+ <%= it.closeAdmonition %>
24
+
20
25
  ## The `taq compile` Task
21
26
 
22
27
  Basic usage is:
@@ -35,25 +40,21 @@ The LIGO plugin exposes a `compile` task in Taqueria which can target one LIGO c
35
40
  ### A frictionless smart contract development workflow
36
41
  Our LIGO plugin introduces a smart contract development workflow by means of two simple file naming formats
37
42
 
38
- Suppose you have a contract named `hello.mligo` and you create a file in the same directory as the contract with the naming format of `CONTRACT.storages.EXT`, where `CONTRACT` is the name of the contract this storages file is associated with and `EXT` must match the extension of the associated contract. In our case, the former is `hello` and the latter is `mligo`, so it'd be named `hello.storages.mligo`
43
+ Suppose you have a contract named `hello.mligo` and you create a file in the same directory as the contract with the naming format of `CONTRACT.storageList.EXT`, where `CONTRACT` is the name of the contract this storage list file is associated with and `EXT` must match the extension of the associated contract. In our case, the former is `hello` and the latter is `mligo`, so it'd be named `hello.storageList.mligo`
39
44
 
40
- You can define a list of LIGO variables in `hello.storages.mligo` in the form of `let VARIABLE_NAME: STORAGE_TYPE = EXPRESSION` (explicit typing is optional but recommended) and the expressions will be treated as initial storage values for `hello.mligo`
45
+ You can define a list of LIGO variables in `hello.storageList.mligo` in the form of `let VARIABLE_NAME: STORAGE_TYPE = EXPRESSION` (explicit typing is optional but recommended) and the expressions will be treated as initial storage values for `hello.mligo`
41
46
 
42
47
  <%~ it.noteOpenAdmonition %>
43
48
  Note that the form is actually mligo code. Variable definitions in other syntax variants will differ.
44
49
  <%= it.closeAdmonition %>
45
50
 
46
- Similarly with `hello.parameters.mligo` but in the form of `let VARIABLE_NAME: PARAMETER_TYPE = EXPRESSION`
51
+ Similarly with `hello.parameterList.mligo` but in the form of `let VARIABLE_NAME: PARAMETER_TYPE = EXPRESSION`
47
52
 
48
- `taq compile hello.storages.mligo` will compile each definition in `hello.storages.mligo` and will produce a Michelson `.tz` file that contains the storage value, as a Michelson expression, for each of them. If the name of a variable is `storage1`, then its emitted Michelson file will be named `hello.storage.storage1.tz`. For `taq compile hello.parameters.mligo`, the name will be `hello.parameter.param1.tz` if there's a variable named `param1` defined in `hello.parameters.mligo`
53
+ `taq compile hello.storageList.mligo` will compile each definition in `hello.storageList.mligo` and will produce a Michelson `.tz` file that contains the storage value, as a Michelson expression, for each of them. If the name of a variable is `storage1`, then its emitted Michelson file will be named `hello.storage.storage1.tz`. For `taq compile hello.parameterList.mligo`, the name will be `hello.parameter.param1.tz` if there's a variable named `param1` defined in `hello.parameterList.mligo`
49
54
 
50
- Furthermore, the first variable definition in `hello.storages.mligo` will be treated as the default storage and will produce a Michelson file named `hello.default_storage.tz` instead. The `deploy` task from the Taquito plugin will take advantage of this. Go to that plugin documentation to learn how
55
+ Furthermore, the first variable definition in `hello.storageList.mligo` will be treated as the default storage and will produce a Michelson file named `hello.default_storage.tz` instead. The `deploy` task from the Taquito plugin will take advantage of this. Go to that plugin documentation to learn how
51
56
 
52
- Lastly, `taq compile hello.mligo` will compile `hello.mligo` and emit `hello.tz`. Then it'll look for `hello.storages.mligo` and `hello.parameters.mligo` and compile them too if they are found
53
-
54
- <%~ it.cautionOpenAdmonition %>
55
- Make sure you name it `hello.storages.mligo` and not `hello.storage.mligo` (note the extra `s`)
56
- <%= it.closeAdmonition %>
57
+ Lastly, `taq compile hello.mligo` will compile `hello.mligo` and emit `hello.tz`. Then it'll look for `hello.storageList.mligo` and `hello.parameterList.mligo` and compile them too if they are found
57
58
 
58
59
  ### Options
59
60
 
package/common.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { getDockerImage, sendErr } from '@taqueria/node-sdk';
1
2
  import { RequestArgs } from '@taqueria/node-sdk/types';
2
3
  import { join } from 'path';
3
4
 
@@ -17,8 +18,18 @@ export type IntersectionOpts = LigoOpts & CompileOpts & TestOpts;
17
18
 
18
19
  type UnionOpts = LigoOpts | CompileOpts | TestOpts;
19
20
 
20
- // Points to the latest stable version. Needs to update this as part of our release process
21
- export const LIGO_DOCKER_IMAGE = 'ligolang/ligo:0.55.0';
21
+ // Should point to the latest stable version, so it needs to be updated as part of our release process.
22
+ const LIGO_DEFAULT_IMAGE = 'ligolang/ligo:0.54.1';
23
+
24
+ const LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';
25
+
26
+ export const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);
22
27
 
23
28
  export const getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): string =>
24
29
  join(parsedArgs.config.contractsDir, sourceFile);
30
+
31
+ export const emitExternalError = (err: unknown, sourceFile: string): void => {
32
+ sendErr(`\n=== Error messages for ${sourceFile} ===`);
33
+ err instanceof Error ? sendErr(err.message.replace(/Command failed.+?\n/, '')) : sendErr(err as any);
34
+ sendErr(`\n===`);
35
+ };
package/compile.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
1
+ import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
2
2
  import { access, readFile, writeFile } from 'fs/promises';
3
3
  import { basename, extname, join } from 'path';
4
- import { CompileOpts as Opts, getInputFilename, LIGO_DOCKER_IMAGE } from './common';
4
+ import { CompileOpts as Opts, emitExternalError, getInputFilename, getLigoDockerImage } from './common';
5
5
 
6
6
  type TableRow = { contract: string; artifact: string };
7
7
 
@@ -13,13 +13,14 @@ const isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' ||
13
13
 
14
14
  const isLIGOFile = (sourceFile: string): boolean => /.+\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
15
15
 
16
- const isStoragesFile = (sourceFile: string): boolean => /.+\.storages\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
16
+ const isStorageListFile = (sourceFile: string): boolean =>
17
+ /.+\.(storageList|storages)\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
17
18
 
18
- const isParametersFile = (sourceFile: string): boolean =>
19
- /.+\.parameters\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
19
+ const isParameterListFile = (sourceFile: string): boolean =>
20
+ /.+\.(parameterList|parameters)\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
20
21
 
21
22
  const isContractFile = (sourceFile: string): boolean =>
22
- isLIGOFile(sourceFile) && !isStoragesFile(sourceFile) && !isParametersFile(sourceFile);
23
+ isLIGOFile(sourceFile) && !isStorageListFile(sourceFile) && !isParameterListFile(sourceFile);
23
24
 
24
25
  const extractExt = (path: string): string => {
25
26
  const matchResult = path.match(/\.(ligo|religo|mligo|jsligo)$/);
@@ -31,25 +32,25 @@ const removeExt = (path: string): string => {
31
32
  return path.replace(extRegex, '');
32
33
  };
33
34
 
34
- const getOutputFilename = (parsedArgs: Opts, sourceFile: string): string => {
35
+ const getOutputContractFilename = (parsedArgs: Opts, sourceFile: string): string => {
35
36
  const outputFile = basename(sourceFile, extname(sourceFile));
36
37
  return join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);
37
38
  };
38
39
 
39
40
  // Get the contract name that the storage/parameter file is associated with
40
- // e.g. If sourceFile is token.storages.mligo, then it'll return token.mligo
41
+ // e.g. If sourceFile is token.storageList.mligo, then it'll return token.mligo
41
42
  const getContractNameForExpr = (sourceFile: string, exprKind: ExprKind): string => {
42
43
  try {
43
44
  return isStorageKind(exprKind)
44
- ? sourceFile.match(/.+(?=\.storages\.(ligo|religo|mligo|jsligo))/)!.join('.')
45
- : sourceFile.match(/.+(?=\.parameters\.(ligo|religo|mligo|jsligo))/)!.join('.');
45
+ ? sourceFile.match(/.+(?=\.(?:storageList|storages)\.(ligo|religo|mligo|jsligo))/)!.join('.')
46
+ : sourceFile.match(/.+(?=\.(?:parameterList|parameters)\.(ligo|religo|mligo|jsligo))/)!.join('.');
46
47
  } catch (err) {
47
48
  throw new Error(`Something went wrong internally when dealing with filename format: ${err}`);
48
49
  }
49
50
  };
50
51
 
51
- // If sourceFile is token.storages.mligo, then it'll return token.storage.{storageName}.tz
52
- const getOutputExprFileName = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {
52
+ // If sourceFile is token.storageList.mligo, then it'll return token.storage.{storageName}.tz
53
+ const getOutputExprFilename = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {
53
54
  const contractName = basename(getContractNameForExpr(sourceFile, exprKind), extname(sourceFile));
54
55
  const outputFile = exprKind === 'default_storage'
55
56
  ? `${contractName}.default_storage.tz`
@@ -61,9 +62,9 @@ const getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string =>
61
62
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
62
63
  if (!projectDir) throw `No project directory provided`;
63
64
  const baseCmd =
64
- `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} compile contract`;
65
+ `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;
65
66
  const inputFile = getInputFilename(parsedArgs, sourceFile);
66
- const outputFile = `-o ${getOutputFilename(parsedArgs, sourceFile)}`;
67
+ const outputFile = `-o ${getOutputContractFilename(parsedArgs, sourceFile)}`;
67
68
  const cmd = `${baseCmd} ${inputFile} ${outputFile}`;
68
69
  return cmd;
69
70
  };
@@ -73,9 +74,9 @@ const getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprK
73
74
  if (!projectDir) throw `No project directory provided`;
74
75
  const compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';
75
76
  const baseCmd =
76
- `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} compile ${compilerType}`;
77
+ `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;
77
78
  const inputFile = getInputFilename(parsedArgs, sourceFile);
78
- const outputFile = `-o ${getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;
79
+ const outputFile = `-o ${getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
79
80
  const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;
80
81
  return cmd;
81
82
  };
@@ -88,12 +89,11 @@ const compileContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow
88
89
  if (stderr.length > 0) sendWarn(stderr);
89
90
  return {
90
91
  contract: sourceFile,
91
- artifact: getOutputFilename(parsedArgs, sourceFile),
92
+ artifact: getOutputContractFilename(parsedArgs, sourceFile),
92
93
  };
93
94
  })
94
95
  .catch(err => {
95
- sendErr(`\n=== For ${sourceFile} ===`);
96
- sendErr(err.message.replace(/Command failed.+?\n/, ''));
96
+ emitExternalError(err, sourceFile);
97
97
  return {
98
98
  contract: sourceFile,
99
99
  artifact: COMPILE_ERR_MSG,
@@ -109,33 +109,25 @@ const compileExpr = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind) =
109
109
  if (stderr.length > 0) sendWarn(stderr);
110
110
  return {
111
111
  contract: sourceFile,
112
- artifact: getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName),
112
+ artifact: getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName),
113
113
  };
114
114
  })
115
115
  .catch(err => {
116
- sendErr(`\n=== For ${sourceFile} ===`);
117
- sendErr(err.message.replace(/Command failed.+?\n/, ''));
116
+ emitExternalError(err, sourceFile);
118
117
  return {
119
118
  contract: sourceFile,
120
119
  artifact: COMPILE_ERR_MSG,
121
120
  };
122
121
  });
123
122
 
124
- const compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>
123
+ const getExprNames = (parsedArgs: Opts, sourceFile: string): Promise<string[]> =>
125
124
  readFile(getInputFilename(parsedArgs, sourceFile), 'utf8')
126
- .then(async data => {
127
- if (!data.includes('#include')) {
128
- await writeFile(
129
- getInputFilename(parsedArgs, sourceFile),
130
- `#include "${getContractNameForExpr(sourceFile, exprKind)}"\n` + data,
131
- 'utf8',
132
- );
133
- }
134
- return data;
135
- })
136
- .then(data => data.match(/(?<=\s*(let|const)\s+)[a-zA-Z0-9_]+/g))
125
+ .then(data => data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
126
+
127
+ const compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>
128
+ getExprNames(parsedArgs, sourceFile)
137
129
  .then(exprNames => {
138
- if (!exprNames) return [];
130
+ if (exprNames.length === 0) return [];
139
131
  const firstExprName = exprNames.slice(0, 1)[0];
140
132
  const restExprNames = exprNames.slice(1, exprNames.length);
141
133
  const firstExprKind = isStorageKind(exprKind) ? 'default_storage' : 'parameter';
@@ -145,38 +137,95 @@ const compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind):
145
137
  return Promise.all([firstExprResult].concat(restExprResults));
146
138
  })
147
139
  .catch(err => {
148
- sendErr(`\n=== For ${sourceFile} ===`);
149
- sendErr(err.message);
140
+ emitExternalError(err, sourceFile);
150
141
  return [{
151
142
  contract: sourceFile,
152
- artifact: `No ${isStorageKind(exprKind) ? 'storages' : 'parameters'} compiled`,
143
+ artifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} values compiled`,
153
144
  }];
154
145
  })
155
146
  .then(mergeArtifactsOutput(sourceFile));
156
147
 
148
+ // TODO: Just for backwards compatibility. Can be deleted in the future.
149
+ const tryLegacyStorageNamingConvention = (parsedArgs: Opts, sourceFile: string) => {
150
+ const storageListFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;
151
+ const storageListFilename = getInputFilename(parsedArgs, storageListFile);
152
+ return access(storageListFilename).then(() => {
153
+ sendWarn(
154
+ `Warning: The naming convention of "<CONTRACT>.storages.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.storageList.<EXTENSION>". Please adjust your storage file names accordingly\n`,
155
+ );
156
+ return compileExprs(parsedArgs, storageListFile, 'storage');
157
+ });
158
+ };
159
+
160
+ // TODO: Just for backwards compatibility. Can be deleted in the future.
161
+ const tryLegacyParameterNamingConvention = (parsedArgs: Opts, sourceFile: string) => {
162
+ const parameterListFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;
163
+ const parameterListFilename = getInputFilename(parsedArgs, parameterListFile);
164
+ return access(parameterListFilename).then(() => {
165
+ sendWarn(
166
+ `Warning: The naming convention of "<CONTRACT>.parameters.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.parameterList.<EXTENSION>". Please adjust your parameter file names accordingly\n`,
167
+ );
168
+ return compileExprs(parsedArgs, parameterListFile, 'parameter');
169
+ });
170
+ };
171
+
172
+ const initContentForStorage = (sourceFile: string): string => {
173
+ const linkToContract = `#include "${sourceFile}"\n\n`;
174
+
175
+ const instruction =
176
+ '// 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';
177
+
178
+ const ext = extractExt(sourceFile);
179
+ let syntax = '';
180
+ if (ext === '.ligo') syntax = '// E.g. const aStorageValue : aStorageType = 10;\n\n';
181
+ else if (ext === '.religo') syntax = '// E.g. let aStorageValue : aStorageType = 10;\n\n';
182
+ else if (ext === '.mligo') syntax = '// E.g. let aStorageValue : aStorageType = 10\n\n';
183
+ else if (ext === '.jsligo') syntax = '// E.g. const aStorageValue : aStorageType = 10;\n\n';
184
+
185
+ return linkToContract + instruction + syntax;
186
+ };
187
+
188
+ const initContentForParameter = (sourceFile: string): string => {
189
+ const linkToContract = `#include "${sourceFile}"\n\n`;
190
+
191
+ const instruction = '// Define your parameter values as a list of LIGO variable definitions\n';
192
+
193
+ const ext = extractExt(sourceFile);
194
+ let syntax = '';
195
+ if (ext === '.ligo') syntax = '// E.g. const aParameterValue : aParameterType = Increment(1);\n\n';
196
+ else if (ext === '.religo') syntax = '// E.g. let aParameterValue : aParameterType = (Increment (1));\n\n';
197
+ else if (ext === '.mligo') syntax = '// E.g. let aParameterValue : aParameterType = Increment 1\n\n';
198
+ else if (ext === '.jsligo') syntax = '// E.g. const aParameterValue : aParameterType = (Increment (1));\n\n';
199
+
200
+ return linkToContract + instruction + syntax;
201
+ };
202
+
157
203
  const compileContractWithStorageAndParameter = async (parsedArgs: Opts, sourceFile: string): Promise<TableRow[]> => {
158
204
  const contractCompileResult = await compileContract(parsedArgs, sourceFile);
159
205
  if (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];
160
206
 
161
- const storagesFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;
162
- const parametersFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;
163
- const storagesFilename = getInputFilename(parsedArgs, storagesFile);
164
- const parametersFilename = getInputFilename(parsedArgs, parametersFile);
165
-
166
- const storageCompileResult = await access(storagesFilename)
167
- .then(() => compileExprs(parsedArgs, storagesFile, 'storage'))
207
+ const storageListFile = `${removeExt(sourceFile)}.storageList${extractExt(sourceFile)}`;
208
+ const storageListFilename = getInputFilename(parsedArgs, storageListFile);
209
+ const storageCompileResult = await access(storageListFilename)
210
+ .then(() => compileExprs(parsedArgs, storageListFile, 'storage'))
211
+ .catch(() => tryLegacyStorageNamingConvention(parsedArgs, sourceFile))
168
212
  .catch(() => {
169
- // sendWarn(
170
- // `Note: storage file associated with "${sourceFile}" can't be found. You should create a file "${storagesFile}" and define initial storage values as a list of LIGO variable definitions. e.g. "let STORAGE_NAME: storage = LIGO_EXPR" for CameLigo`,
171
- // )
213
+ sendWarn(
214
+ `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`,
215
+ );
216
+ writeFile(storageListFilename, initContentForStorage(sourceFile), 'utf8');
172
217
  });
173
218
 
174
- const parameterCompileResult = await access(parametersFilename)
175
- .then(() => compileExprs(parsedArgs, parametersFile, 'parameter'))
219
+ const parameterListFile = `${removeExt(sourceFile)}.parameterList${extractExt(sourceFile)}`;
220
+ const parameterListFilename = getInputFilename(parsedArgs, parameterListFile);
221
+ const parameterCompileResult = await access(parameterListFilename)
222
+ .then(() => compileExprs(parsedArgs, parameterListFile, 'parameter'))
223
+ .catch(() => tryLegacyParameterNamingConvention(parsedArgs, sourceFile))
176
224
  .catch(() => {
177
- // sendWarn(
178
- // `Note: parameter file associated with "${sourceFile}" can't be found. You should create a file "${parametersFile}" and define parameter values as a list of LIGO variable definitions. e.g. "let PARAMETER_NAME: parameter = LIGO_EXPR" for CameLigo`,
179
- // )
225
+ sendWarn(
226
+ `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`,
227
+ );
228
+ writeFile(parameterListFilename, initContentForParameter(sourceFile), 'utf8');
180
229
  });
181
230
 
182
231
  let compileResults: TableRow[] = [contractCompileResult];
@@ -190,20 +239,20 @@ Compiling storage/parameter file amounts to compiling multiple expressions in th
190
239
  resulting in multiple rows with the same file name but different artifact names.
191
240
  This will merge these rows into one row with just one mention of the file name.
192
241
  e.g.
193
- ┌──────────────────────┬─────────────────────────────────────────────┐
194
- │ Contract │ Artifact │
195
- ├──────────────────────┼─────────────────────────────────────────────┤
196
- │ hello.storages.mligo │ artifacts/hello.default_storage.storage1.tz │
197
- ├──────────────────────┼─────────────────────────────────────────────┤
198
- │ hello.storages.mligo │ artifacts/hello.storage.storage2.tz │
199
- └──────────────────────┴─────────────────────────────────────────────┘
242
+ ┌─────────────────────────┬─────────────────────────────────────────────┐
243
+ │ Contract │ Artifact │
244
+ ├─────────────────────────┼─────────────────────────────────────────────┤
245
+ │ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │
246
+ ├─────────────────────────┼─────────────────────────────────────────────┤
247
+ │ hello.storageList.mligo │ artifacts/hello.storage.storage2.tz │
248
+ └─────────────────────────┴─────────────────────────────────────────────┘
200
249
  versus
201
- ┌──────────────────────┬─────────────────────────────────────────────┐
202
- │ Contract │ Artifact │
203
- ├──────────────────────┼─────────────────────────────────────────────┤
204
- │ hello.storages.mligo │ artifacts/hello.default_storage.storage1.tz │
205
- │ artifacts/hello.storage.storage2.tz │
206
- └──────────────────────┴─────────────────────────────────────────────┘
250
+ ┌─────────────────────────┬─────────────────────────────────────────────┐
251
+ │ Contract │ Artifact │
252
+ ├─────────────────────────┼─────────────────────────────────────────────┤
253
+ │ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │
254
+ │ artifacts/hello.storage.storage2.tz │
255
+ └─────────────────────────┴─────────────────────────────────────────────┘
207
256
  */
208
257
  const mergeArtifactsOutput = (sourceFile: string) =>
209
258
  (tableRows: TableRow[]): TableRow[] => {
@@ -220,8 +269,8 @@ const mergeArtifactsOutput = (sourceFile: string) =>
220
269
  const compile = (parsedArgs: Opts): Promise<void> => {
221
270
  const sourceFile = parsedArgs.sourceFile;
222
271
  let p: Promise<TableRow[]>;
223
- if (isStoragesFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');
224
- else if (isParametersFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'parameter');
272
+ if (isStorageListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');
273
+ else if (isParameterListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'parameter');
225
274
  else if (isContractFile(sourceFile)) p = compileContractWithStorageAndParameter(parsedArgs, sourceFile);
226
275
  else {
227
276
  return sendAsyncErr(
package/index.js CHANGED
@@ -143,18 +143,28 @@ var $40622e3a438d0515$export$2e2bcd8739ae039 = $40622e3a438d0515$var$createContr
143
143
 
144
144
 
145
145
 
146
+ // Should point to the latest stable version, so it needs to be updated as part of our release process.
147
+ const $844cb58d66fbf6db$var$LIGO_DEFAULT_IMAGE = "ligolang/ligo:0.54.1";
148
+ const $844cb58d66fbf6db$var$LIGO_IMAGE_ENV_VAR = "TAQ_LIGO_IMAGE";
149
+ const $844cb58d66fbf6db$export$2b403d61ac8ea302 = ()=>(0, $kQNfl$taquerianodesdk.getDockerImage)($844cb58d66fbf6db$var$LIGO_DEFAULT_IMAGE, $844cb58d66fbf6db$var$LIGO_IMAGE_ENV_VAR);
150
+ const $844cb58d66fbf6db$export$17f107107c3c82c6 = (parsedArgs, sourceFile)=>(0, $kQNfl$path.join)(parsedArgs.config.contractsDir, sourceFile);
151
+ const $844cb58d66fbf6db$export$b59ff90dc389ce6d = (err, sourceFile)=>{
152
+ (0, $kQNfl$taquerianodesdk.sendErr)(`\n=== Error messages for ${sourceFile} ===`);
153
+ err instanceof Error ? (0, $kQNfl$taquerianodesdk.sendErr)(err.message.replace(/Command failed.+?\n/, "")) : (0, $kQNfl$taquerianodesdk.sendErr)(err);
154
+ (0, $kQNfl$taquerianodesdk.sendErr)(`\n===`);
155
+ };
156
+
157
+
146
158
 
147
159
 
148
- const $844cb58d66fbf6db$export$9bb5edf1683d4462 = "ligolang/ligo:0.55.0";
149
- const $844cb58d66fbf6db$export$17f107107c3c82c6 = (parsedArgs, sourceFile)=>(0, $kQNfl$path.join)(parsedArgs.config.contractsDir, sourceFile);
150
160
 
151
161
 
152
162
  const $24b2f47d8f306cb3$var$COMPILE_ERR_MSG = "Not compiled";
153
163
  const $24b2f47d8f306cb3$var$isStorageKind = (exprKind)=>exprKind === "storage" || exprKind === "default_storage";
154
164
  const $24b2f47d8f306cb3$var$isLIGOFile = (sourceFile)=>/.+\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
155
- const $24b2f47d8f306cb3$var$isStoragesFile = (sourceFile)=>/.+\.storages\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
156
- const $24b2f47d8f306cb3$var$isParametersFile = (sourceFile)=>/.+\.parameters\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
157
- const $24b2f47d8f306cb3$var$isContractFile = (sourceFile)=>$24b2f47d8f306cb3$var$isLIGOFile(sourceFile) && !$24b2f47d8f306cb3$var$isStoragesFile(sourceFile) && !$24b2f47d8f306cb3$var$isParametersFile(sourceFile);
165
+ const $24b2f47d8f306cb3$var$isStorageListFile = (sourceFile)=>/.+\.(storageList|storages)\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
166
+ const $24b2f47d8f306cb3$var$isParameterListFile = (sourceFile)=>/.+\.(parameterList|parameters)\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
167
+ const $24b2f47d8f306cb3$var$isContractFile = (sourceFile)=>$24b2f47d8f306cb3$var$isLIGOFile(sourceFile) && !$24b2f47d8f306cb3$var$isStorageListFile(sourceFile) && !$24b2f47d8f306cb3$var$isParameterListFile(sourceFile);
158
168
  const $24b2f47d8f306cb3$var$extractExt = (path)=>{
159
169
  const matchResult = path.match(/\.(ligo|religo|mligo|jsligo)$/);
160
170
  return matchResult ? matchResult[0] : "";
@@ -163,21 +173,21 @@ const $24b2f47d8f306cb3$var$removeExt = (path)=>{
163
173
  const extRegex = new RegExp($24b2f47d8f306cb3$var$extractExt(path));
164
174
  return path.replace(extRegex, "");
165
175
  };
166
- const $24b2f47d8f306cb3$var$getOutputFilename = (parsedArgs, sourceFile)=>{
176
+ const $24b2f47d8f306cb3$var$getOutputContractFilename = (parsedArgs, sourceFile)=>{
167
177
  const outputFile = (0, $kQNfl$path.basename)(sourceFile, (0, $kQNfl$path.extname)(sourceFile));
168
178
  return (0, $kQNfl$path.join)(parsedArgs.config.artifactsDir, `${outputFile}.tz`);
169
179
  };
170
180
  // Get the contract name that the storage/parameter file is associated with
171
- // e.g. If sourceFile is token.storages.mligo, then it'll return token.mligo
181
+ // e.g. If sourceFile is token.storageList.mligo, then it'll return token.mligo
172
182
  const $24b2f47d8f306cb3$var$getContractNameForExpr = (sourceFile, exprKind)=>{
173
183
  try {
174
- return $24b2f47d8f306cb3$var$isStorageKind(exprKind) ? sourceFile.match(/.+(?=\.storages\.(ligo|religo|mligo|jsligo))/).join(".") : sourceFile.match(/.+(?=\.parameters\.(ligo|religo|mligo|jsligo))/).join(".");
184
+ return $24b2f47d8f306cb3$var$isStorageKind(exprKind) ? sourceFile.match(/.+(?=\.(?:storageList|storages)\.(ligo|religo|mligo|jsligo))/).join(".") : sourceFile.match(/.+(?=\.(?:parameterList|parameters)\.(ligo|religo|mligo|jsligo))/).join(".");
175
185
  } catch (err) {
176
186
  throw new Error(`Something went wrong internally when dealing with filename format: ${err}`);
177
187
  }
178
188
  };
179
- // If sourceFile is token.storages.mligo, then it'll return token.storage.{storageName}.tz
180
- const $24b2f47d8f306cb3$var$getOutputExprFileName = (parsedArgs, sourceFile, exprKind, exprName)=>{
189
+ // If sourceFile is token.storageList.mligo, then it'll return token.storage.{storageName}.tz
190
+ const $24b2f47d8f306cb3$var$getOutputExprFilename = (parsedArgs, sourceFile, exprKind, exprName)=>{
181
191
  const contractName = (0, $kQNfl$path.basename)($24b2f47d8f306cb3$var$getContractNameForExpr(sourceFile, exprKind), (0, $kQNfl$path.extname)(sourceFile));
182
192
  const outputFile = exprKind === "default_storage" ? `${contractName}.default_storage.tz` : `${contractName}.${exprKind}.${exprName}.tz`;
183
193
  return (0, $kQNfl$path.join)(parsedArgs.config.artifactsDir, `${outputFile}`);
@@ -185,9 +195,9 @@ const $24b2f47d8f306cb3$var$getOutputExprFileName = (parsedArgs, sourceFile, exp
185
195
  const $24b2f47d8f306cb3$var$getCompileContractCmd = (parsedArgs, sourceFile)=>{
186
196
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
187
197
  if (!projectDir) throw `No project directory provided`;
188
- const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$9bb5edf1683d4462)} compile contract`;
198
+ const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$2b403d61ac8ea302)()} compile contract`;
189
199
  const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
190
- const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputFilename(parsedArgs, sourceFile)}`;
200
+ const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputContractFilename(parsedArgs, sourceFile)}`;
191
201
  const cmd = `${baseCmd} ${inputFile} ${outputFile}`;
192
202
  return cmd;
193
203
  };
@@ -195,9 +205,9 @@ const $24b2f47d8f306cb3$var$getCompileExprCmd = (parsedArgs, sourceFile, exprKin
195
205
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
196
206
  if (!projectDir) throw `No project directory provided`;
197
207
  const compilerType = $24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "storage" : "parameter";
198
- const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$9bb5edf1683d4462)} compile ${compilerType}`;
208
+ const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$2b403d61ac8ea302)()} compile ${compilerType}`;
199
209
  const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
200
- const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;
210
+ const outputFile = `-o ${$24b2f47d8f306cb3$var$getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
201
211
  const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;
202
212
  return cmd;
203
213
  };
@@ -205,11 +215,10 @@ const $24b2f47d8f306cb3$var$compileContract = (parsedArgs, sourceFile)=>(0, $kQN
205
215
  if (stderr.length > 0) (0, $kQNfl$taquerianodesdk.sendWarn)(stderr);
206
216
  return {
207
217
  contract: sourceFile,
208
- artifact: $24b2f47d8f306cb3$var$getOutputFilename(parsedArgs, sourceFile)
218
+ artifact: $24b2f47d8f306cb3$var$getOutputContractFilename(parsedArgs, sourceFile)
209
219
  };
210
220
  }).catch((err)=>{
211
- (0, $kQNfl$taquerianodesdk.sendErr)(`\n=== For ${sourceFile} ===`);
212
- (0, $kQNfl$taquerianodesdk.sendErr)(err.message.replace(/Command failed.+?\n/, ""));
221
+ (0, $844cb58d66fbf6db$export$b59ff90dc389ce6d)(err, sourceFile);
213
222
  return {
214
223
  contract: sourceFile,
215
224
  artifact: $24b2f47d8f306cb3$var$COMPILE_ERR_MSG
@@ -219,21 +228,18 @@ const $24b2f47d8f306cb3$var$compileExpr = (parsedArgs, sourceFile, exprKind)=>(e
219
228
  if (stderr.length > 0) (0, $kQNfl$taquerianodesdk.sendWarn)(stderr);
220
229
  return {
221
230
  contract: sourceFile,
222
- artifact: $24b2f47d8f306cb3$var$getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)
231
+ artifact: $24b2f47d8f306cb3$var$getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)
223
232
  };
224
233
  }).catch((err)=>{
225
- (0, $kQNfl$taquerianodesdk.sendErr)(`\n=== For ${sourceFile} ===`);
226
- (0, $kQNfl$taquerianodesdk.sendErr)(err.message.replace(/Command failed.+?\n/, ""));
234
+ (0, $844cb58d66fbf6db$export$b59ff90dc389ce6d)(err, sourceFile);
227
235
  return {
228
236
  contract: sourceFile,
229
237
  artifact: $24b2f47d8f306cb3$var$COMPILE_ERR_MSG
230
238
  };
231
239
  });
232
- const $24b2f47d8f306cb3$var$compileExprs = (parsedArgs, sourceFile, exprKind)=>(0, $kQNfl$fspromises.readFile)((0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile), "utf8").then(async (data)=>{
233
- if (!data.includes("#include")) await (0, $kQNfl$fspromises.writeFile)((0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile), `#include "${$24b2f47d8f306cb3$var$getContractNameForExpr(sourceFile, exprKind)}"\n` + data, "utf8");
234
- return data;
235
- }).then((data)=>data.match(/(?<=\s*(let|const)\s+)[a-zA-Z0-9_]+/g)).then((exprNames)=>{
236
- if (!exprNames) return [];
240
+ const $24b2f47d8f306cb3$var$getExprNames = (parsedArgs, sourceFile)=>(0, $kQNfl$fspromises.readFile)((0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile), "utf8").then((data)=>data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
241
+ const $24b2f47d8f306cb3$var$compileExprs = (parsedArgs, sourceFile, exprKind)=>$24b2f47d8f306cb3$var$getExprNames(parsedArgs, sourceFile).then((exprNames)=>{
242
+ if (exprNames.length === 0) return [];
237
243
  const firstExprName = exprNames.slice(0, 1)[0];
238
244
  const restExprNames = exprNames.slice(1, exprNames.length);
239
245
  const firstExprKind = $24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "default_storage" : "parameter";
@@ -244,33 +250,70 @@ const $24b2f47d8f306cb3$var$compileExprs = (parsedArgs, sourceFile, exprKind)=>(
244
250
  firstExprResult
245
251
  ].concat(restExprResults));
246
252
  }).catch((err)=>{
247
- (0, $kQNfl$taquerianodesdk.sendErr)(`\n=== For ${sourceFile} ===`);
248
- (0, $kQNfl$taquerianodesdk.sendErr)(err.message);
253
+ (0, $844cb58d66fbf6db$export$b59ff90dc389ce6d)(err, sourceFile);
249
254
  return [
250
255
  {
251
256
  contract: sourceFile,
252
- artifact: `No ${$24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "storages" : "parameters"} compiled`
257
+ artifact: `No ${$24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "storage" : "parameter"} values compiled`
253
258
  }
254
259
  ];
255
260
  }).then($24b2f47d8f306cb3$var$mergeArtifactsOutput(sourceFile));
261
+ // TODO: Just for backwards compatibility. Can be deleted in the future.
262
+ const $24b2f47d8f306cb3$var$tryLegacyStorageNamingConvention = (parsedArgs, sourceFile)=>{
263
+ const storageListFile = `${$24b2f47d8f306cb3$var$removeExt(sourceFile)}.storages${$24b2f47d8f306cb3$var$extractExt(sourceFile)}`;
264
+ const storageListFilename = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, storageListFile);
265
+ return (0, $kQNfl$fspromises.access)(storageListFilename).then(()=>{
266
+ (0, $kQNfl$taquerianodesdk.sendWarn)(`Warning: The naming convention of "<CONTRACT>.storages.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.storageList.<EXTENSION>". Please adjust your storage file names accordingly\n`);
267
+ return $24b2f47d8f306cb3$var$compileExprs(parsedArgs, storageListFile, "storage");
268
+ });
269
+ };
270
+ // TODO: Just for backwards compatibility. Can be deleted in the future.
271
+ const $24b2f47d8f306cb3$var$tryLegacyParameterNamingConvention = (parsedArgs, sourceFile)=>{
272
+ const parameterListFile = `${$24b2f47d8f306cb3$var$removeExt(sourceFile)}.parameters${$24b2f47d8f306cb3$var$extractExt(sourceFile)}`;
273
+ const parameterListFilename = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, parameterListFile);
274
+ return (0, $kQNfl$fspromises.access)(parameterListFilename).then(()=>{
275
+ (0, $kQNfl$taquerianodesdk.sendWarn)(`Warning: The naming convention of "<CONTRACT>.parameters.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.parameterList.<EXTENSION>". Please adjust your parameter file names accordingly\n`);
276
+ return $24b2f47d8f306cb3$var$compileExprs(parsedArgs, parameterListFile, "parameter");
277
+ });
278
+ };
279
+ const $24b2f47d8f306cb3$var$initContentForStorage = (sourceFile)=>{
280
+ const linkToContract = `#include "${sourceFile}"\n\n`;
281
+ const instruction = "// 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";
282
+ const ext = $24b2f47d8f306cb3$var$extractExt(sourceFile);
283
+ let syntax = "";
284
+ if (ext === ".ligo") syntax = "// E.g. const aStorageValue : aStorageType = 10;\n\n";
285
+ else if (ext === ".religo") syntax = "// E.g. let aStorageValue : aStorageType = 10;\n\n";
286
+ else if (ext === ".mligo") syntax = "// E.g. let aStorageValue : aStorageType = 10\n\n";
287
+ else if (ext === ".jsligo") syntax = "// E.g. const aStorageValue : aStorageType = 10;\n\n";
288
+ return linkToContract + instruction + syntax;
289
+ };
290
+ const $24b2f47d8f306cb3$var$initContentForParameter = (sourceFile)=>{
291
+ const linkToContract = `#include "${sourceFile}"\n\n`;
292
+ const instruction = "// Define your parameter values as a list of LIGO variable definitions\n";
293
+ const ext = $24b2f47d8f306cb3$var$extractExt(sourceFile);
294
+ let syntax = "";
295
+ if (ext === ".ligo") syntax = "// E.g. const aParameterValue : aParameterType = Increment(1);\n\n";
296
+ else if (ext === ".religo") syntax = "// E.g. let aParameterValue : aParameterType = (Increment (1));\n\n";
297
+ else if (ext === ".mligo") syntax = "// E.g. let aParameterValue : aParameterType = Increment 1\n\n";
298
+ else if (ext === ".jsligo") syntax = "// E.g. const aParameterValue : aParameterType = (Increment (1));\n\n";
299
+ return linkToContract + instruction + syntax;
300
+ };
256
301
  const $24b2f47d8f306cb3$var$compileContractWithStorageAndParameter = async (parsedArgs, sourceFile)=>{
257
302
  const contractCompileResult = await $24b2f47d8f306cb3$var$compileContract(parsedArgs, sourceFile);
258
303
  if (contractCompileResult.artifact === $24b2f47d8f306cb3$var$COMPILE_ERR_MSG) return [
259
304
  contractCompileResult
260
305
  ];
261
- const storagesFile = `${$24b2f47d8f306cb3$var$removeExt(sourceFile)}.storages${$24b2f47d8f306cb3$var$extractExt(sourceFile)}`;
262
- const parametersFile = `${$24b2f47d8f306cb3$var$removeExt(sourceFile)}.parameters${$24b2f47d8f306cb3$var$extractExt(sourceFile)}`;
263
- const storagesFilename = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, storagesFile);
264
- const parametersFilename = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, parametersFile);
265
- const storageCompileResult = await (0, $kQNfl$fspromises.access)(storagesFilename).then(()=>$24b2f47d8f306cb3$var$compileExprs(parsedArgs, storagesFile, "storage")).catch(()=>{
266
- // sendWarn(
267
- // `Note: storage file associated with "${sourceFile}" can't be found. You should create a file "${storagesFile}" and define initial storage values as a list of LIGO variable definitions. e.g. "let STORAGE_NAME: storage = LIGO_EXPR" for CameLigo`,
268
- // )
306
+ const storageListFile = `${$24b2f47d8f306cb3$var$removeExt(sourceFile)}.storageList${$24b2f47d8f306cb3$var$extractExt(sourceFile)}`;
307
+ const storageListFilename = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, storageListFile);
308
+ const storageCompileResult = await (0, $kQNfl$fspromises.access)(storageListFilename).then(()=>$24b2f47d8f306cb3$var$compileExprs(parsedArgs, storageListFile, "storage")).catch(()=>$24b2f47d8f306cb3$var$tryLegacyStorageNamingConvention(parsedArgs, sourceFile)).catch(()=>{
309
+ (0, $kQNfl$taquerianodesdk.sendWarn)(`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`);
310
+ (0, $kQNfl$fspromises.writeFile)(storageListFilename, $24b2f47d8f306cb3$var$initContentForStorage(sourceFile), "utf8");
269
311
  });
270
- const parameterCompileResult = await (0, $kQNfl$fspromises.access)(parametersFilename).then(()=>$24b2f47d8f306cb3$var$compileExprs(parsedArgs, parametersFile, "parameter")).catch(()=>{
271
- // sendWarn(
272
- // `Note: parameter file associated with "${sourceFile}" can't be found. You should create a file "${parametersFile}" and define parameter values as a list of LIGO variable definitions. e.g. "let PARAMETER_NAME: parameter = LIGO_EXPR" for CameLigo`,
273
- // )
312
+ const parameterListFile = `${$24b2f47d8f306cb3$var$removeExt(sourceFile)}.parameterList${$24b2f47d8f306cb3$var$extractExt(sourceFile)}`;
313
+ const parameterListFilename = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, parameterListFile);
314
+ const parameterCompileResult = await (0, $kQNfl$fspromises.access)(parameterListFilename).then(()=>$24b2f47d8f306cb3$var$compileExprs(parsedArgs, parameterListFile, "parameter")).catch(()=>$24b2f47d8f306cb3$var$tryLegacyParameterNamingConvention(parsedArgs, sourceFile)).catch(()=>{
315
+ (0, $kQNfl$taquerianodesdk.sendWarn)(`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`);
316
+ (0, $kQNfl$fspromises.writeFile)(parameterListFilename, $24b2f47d8f306cb3$var$initContentForParameter(sourceFile), "utf8");
274
317
  });
275
318
  let compileResults = [
276
319
  contractCompileResult
@@ -284,20 +327,20 @@ Compiling storage/parameter file amounts to compiling multiple expressions in th
284
327
  resulting in multiple rows with the same file name but different artifact names.
285
328
  This will merge these rows into one row with just one mention of the file name.
286
329
  e.g.
287
- ┌──────────────────────┬─────────────────────────────────────────────┐
288
- │ Contract │ Artifact │
289
- ├──────────────────────┼─────────────────────────────────────────────┤
290
- │ hello.storages.mligo │ artifacts/hello.default_storage.storage1.tz │
291
- ├──────────────────────┼─────────────────────────────────────────────┤
292
- │ hello.storages.mligo │ artifacts/hello.storage.storage2.tz │
293
- └──────────────────────┴─────────────────────────────────────────────┘
330
+ ┌─────────────────────────┬─────────────────────────────────────────────┐
331
+ │ Contract │ Artifact │
332
+ ├─────────────────────────┼─────────────────────────────────────────────┤
333
+ │ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │
334
+ ├─────────────────────────┼─────────────────────────────────────────────┤
335
+ │ hello.storageList.mligo │ artifacts/hello.storage.storage2.tz │
336
+ └─────────────────────────┴─────────────────────────────────────────────┘
294
337
  versus
295
- ┌──────────────────────┬─────────────────────────────────────────────┐
296
- │ Contract │ Artifact │
297
- ├──────────────────────┼─────────────────────────────────────────────┤
298
- │ hello.storages.mligo │ artifacts/hello.default_storage.storage1.tz │
299
- │ artifacts/hello.storage.storage2.tz │
300
- └──────────────────────┴─────────────────────────────────────────────┘
338
+ ┌─────────────────────────┬─────────────────────────────────────────────┐
339
+ │ Contract │ Artifact │
340
+ ├─────────────────────────┼─────────────────────────────────────────────┤
341
+ │ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │
342
+ │ artifacts/hello.storage.storage2.tz │
343
+ └─────────────────────────┴─────────────────────────────────────────────┘
301
344
  */ const $24b2f47d8f306cb3$var$mergeArtifactsOutput = (sourceFile)=>(tableRows)=>{
302
345
  const artifactsOutput = tableRows.reduce((acc, row)=>row.artifact === $24b2f47d8f306cb3$var$COMPILE_ERR_MSG ? acc : `${acc}${row.artifact}\n`, "");
303
346
  return [
@@ -310,8 +353,8 @@ e.g.
310
353
  const $24b2f47d8f306cb3$var$compile = (parsedArgs)=>{
311
354
  const sourceFile = parsedArgs.sourceFile;
312
355
  let p;
313
- if ($24b2f47d8f306cb3$var$isStoragesFile(sourceFile)) p = $24b2f47d8f306cb3$var$compileExprs(parsedArgs, sourceFile, "storage");
314
- else if ($24b2f47d8f306cb3$var$isParametersFile(sourceFile)) p = $24b2f47d8f306cb3$var$compileExprs(parsedArgs, sourceFile, "parameter");
356
+ if ($24b2f47d8f306cb3$var$isStorageListFile(sourceFile)) p = $24b2f47d8f306cb3$var$compileExprs(parsedArgs, sourceFile, "storage");
357
+ else if ($24b2f47d8f306cb3$var$isParameterListFile(sourceFile)) p = $24b2f47d8f306cb3$var$compileExprs(parsedArgs, sourceFile, "parameter");
315
358
  else if ($24b2f47d8f306cb3$var$isContractFile(sourceFile)) p = $24b2f47d8f306cb3$var$compileContractWithStorageAndParameter(parsedArgs, sourceFile);
316
359
  else return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`);
317
360
  return p.then((0, $kQNfl$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $kQNfl$taquerianodesdk.sendAsyncErr)(err, false));
@@ -332,7 +375,7 @@ const $0be740342372c80a$var$getArbitraryLigoCmd = (parsedArgs, userArgs)=>{
332
375
  `${projectDir}:/project`,
333
376
  "-w",
334
377
  "/project",
335
- (0, $844cb58d66fbf6db$export$9bb5edf1683d4462)
378
+ (0, $844cb58d66fbf6db$export$2b403d61ac8ea302)()
336
379
  ];
337
380
  const processedUserArgs = userArgs.split(" ").map((arg)=>arg.startsWith("\\-") ? arg.substring(1) : arg).filter((arg)=>arg);
338
381
  const args = baseArgs.concat(processedUserArgs);
@@ -358,7 +401,7 @@ var $0be740342372c80a$export$2e2bcd8739ae039 = $0be740342372c80a$var$ligo;
358
401
  const $8d09eb70c0505719$var$getTestContractCmd = (parsedArgs, sourceFile)=>{
359
402
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
360
403
  if (!projectDir) throw `No project directory provided`;
361
- const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$9bb5edf1683d4462)} run test`;
404
+ const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${(0, $844cb58d66fbf6db$export$2b403d61ac8ea302)()} run test`;
362
405
  const inputFile = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, sourceFile);
363
406
  const cmd = `${baseCmd} ${inputFile}`;
364
407
  return cmd;
@@ -371,8 +414,7 @@ const $8d09eb70c0505719$var$testContract = (parsedArgs, sourceFile)=>(0, $kQNfl$
371
414
  testResults: stdout.length > 0 ? `${stdout}\n${result}` : result
372
415
  };
373
416
  }).catch((err)=>{
374
- (0, $kQNfl$taquerianodesdk.sendErr)(`\n=== For ${sourceFile} ===`);
375
- (0, $kQNfl$taquerianodesdk.sendErr)(err.message.replace(/Command failed.+?\n/, ""));
417
+ (0, $844cb58d66fbf6db$export$b59ff90dc389ce6d)(err, sourceFile);
376
418
  return {
377
419
  contract: sourceFile,
378
420
  testResults: "Some tests failed :("
@@ -395,6 +437,8 @@ const $9c25a106900e330c$var$main = (parsedArgs)=>{
395
437
  return (0, $24b2f47d8f306cb3$export$2e2bcd8739ae039)(parsedArgs);
396
438
  case "test":
397
439
  return (0, $8d09eb70c0505719$export$2e2bcd8739ae039)(parsedArgs);
440
+ case "get-image":
441
+ return (0, $kQNfl$taquerianodesdk.sendAsyncRes)((0, $844cb58d66fbf6db$export$2b403d61ac8ea302)());
398
442
  default:
399
443
  return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`${parsedArgs.task} is not an understood task by the LIGO plugin`);
400
444
  }
@@ -430,7 +474,7 @@ var $9c25a106900e330c$export$2e2bcd8739ae039 = $9c25a106900e330c$var$main;
430
474
  "c",
431
475
  "compile-ligo"
432
476
  ],
433
- description: "Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storages and parameters files if they are found",
477
+ 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",
434
478
  handler: "proxy",
435
479
  encoding: "json"
436
480
  }),
@@ -440,6 +484,13 @@ var $9c25a106900e330c$export$2e2bcd8739ae039 = $9c25a106900e330c$var$main;
440
484
  description: "Test a smart contract written in LIGO",
441
485
  handler: "proxy",
442
486
  encoding: "json"
487
+ }),
488
+ (0, $kQNfl$taquerianodesdk.Task).create({
489
+ task: "get-image",
490
+ command: "get-image",
491
+ description: "Gets the name of the image to be used",
492
+ handler: "proxy",
493
+ hidden: true
443
494
  }),
444
495
  ],
445
496
  templates: [
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;ACAA;;ACAO,MAAM,yCAAc,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAwB/B,CAAC,AAAC;AAEK,MAAM,yCAAkB,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BnC,CAAC,AAAC;AAEK,MAAM,yCAAe,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBhC,CAAC,AAAC;AAEK,MAAM,yCAAe,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBhC,CAAC,AAAC;;;ADlGF,MAAM,sCAAgB,GAAG,CAAC,GAAS,EAAE,YAAoB,GAAK;IAC7D,CAAA,GAAA,mCAAY,CAAA,CAAC,gBAAgB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;CACjD,AAAC;AAEF,MAAM,qCAAe,GAAG,OAAO,YAAoB,EAAE,MAA0B,GAAsB;IACpG,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,YAAY,AAAC;IACnD,MAAM,GAAG,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,AAAC;IAE7D,IAAI,MAAM,KAAK,OAAO,EAAE,OAAO,GAAA,yCAAc,CAAC;IAC9C,IAAI,MAAM,KAAK,MAAM,EAAE,OAAO,GAAA,yCAAkB,CAAC;IACjD,IAAI,MAAM,KAAK,QAAQ,EAAE,OAAO,GAAA,yCAAe,CAAC;IAChD,IAAI,MAAM,KAAK,QAAQ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CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,mBAAmB;gBAC5B,WAAW,EAAE,uCAAuC;gBACpD,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;aAChB,CAAC;SACF;QACD,SAAS,EAAE;YACV,CAAA,GAAA,+BAAQ,CAAA,CAAC,MAAM,CAAC;gBACf,QAAQ,EAAE,UAAU;gBACpB,OAAO,EAAE,2BAA2B;gBACpC,WAAW,EAAE,8CAA8C;gBAC3D,WAAW,EAAE;oBACZ,CAAA,GAAA,oCAAa,CAAA,CAAC,MAAM,CAAC;wBACpB,WAAW,EAAE,gBAAgB;wBAC7B,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,2CAA2C;qBACxD,CAAC;iBACF;gBACD,OAAO,EAAE;oBACR,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iCAAiC;qBAC9C,CAAC;iBACF;gBACD,OAAO,EAAE,CAAA,GAAA,wCAAc,CAAA;aACvB,CAAC;SACF;QACD,KAAK,EAAE,CAAA,GAAA,wCAAI,CAAA;KACX,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/createContract.ts","taqueria-plugin-ligo/ligo_templates.ts","taqueria-plugin-ligo/main.ts","taqueria-plugin-ligo/compile.ts","taqueria-plugin-ligo/common.ts","taqueria-plugin-ligo/ligo.ts","taqueria-plugin-ligo/test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storages and parameters files if they are found',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: main,\n}), process.argv);\n","import { experimental, sendAsyncErr } from '@taqueria/node-sdk';\nimport * as RequestArgs from '@taqueria/protocol/RequestArgs';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template, pascaligo_template, religo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst registerContract = (arg: Opts, contractName: string) => {\n\texperimental.registerContract(arg, contractName);\n};\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === 'ligo') return pascaligo_template;\n\tif (syntax === 'religo') return religo_template;\n\tif (syntax === 'jsligo') return jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return mligo_template;\n\t\tif (ext === 'ligo') return pascaligo_template;\n\t\tif (ext === 'religo') return religo_template;\n\t\tif (ext === 'jsligo') return jsligo_template;\n\t\treturn sendAsyncErr(\n\t\t\t`Unable to infer LIGO syntax from \"${contractName}\". Please specify a LIGO syntax via the --syntax option`,\n\t\t);\n\t} else {\n\t\treturn sendAsyncErr(`\"${syntax}\" is not a valid syntax. Please specify a valid LIGO syntax`);\n\t}\n};\n\nconst createContract = (arg: Opts) => {\n\tconst contractName = arg.sourceFileName as string;\n\tconst syntax = arg.syntax;\n\tconst contractsDir = `${arg.config.projectDir}/${arg.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template))\n\t\t.then(_ => registerContract(arg, contractName));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\n\ntype parameter =\n Increment of int\n| Decrement of int\n| Reset\n\ntype return = operation list * storage\n\n// Two entrypoints\n\nlet add (store, delta : storage * int) : storage = store + delta\nlet sub (store, delta : storage * int) : storage = store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nlet main (action, store : parameter * storage) : return =\n ([] : operation list), // No operations\n (match action with\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0)\n`;\n\nexport const pascaligo_template = `\ntype storage is int\n\ntype parameter is\n Increment of int\n| Decrement of int\n| Reset\n\ntype return is list (operation) * storage\n\n// Two entrypoints\n\nfunction add (const store : storage; const delta : int) : storage is \n store + delta\n\nfunction sub (const store : storage; const delta : int) : storage is \n store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nfunction main (const action : parameter; const store : storage) : return is\n ((nil : list (operation)), // No operations\n case action of [\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0\n ])\n`;\n\nexport const religo_template = `\ntype storage = int;\n\ntype parameter =\n Increment (int)\n| Decrement (int)\n| Reset;\n\ntype return = (list (operation), storage);\n\n// Two entrypoints\n\nlet add = ((store, delta) : (storage, int)) : storage => store + delta;\nlet sub = ((store, delta) : (storage, int)) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n \nlet main = ((action, store) : (parameter, storage)) : return => {\n (([] : list (operation)), // No operations\n (switch (action) {\n | Increment (n) => add ((store, n))\n | Decrement (n) => sub ((store, n))\n | Reset => 0}))\n};\n`;\n\nexport const jsligo_template = `\ntype storage = int;\n\ntype parameter =\n [\"Increment\", int]\n| [\"Decrement\", int]\n| [\"Reset\"];\n\ntype ret = [list<operation>, storage];\n\n// Two entrypoints\n\nconst add = ([store, delta] : [storage, int]) : storage => store + delta;\nconst sub = ([store, delta] : [storage, int]) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n\nconst main = ([action, store] : [parameter, storage]) : ret => {\n return [list([]) as list<operation>, // No operations\n match (action, {\n Increment:(n: int) => add ([store, n]),\n Decrement:(n: int) => sub ([store, n]),\n Reset :() => 0})]\n};\n`;\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: Opts): Promise<void> => {\n\tswitch (parsedArgs.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(parsedArgs);\n\t\tcase 'compile':\n\t\t\treturn compile(parsedArgs);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${parsedArgs.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default main;\n","import { execCmd, getArch, 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, getInputFilename, LIGO_DOCKER_IMAGE } from './common';\n\ntype TableRow = { contract: string; artifact: string };\n\ntype ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nconst isLIGOFile = (sourceFile: string): boolean => /.+\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isStoragesFile = (sourceFile: string): boolean => /.+\\.storages\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isParametersFile = (sourceFile: string): boolean =>\n\t/.+\\.parameters\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isContractFile = (sourceFile: string): boolean =>\n\tisLIGOFile(sourceFile) && !isStoragesFile(sourceFile) && !isParametersFile(sourceFile);\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst getOutputFilename = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst outputFile = basename(sourceFile, extname(sourceFile));\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);\n};\n\n// Get the contract name that the storage/parameter file is associated with\n// e.g. If sourceFile is token.storages.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(/.+(?=\\.storages\\.(ligo|religo|mligo|jsligo))/)!.join('.')\n\t\t\t: sourceFile.match(/.+(?=\\.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.storages.mligo, then it'll return token.storage.{storageName}.tz\nconst getOutputExprFileName = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = basename(getContractNameForExpr(sourceFile, exprKind), extname(sourceFile));\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage.tz`\n\t\t: `${contractName}.${exprKind}.${exprName}.tz`;\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}`);\n};\n\nconst getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} compile contract`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputFilename(parsedArgs, sourceFile)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} compile ${compilerType}`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFileName(parsedArgs, sourceFile, exprKind, exprName)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;\n\treturn cmd;\n};\n\nconst compileContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getCompileContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: getOutputFilename(parsedArgs, sourceFile),\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\tsendErr(err.message.replace(/Command failed.+?\\n/, ''));\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\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\t\tsendErr(err.message.replace(/Command failed.+?\\n/, ''));\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t\t};\n\t\t\t});\n\nconst compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>\n\treadFile(getInputFilename(parsedArgs, sourceFile), 'utf8')\n\t\t.then(async data => {\n\t\t\tif (!data.includes('#include')) {\n\t\t\t\tawait writeFile(\n\t\t\t\t\tgetInputFilename(parsedArgs, sourceFile),\n\t\t\t\t\t`#include \"${getContractNameForExpr(sourceFile, exprKind)}\"\\n` + data,\n\t\t\t\t\t'utf8',\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn data;\n\t\t})\n\t\t.then(data => data.match(/(?<=\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g))\n\t\t.then(exprNames => {\n\t\t\tif (!exprNames) return [];\n\t\t\tconst firstExprName = exprNames.slice(0, 1)[0];\n\t\t\tconst restExprNames = exprNames.slice(1, exprNames.length);\n\t\t\tconst firstExprKind = isStorageKind(exprKind) ? 'default_storage' : 'parameter';\n\t\t\tconst restExprKind = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\t\t\tconst firstExprResult = compileExpr(parsedArgs, sourceFile, firstExprKind)(firstExprName);\n\t\t\tconst restExprResults = restExprNames.map(compileExpr(parsedArgs, sourceFile, restExprKind));\n\t\t\treturn Promise.all([firstExprResult].concat(restExprResults));\n\t\t})\n\t\t.catch(err => {\n\t\t\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\tsendErr(err.message);\n\t\t\treturn [{\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storages' : 'parameters'} compiled`,\n\t\t\t}];\n\t\t})\n\t\t.then(mergeArtifactsOutput(sourceFile));\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 storagesFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;\n\tconst parametersFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;\n\tconst storagesFilename = getInputFilename(parsedArgs, storagesFile);\n\tconst parametersFilename = getInputFilename(parsedArgs, parametersFile);\n\n\tconst storageCompileResult = await access(storagesFilename)\n\t\t.then(() => compileExprs(parsedArgs, storagesFile, 'storage'))\n\t\t.catch(() => {\n\t\t\t// sendWarn(\n\t\t\t// \t`Note: storage file associated with \"${sourceFile}\" can't be found. You should create a file \"${storagesFile}\" and define initial storage values as a list of LIGO variable definitions. e.g. \"let STORAGE_NAME: storage = LIGO_EXPR\" for CameLigo`,\n\t\t\t// )\n\t\t});\n\n\tconst parameterCompileResult = await access(parametersFilename)\n\t\t.then(() => compileExprs(parsedArgs, parametersFile, 'parameter'))\n\t\t.catch(() => {\n\t\t\t// sendWarn(\n\t\t\t// \t`Note: parameter file associated with \"${sourceFile}\" can't be found. You should create a file \"${parametersFile}\" and define parameter values as a list of LIGO variable definitions. e.g. \"let PARAMETER_NAME: parameter = LIGO_EXPR\" for CameLigo`,\n\t\t\t// )\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.storages.mligo │ artifacts/hello.default_storage.storage1.tz │\n├──────────────────────┼─────────────────────────────────────────────┤\n│ hello.storages.mligo │ artifacts/hello.storage.storage2.tz │\n└──────────────────────┴─────────────────────────────────────────────┘\n\t\t\t\t\t\t\t\tversus\n┌──────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├──────────────────────┼─────────────────────────────────────────────┤\n│ hello.storages.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 (isStoragesFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');\n\telse if (isParametersFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'parameter');\n\telse if (isContractFile(sourceFile)) p = compileContractWithStorageAndParameter(parsedArgs, sourceFile);\n\telse {\n\t\treturn sendAsyncErr(\n\t\t\t`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`,\n\t\t);\n\t}\n\treturn p.then(sendJsonRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n","import { RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends RequestArgs.ProxyRequestArgs {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport interface TestOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & TestOpts;\n\ntype UnionOpts = LigoOpts | CompileOpts | TestOpts;\n\n// Points to the latest stable version. Needs to update this as part of our release process\nexport const LIGO_DOCKER_IMAGE = 'ligolang/ligo:0.55.0';\n\nexport const getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir, sourceFile);\n","import { CmdArgEnv, getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { LIGO_DOCKER_IMAGE, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (parsedArgs: Opts, userArgs: string): CmdArgEnv => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst binary = 'docker';\n\tconst baseArgs = ['run', '--rm', '-v', `${projectDir}:/project`, '-w', '/project', LIGO_DOCKER_IMAGE];\n\tconst processedUserArgs = userArgs.split(' ').map(arg => arg.startsWith('\\\\-') ? arg.substring(1) : arg).filter(arg =>\n\t\targ\n\t);\n\tconst args = baseArgs.concat(processedUserArgs);\n\tconst envVars = { 'DOCKER_DEFAULT_PLATFORM': 'linux/amd64' };\n\treturn [binary, args, envVars];\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tgetArch()\n\t\t.then(() => getArbitraryLigoCmd(parsedArgs, cmd))\n\t\t.then(spawnCmd)\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { getInputFilename, LIGO_DOCKER_IMAGE, 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) ${LIGO_DOCKER_IMAGE} 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\tsendErr(`\\n=== For ${sourceFile} ===`);\n\t\t\tsendErr(err.message.replace(/Command failed.+?\\n/, ''));\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nconst test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
1
+ {"mappings":";;;;AAAA;ACAA;;ACAO,MAAM,yCAAc,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAwB/B,CAAC,AAAC;AAEK,MAAM,yCA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gBACpD,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;aAChB,CAAC;YACF,CAAA,GAAA,2BAAI,CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,WAAW;gBACpB,WAAW,EAAE,uCAAuC;gBACpD,OAAO,EAAE,OAAO;gBAChB,MAAM,EAAE,IAAI;aACZ,CAAC;SACF;QACD,SAAS,EAAE;YACV,CAAA,GAAA,+BAAQ,CAAA,CAAC,MAAM,CAAC;gBACf,QAAQ,EAAE,UAAU;gBACpB,OAAO,EAAE,2BAA2B;gBACpC,WAAW,EAAE,8CAA8C;gBAC3D,WAAW,EAAE;oBACZ,CAAA,GAAA,oCAAa,CAAA,CAAC,MAAM,CAAC;wBACpB,WAAW,EAAE,gBAAgB;wBAC7B,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,2CAA2C;qBACxD,CAAC;iBACF;gBACD,OAAO,EAAE;oBACR,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iCAAiC;qBAC9C,CAAC;iBACF;gBACD,OAAO,EAAE,CAAA,GAAA,wCAAc,CAAA;aACvB,CAAC;SACF;QACD,KAAK,EAAE,CAAA,GAAA,wCAAI,CAAA;KACX,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/createContract.ts","taqueria-plugin-ligo/ligo_templates.ts","taqueria-plugin-ligo/main.ts","taqueria-plugin-ligo/common.ts","taqueria-plugin-ligo/compile.ts","taqueria-plugin-ligo/ligo.ts","taqueria-plugin-ligo/test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport createContract from './createContract';\nimport main from './main';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'ligo',\n\t\t\tcommand: 'ligo',\n\t\t\tdescription:\n\t\t\t\t'This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\tflag: 'command',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\trequired: true,\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'none',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile <sourceFile>',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription:\n\t\t\t\t'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'test',\n\t\t\tcommand: 'test <sourceFile>',\n\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t\tTask.create({\n\t\t\ttask: 'get-image',\n\t\t\tcommand: 'get-image',\n\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\thandler: 'proxy',\n\t\t\thidden: true,\n\t\t}),\n\t],\n\ttemplates: [\n\t\tTemplate.create({\n\t\t\ttemplate: 'contract',\n\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\tpositionals: [\n\t\t\t\tPositionalArg.create({\n\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t}),\n\t\t\t],\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: createContract,\n\t\t}),\n\t],\n\tproxy: main,\n}), process.argv);\n","import { experimental, sendAsyncErr } from '@taqueria/node-sdk';\nimport * as RequestArgs from '@taqueria/protocol/RequestArgs';\nimport { writeFile } from 'fs/promises';\nimport { jsligo_template, mligo_template, pascaligo_template, religo_template } from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst registerContract = (arg: Opts, contractName: string) => {\n\texperimental.registerContract(arg, contractName);\n};\n\nconst getLigoTemplate = async (contractName: string, syntax: string | undefined): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\n\tif (syntax === 'mligo') return mligo_template;\n\tif (syntax === 'ligo') return pascaligo_template;\n\tif (syntax === 'religo') return religo_template;\n\tif (syntax === 'jsligo') return jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return mligo_template;\n\t\tif (ext === 'ligo') return pascaligo_template;\n\t\tif (ext === 'religo') return religo_template;\n\t\tif (ext === 'jsligo') return jsligo_template;\n\t\treturn sendAsyncErr(\n\t\t\t`Unable to infer LIGO syntax from \"${contractName}\". Please specify a LIGO syntax via the --syntax option`,\n\t\t);\n\t} else {\n\t\treturn sendAsyncErr(`\"${syntax}\" is not a valid syntax. Please specify a valid LIGO syntax`);\n\t}\n};\n\nconst createContract = (arg: Opts) => {\n\tconst contractName = arg.sourceFileName as string;\n\tconst syntax = arg.syntax;\n\tconst contractsDir = `${arg.config.projectDir}/${arg.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template))\n\t\t.then(_ => registerContract(arg, contractName));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\n\ntype parameter =\n Increment of int\n| Decrement of int\n| Reset\n\ntype return = operation list * storage\n\n// Two entrypoints\n\nlet add (store, delta : storage * int) : storage = store + delta\nlet sub (store, delta : storage * int) : storage = store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nlet main (action, store : parameter * storage) : return =\n ([] : operation list), // No operations\n (match action with\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0)\n`;\n\nexport const pascaligo_template = `\ntype storage is int\n\ntype parameter is\n Increment of int\n| Decrement of int\n| Reset\n\ntype return is list (operation) * storage\n\n// Two entrypoints\n\nfunction add (const store : storage; const delta : int) : storage is \n store + delta\n\nfunction sub (const store : storage; const delta : int) : storage is \n store - delta\n\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\n \nfunction main (const action : parameter; const store : storage) : return is\n ((nil : list (operation)), // No operations\n case action of [\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0\n ])\n`;\n\nexport const religo_template = `\ntype storage = int;\n\ntype parameter =\n Increment (int)\n| Decrement (int)\n| Reset;\n\ntype return = (list (operation), storage);\n\n// Two entrypoints\n\nlet add = ((store, delta) : (storage, int)) : storage => store + delta;\nlet sub = ((store, delta) : (storage, int)) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n \nlet main = ((action, store) : (parameter, storage)) : return => {\n (([] : list (operation)), // No operations\n (switch (action) {\n | Increment (n) => add ((store, n))\n | Decrement (n) => sub ((store, n))\n | Reset => 0}))\n};\n`;\n\nexport const jsligo_template = `\ntype storage = int;\n\ntype parameter =\n [\"Increment\", int]\n| [\"Decrement\", int]\n| [\"Reset\"];\n\ntype ret = [list<operation>, storage];\n\n// Two entrypoints\n\nconst add = ([store, delta] : [storage, int]) : storage => store + delta;\nconst sub = ([store, delta] : [storage, int]) : storage => store - delta;\n\n/* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. */\n\nconst main = ([action, store] : [parameter, storage]) : ret => {\n return [list([]) as list<operation>, // No operations\n match (action, {\n Increment:(n: int) => add ([store, n]),\n Decrement:(n: int) => sub ([store, n]),\n Reset :() => 0})]\n};\n`;\n","import { sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main = (parsedArgs: Opts): Promise<void> => {\n\tswitch (parsedArgs.task) {\n\t\tcase 'ligo':\n\t\t\treturn ligo(parsedArgs);\n\t\tcase 'compile':\n\t\t\treturn compile(parsedArgs);\n\t\tcase 'test':\n\t\t\treturn test(parsedArgs);\n\t\tcase 'get-image':\n\t\t\treturn sendAsyncRes(getLigoDockerImage());\n\t\tdefault:\n\t\t\treturn sendAsyncErr(`${parsedArgs.task} is not an understood task by the LIGO plugin`);\n\t}\n};\n\nexport default main;\n","import { getDockerImage, sendErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk/types';\nimport { join } from 'path';\n\nexport interface LigoOpts extends RequestArgs.ProxyRequestArgs {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport interface TestOpts extends RequestArgs.ProxyRequestArgs {\n\tsourceFile: string;\n}\n\nexport type IntersectionOpts = LigoOpts & CompileOpts & TestOpts;\n\ntype UnionOpts = LigoOpts | CompileOpts | TestOpts;\n\n// Should point to the latest stable version, so it needs to be updated as part of our release process.\nconst LIGO_DEFAULT_IMAGE = 'ligolang/ligo:0.54.1';\n\nconst LIGO_IMAGE_ENV_VAR = 'TAQ_LIGO_IMAGE';\n\nexport const getLigoDockerImage = (): string => getDockerImage(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);\n\nexport const getInputFilename = (parsedArgs: UnionOpts, sourceFile: string): string =>\n\tjoin(parsedArgs.config.contractsDir, sourceFile);\n\nexport const emitExternalError = (err: unknown, sourceFile: string): void => {\n\tsendErr(`\\n=== Error messages for ${sourceFile} ===`);\n\terr instanceof Error ? sendErr(err.message.replace(/Command failed.+?\\n/, '')) : sendErr(err as any);\n\tsendErr(`\\n===`);\n};\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport { CompileOpts as Opts, emitExternalError, getInputFilename, getLigoDockerImage } from './common';\n\ntype TableRow = { contract: string; artifact: string };\n\ntype ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nconst isLIGOFile = (sourceFile: string): boolean => /.+\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isStorageListFile = (sourceFile: string): boolean =>\n\t/.+\\.(storageList|storages)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isParameterListFile = (sourceFile: string): boolean =>\n\t/.+\\.(parameterList|parameters)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nconst isContractFile = (sourceFile: string): boolean =>\n\tisLIGOFile(sourceFile) && !isStorageListFile(sourceFile) && !isParameterListFile(sourceFile);\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst getOutputContractFilename = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst outputFile = basename(sourceFile, extname(sourceFile));\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}.tz`);\n};\n\n// Get the contract name that the storage/parameter file is associated with\n// e.g. If sourceFile is token.storageList.mligo, then it'll return token.mligo\nconst getContractNameForExpr = (sourceFile: string, exprKind: ExprKind): string => {\n\ttry {\n\t\treturn isStorageKind(exprKind)\n\t\t\t? sourceFile.match(/.+(?=\\.(?:storageList|storages)\\.(ligo|religo|mligo|jsligo))/)!.join('.')\n\t\t\t: sourceFile.match(/.+(?=\\.(?:parameterList|parameters)\\.(ligo|religo|mligo|jsligo))/)!.join('.');\n\t} catch (err) {\n\t\tthrow new Error(`Something went wrong internally when dealing with filename format: ${err}`);\n\t}\n};\n\n// If sourceFile is token.storageList.mligo, then it'll return token.storage.{storageName}.tz\nconst getOutputExprFilename = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst contractName = basename(getContractNameForExpr(sourceFile, exprKind), extname(sourceFile));\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage.tz`\n\t\t: `${contractName}.${exprKind}.${exprName}.tz`;\n\treturn join(parsedArgs.config.artifactsDir, `${outputFile}`);\n};\n\nconst getCompileContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputContractFilename(parsedArgs, sourceFile)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${outputFile}`;\n\treturn cmd;\n};\n\nconst getCompileExprCmd = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind, exprName: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst outputFile = `-o ${getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;\n\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile}`;\n\treturn cmd;\n};\n\nconst compileContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getCompileContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: getOutputContractFilename(parsedArgs, sourceFile),\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t};\n\t\t});\n\nconst compileExpr = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind) =>\n\t(exprName: string): Promise<TableRow> =>\n\t\tgetArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, exprKind, exprName))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => {\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\temitExternalError(err, sourceFile);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t\t};\n\t\t\t});\n\nconst getExprNames = (parsedArgs: Opts, sourceFile: string): Promise<string[]> =>\n\treadFile(getInputFilename(parsedArgs, sourceFile), 'utf8')\n\t\t.then(data => data.match(/(?<=\\n\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g) ?? []);\n\nconst compileExprs = (parsedArgs: Opts, sourceFile: string, exprKind: ExprKind): Promise<TableRow[]> =>\n\tgetExprNames(parsedArgs, sourceFile)\n\t\t.then(exprNames => {\n\t\t\tif (exprNames.length === 0) return [];\n\t\t\tconst firstExprName = exprNames.slice(0, 1)[0];\n\t\t\tconst restExprNames = exprNames.slice(1, exprNames.length);\n\t\t\tconst firstExprKind = isStorageKind(exprKind) ? 'default_storage' : 'parameter';\n\t\t\tconst restExprKind = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\t\t\tconst firstExprResult = compileExpr(parsedArgs, sourceFile, firstExprKind)(firstExprName);\n\t\t\tconst restExprResults = restExprNames.map(compileExpr(parsedArgs, sourceFile, restExprKind));\n\t\t\treturn Promise.all([firstExprResult].concat(restExprResults));\n\t\t})\n\t\t.catch(err => {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn [{\n\t\t\t\tcontract: sourceFile,\n\t\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} values compiled`,\n\t\t\t}];\n\t\t})\n\t\t.then(mergeArtifactsOutput(sourceFile));\n\n// TODO: Just for backwards compatibility. Can be deleted in the future.\nconst tryLegacyStorageNamingConvention = (parsedArgs: Opts, sourceFile: string) => {\n\tconst storageListFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilename(parsedArgs, storageListFile);\n\treturn access(storageListFilename).then(() => {\n\t\tsendWarn(\n\t\t\t`Warning: The naming convention of \"<CONTRACT>.storages.<EXTENSION>\" is deprecated and renamed to \"<CONTRACT>.storageList.<EXTENSION>\". Please adjust your storage file names accordingly\\n`,\n\t\t);\n\t\treturn compileExprs(parsedArgs, storageListFile, 'storage');\n\t});\n};\n\n// TODO: Just for backwards compatibility. Can be deleted in the future.\nconst tryLegacyParameterNamingConvention = (parsedArgs: Opts, sourceFile: string) => {\n\tconst parameterListFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilename(parsedArgs, parameterListFile);\n\treturn access(parameterListFilename).then(() => {\n\t\tsendWarn(\n\t\t\t`Warning: The naming convention of \"<CONTRACT>.parameters.<EXTENSION>\" is deprecated and renamed to \"<CONTRACT>.parameterList.<EXTENSION>\". Please adjust your parameter file names accordingly\\n`,\n\t\t);\n\t\treturn compileExprs(parsedArgs, parameterListFile, 'parameter');\n\t});\n};\n\nconst initContentForStorage = (sourceFile: string): string => {\n\tconst linkToContract = `#include \"${sourceFile}\"\\n\\n`;\n\n\tconst instruction =\n\t\t'// Define your initial storage values as a list of LIGO variable definitions,\\n// the first of which will be considered the default value to be used for origination later on\\n';\n\n\tconst ext = extractExt(sourceFile);\n\tlet syntax = '';\n\tif (ext === '.ligo') syntax = '// E.g. const aStorageValue : aStorageType = 10;\\n\\n';\n\telse if (ext === '.religo') syntax = '// E.g. let aStorageValue : aStorageType = 10;\\n\\n';\n\telse if (ext === '.mligo') syntax = '// E.g. let aStorageValue : aStorageType = 10\\n\\n';\n\telse if (ext === '.jsligo') syntax = '// E.g. const aStorageValue : aStorageType = 10;\\n\\n';\n\n\treturn linkToContract + instruction + syntax;\n};\n\nconst initContentForParameter = (sourceFile: string): string => {\n\tconst linkToContract = `#include \"${sourceFile}\"\\n\\n`;\n\n\tconst instruction = '// Define your parameter values as a list of LIGO variable definitions\\n';\n\n\tconst ext = extractExt(sourceFile);\n\tlet syntax = '';\n\tif (ext === '.ligo') syntax = '// E.g. const aParameterValue : aParameterType = Increment(1);\\n\\n';\n\telse if (ext === '.religo') syntax = '// E.g. let aParameterValue : aParameterType = (Increment (1));\\n\\n';\n\telse if (ext === '.mligo') syntax = '// E.g. let aParameterValue : aParameterType = Increment 1\\n\\n';\n\telse if (ext === '.jsligo') syntax = '// E.g. const aParameterValue : aParameterType = (Increment (1));\\n\\n';\n\n\treturn linkToContract + instruction + syntax;\n};\n\nconst compileContractWithStorageAndParameter = async (parsedArgs: Opts, sourceFile: string): Promise<TableRow[]> => {\n\tconst contractCompileResult = await compileContract(parsedArgs, sourceFile);\n\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\n\tconst storageListFile = `${removeExt(sourceFile)}.storageList${extractExt(sourceFile)}`;\n\tconst storageListFilename = getInputFilename(parsedArgs, storageListFile);\n\tconst storageCompileResult = await access(storageListFilename)\n\t\t.then(() => compileExprs(parsedArgs, storageListFile, 'storage'))\n\t\t.catch(() => tryLegacyStorageNamingConvention(parsedArgs, sourceFile))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: storage file associated with \"${sourceFile}\" can't be found, so \"${storageListFile}\" has been created for you. Use this file to define all initial storage values for this contract\\n`,\n\t\t\t);\n\t\t\twriteFile(storageListFilename, initContentForStorage(sourceFile), 'utf8');\n\t\t});\n\n\tconst parameterListFile = `${removeExt(sourceFile)}.parameterList${extractExt(sourceFile)}`;\n\tconst parameterListFilename = getInputFilename(parsedArgs, parameterListFile);\n\tconst parameterCompileResult = await access(parameterListFilename)\n\t\t.then(() => compileExprs(parsedArgs, parameterListFile, 'parameter'))\n\t\t.catch(() => tryLegacyParameterNamingConvention(parsedArgs, sourceFile))\n\t\t.catch(() => {\n\t\t\tsendWarn(\n\t\t\t\t`Note: parameter file associated with \"${sourceFile}\" can't be found, so \"${parameterListFile}\" has been created for you. Use this file to define all parameter values for this contract\\n`,\n\t\t\t);\n\t\t\twriteFile(parameterListFilename, initContentForParameter(sourceFile), 'utf8');\n\t\t});\n\n\tlet compileResults: TableRow[] = [contractCompileResult];\n\tif (storageCompileResult) compileResults = compileResults.concat(storageCompileResult);\n\tif (parameterCompileResult) compileResults = compileResults.concat(parameterCompileResult);\n\treturn compileResults;\n};\n\n/*\nCompiling storage/parameter file amounts to compiling multiple expressions in that file,\nresulting in multiple rows with the same file name but different artifact names.\nThis will merge these rows into one row with just one mention of the file name.\ne.g.\n┌─────────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├─────────────────────────┼─────────────────────────────────────────────┤\n│ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │\n├─────────────────────────┼─────────────────────────────────────────────┤\n│ hello.storageList.mligo │ artifacts/hello.storage.storage2.tz │\n└─────────────────────────┴─────────────────────────────────────────────┘\n\t\t\t\t\t\t\t\tversus\n┌─────────────────────────┬─────────────────────────────────────────────┐\n│ Contract │ Artifact │\n├─────────────────────────┼─────────────────────────────────────────────┤\n│ hello.storageList.mligo │ artifacts/hello.default_storage.storage1.tz │\n│ │ artifacts/hello.storage.storage2.tz │\n└─────────────────────────┴─────────────────────────────────────────────┘\n*/\nconst mergeArtifactsOutput = (sourceFile: string) =>\n\t(tableRows: TableRow[]): TableRow[] => {\n\t\tconst artifactsOutput = tableRows.reduce(\n\t\t\t(acc: string, row: TableRow) => row.artifact === COMPILE_ERR_MSG ? acc : `${acc}${row.artifact}\\n`,\n\t\t\t'',\n\t\t);\n\t\treturn [{\n\t\t\tcontract: sourceFile,\n\t\t\tartifact: artifactsOutput,\n\t\t}];\n\t};\n\nconst compile = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\tlet p: Promise<TableRow[]>;\n\tif (isStorageListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'storage');\n\telse if (isParameterListFile(sourceFile)) p = compileExprs(parsedArgs, sourceFile, 'parameter');\n\telse if (isContractFile(sourceFile)) p = compileContractWithStorageAndParameter(parsedArgs, sourceFile);\n\telse {\n\t\treturn sendAsyncErr(\n\t\t\t`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`,\n\t\t);\n\t}\n\treturn p.then(sendJsonRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n","import { CmdArgEnv, getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { getLigoDockerImage, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (parsedArgs: Opts, userArgs: string): CmdArgEnv => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst binary = 'docker';\n\tconst baseArgs = ['run', '--rm', '-v', `${projectDir}:/project`, '-w', '/project', getLigoDockerImage()];\n\tconst processedUserArgs = userArgs.split(' ').map(arg => arg.startsWith('\\\\-') ? arg.substring(1) : arg).filter(arg =>\n\t\targ\n\t);\n\tconst args = baseArgs.concat(processedUserArgs);\n\tconst envVars = { 'DOCKER_DEFAULT_PLATFORM': 'linux/amd64' };\n\treturn [binary, args, envVars];\n};\n\nconst runArbitraryLigoCmd = (parsedArgs: Opts, cmd: string): Promise<string> =>\n\tgetArch()\n\t\t.then(() => getArbitraryLigoCmd(parsedArgs, cmd))\n\t\t.then(spawnCmd)\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n\nconst ligo = (parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(parsedArgs, args).then(sendRes).catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { emitExternalError, getInputFilename, getLigoDockerImage, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\tconst baseCmd =\n\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;\n\tconst inputFile = getInputFilename(parsedArgs, sourceFile);\n\tconst cmd = `${baseCmd} ${inputFile}`;\n\treturn cmd;\n};\n\nconst testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =>\n\tgetArch()\n\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t.then(execCmd)\n\t\t.then(({ stdout, stderr }) => {\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\n\t\t\t};\n\t\t})\n\t\t.catch(err => {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tcontract: sourceFile,\n\t\t\t\ttestResults: 'Some tests failed :(',\n\t\t\t};\n\t\t});\n\nconst test = (parsedArgs: Opts): Promise<void> => {\n\tconst sourceFile = parsedArgs.sourceFile;\n\treturn testContract(parsedArgs, sourceFile).then(result => [result]).then(sendJsonRes).catch(err =>\n\t\tsendAsyncErr(err, false)\n\t);\n};\n\nexport default test;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
package/index.ts CHANGED
@@ -29,7 +29,7 @@ Plugin.create(i18n => ({
29
29
  command: 'compile <sourceFile>',
30
30
  aliases: ['c', 'compile-ligo'],
31
31
  description:
32
- 'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storages and parameters files if they are found',
32
+ 'Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found',
33
33
  handler: 'proxy',
34
34
  encoding: 'json',
35
35
  }),
@@ -40,6 +40,13 @@ Plugin.create(i18n => ({
40
40
  handler: 'proxy',
41
41
  encoding: 'json',
42
42
  }),
43
+ Task.create({
44
+ task: 'get-image',
45
+ command: 'get-image',
46
+ description: 'Gets the name of the image to be used',
47
+ handler: 'proxy',
48
+ hidden: true,
49
+ }),
43
50
  ],
44
51
  templates: [
45
52
  Template.create({
package/ligo.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { CmdArgEnv, getArch, sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';
2
- import { LIGO_DOCKER_IMAGE, LigoOpts as Opts } from './common';
2
+ import { getLigoDockerImage, LigoOpts as Opts } from './common';
3
3
 
4
4
  const getArbitraryLigoCmd = (parsedArgs: Opts, userArgs: string): CmdArgEnv => {
5
5
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
6
6
  if (!projectDir) throw `No project directory provided`;
7
7
  const binary = 'docker';
8
- const baseArgs = ['run', '--rm', '-v', `${projectDir}:/project`, '-w', '/project', LIGO_DOCKER_IMAGE];
8
+ const baseArgs = ['run', '--rm', '-v', `${projectDir}:/project`, '-w', '/project', getLigoDockerImage()];
9
9
  const processedUserArgs = userArgs.split(' ').map(arg => arg.startsWith('\\-') ? arg.substring(1) : arg).filter(arg =>
10
10
  arg
11
11
  );
package/main.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { sendAsyncErr } from '@taqueria/node-sdk';
2
- import { IntersectionOpts as Opts } from './common';
1
+ import { sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';
2
+ import { getLigoDockerImage, IntersectionOpts as Opts } from './common';
3
3
  import compile from './compile';
4
4
  import ligo from './ligo';
5
5
  import test from './test';
@@ -12,6 +12,8 @@ const main = (parsedArgs: Opts): Promise<void> => {
12
12
  return compile(parsedArgs);
13
13
  case 'test':
14
14
  return test(parsedArgs);
15
+ case 'get-image':
16
+ return sendAsyncRes(getLigoDockerImage());
15
17
  default:
16
18
  return sendAsyncErr(`${parsedArgs.task} is not an understood task by the LIGO plugin`);
17
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-ligo",
3
- "version": "0.24.1",
3
+ "version": "0.25.0-alpha",
4
4
  "description": "A taqueria plugin for compiling LIGO smart contracts",
5
5
  "targets": {
6
6
  "default": {
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "homepage": "https://github.com/ecadlabs/taqueria#readme",
43
43
  "dependencies": {
44
- "@taqueria/node-sdk": "^0.24.1",
44
+ "@taqueria/node-sdk": "^0.25.0-alpha",
45
45
  "fast-glob": "^3.2.11"
46
46
  },
47
47
  "devDependencies": {
package/test.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
2
- import { getInputFilename, LIGO_DOCKER_IMAGE, TestOpts as Opts } from './common';
1
+ import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';
2
+ import { emitExternalError, getInputFilename, getLigoDockerImage, TestOpts as Opts } from './common';
3
3
 
4
4
  type TableRow = { contract: string; testResults: string };
5
5
 
@@ -7,7 +7,7 @@ const getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {
7
7
  const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
8
8
  if (!projectDir) throw `No project directory provided`;
9
9
  const baseCmd =
10
- `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${LIGO_DOCKER_IMAGE} run test`;
10
+ `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;
11
11
  const inputFile = getInputFilename(parsedArgs, sourceFile);
12
12
  const cmd = `${baseCmd} ${inputFile}`;
13
13
  return cmd;
@@ -26,8 +26,7 @@ const testContract = (parsedArgs: Opts, sourceFile: string): Promise<TableRow> =
26
26
  };
27
27
  })
28
28
  .catch(err => {
29
- sendErr(`\n=== For ${sourceFile} ===`);
30
- sendErr(err.message.replace(/Command failed.+?\n/, ''));
29
+ emitExternalError(err, sourceFile);
31
30
  return {
32
31
  contract: sourceFile,
33
32
  testResults: 'Some tests failed :(',