@taqueria/plugin-ligo 0.27.2-alpha → 0.27.3-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/_readme.eta +11 -1
- package/common.ts +11 -4
- package/compile-all.ts +29 -0
- package/compile.ts +30 -17
- package/createContract.ts +2 -7
- package/index.d.ts +1 -0
- package/index.js +479 -409
- package/index.js.map +1 -1
- package/index.mjs +588 -0
- package/index.mjs.map +1 -0
- package/index.ts +15 -0
- package/ligo.ts +7 -4
- package/main.ts +3 -0
- package/package.json +20 -4
- package/test.ts +2 -2
package/index.js
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
|
+
mod
|
|
19
|
+
));
|
|
5
20
|
|
|
21
|
+
// index.ts
|
|
22
|
+
var import_node_sdk8 = require("@taqueria/node-sdk");
|
|
6
23
|
|
|
24
|
+
// createContract.ts
|
|
25
|
+
var import_node_sdk = require("@taqueria/node-sdk");
|
|
26
|
+
var import_promises = require("fs/promises");
|
|
7
27
|
|
|
8
|
-
|
|
28
|
+
// ligo_templates.ts
|
|
29
|
+
var mligo_template = `
|
|
9
30
|
type storage = int
|
|
10
31
|
|
|
11
32
|
type parameter =
|
|
@@ -30,7 +51,7 @@ let main (action, store : parameter * storage) : return =
|
|
|
30
51
|
| Decrement (n) -> sub (store, n)
|
|
31
52
|
| Reset -> 0)
|
|
32
53
|
`;
|
|
33
|
-
|
|
54
|
+
var pascaligo_template = `
|
|
34
55
|
type storage is int
|
|
35
56
|
|
|
36
57
|
type parameter is
|
|
@@ -59,7 +80,7 @@ function main (const action : parameter; const store : storage) : return is
|
|
|
59
80
|
| Reset -> 0
|
|
60
81
|
])
|
|
61
82
|
`;
|
|
62
|
-
|
|
83
|
+
var religo_template = `
|
|
63
84
|
type storage = int;
|
|
64
85
|
|
|
65
86
|
type parameter =
|
|
@@ -85,7 +106,7 @@ let main = ((action, store) : (parameter, storage)) : return => {
|
|
|
85
106
|
| Reset => 0}))
|
|
86
107
|
};
|
|
87
108
|
`;
|
|
88
|
-
|
|
109
|
+
var jsligo_template = `
|
|
89
110
|
type storage = int;
|
|
90
111
|
|
|
91
112
|
type parameter =
|
|
@@ -112,427 +133,476 @@ const main = ([action, store] : [parameter, storage]) : ret => {
|
|
|
112
133
|
};
|
|
113
134
|
`;
|
|
114
135
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
136
|
+
// createContract.ts
|
|
137
|
+
var getLigoTemplate = async (contractName, syntax) => {
|
|
138
|
+
const matchResult = contractName.match(/\.[^.]+$/);
|
|
139
|
+
const ext = matchResult ? matchResult[0].substring(1) : null;
|
|
140
|
+
if (syntax === "mligo")
|
|
141
|
+
return mligo_template;
|
|
142
|
+
if (syntax === "ligo")
|
|
143
|
+
return pascaligo_template;
|
|
144
|
+
if (syntax === "religo")
|
|
145
|
+
return religo_template;
|
|
146
|
+
if (syntax === "jsligo")
|
|
147
|
+
return jsligo_template;
|
|
148
|
+
if (syntax === void 0) {
|
|
149
|
+
if (ext === "mligo")
|
|
150
|
+
return mligo_template;
|
|
151
|
+
if (ext === "ligo")
|
|
152
|
+
return pascaligo_template;
|
|
153
|
+
if (ext === "religo")
|
|
154
|
+
return religo_template;
|
|
155
|
+
if (ext === "jsligo")
|
|
156
|
+
return jsligo_template;
|
|
157
|
+
return (0, import_node_sdk.sendAsyncErr)(
|
|
158
|
+
`Unable to infer LIGO syntax from "${contractName}". Please specify a LIGO syntax via the --syntax option`
|
|
159
|
+
);
|
|
160
|
+
} else {
|
|
161
|
+
return (0, import_node_sdk.sendAsyncErr)(`"${syntax}" is not a valid syntax. Please specify a valid LIGO syntax`);
|
|
162
|
+
}
|
|
118
163
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (syntax === "jsligo") return 0, $9d8c61104c8e60ad$export$6d35abb7f92d1079;
|
|
126
|
-
if (syntax === undefined) {
|
|
127
|
-
if (ext === "mligo") return 0, $9d8c61104c8e60ad$export$1336661d942c7074;
|
|
128
|
-
if (ext === "ligo") return 0, $9d8c61104c8e60ad$export$ec41334b92330d9b;
|
|
129
|
-
if (ext === "religo") return 0, $9d8c61104c8e60ad$export$9e59f1f7960689be;
|
|
130
|
-
if (ext === "jsligo") return 0, $9d8c61104c8e60ad$export$6d35abb7f92d1079;
|
|
131
|
-
return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`Unable to infer LIGO syntax from "${contractName}". Please specify a LIGO syntax via the --syntax option`);
|
|
132
|
-
} else return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`"${syntax}" is not a valid syntax. Please specify a valid LIGO syntax`);
|
|
164
|
+
var createContract = (args) => {
|
|
165
|
+
const unsafeOpts = args;
|
|
166
|
+
const contractName = unsafeOpts.sourceFileName;
|
|
167
|
+
const syntax = unsafeOpts.syntax;
|
|
168
|
+
const contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;
|
|
169
|
+
return getLigoTemplate(contractName, syntax).then((ligo_template) => (0, import_promises.writeFile)(`${contractsDir}/${contractName}`, ligo_template));
|
|
133
170
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
171
|
+
var createContract_default = createContract;
|
|
172
|
+
|
|
173
|
+
// main.ts
|
|
174
|
+
var import_node_sdk7 = require("@taqueria/node-sdk");
|
|
175
|
+
|
|
176
|
+
// common.ts
|
|
177
|
+
var import_node_sdk2 = require("@taqueria/node-sdk");
|
|
178
|
+
var import_path = require("path");
|
|
179
|
+
var LIGO_DEFAULT_IMAGE = "ligolang/ligo:0.57.0";
|
|
180
|
+
var LIGO_IMAGE_ENV_VAR = "TAQ_LIGO_IMAGE";
|
|
181
|
+
var getLigoDockerImage = () => (0, import_node_sdk2.getDockerImage)(LIGO_DEFAULT_IMAGE, LIGO_IMAGE_ENV_VAR);
|
|
182
|
+
var getInputFilenameAbsPath = (parsedArgs, sourceFile) => (0, import_path.join)(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? "contracts", sourceFile);
|
|
183
|
+
var getInputFilenameRelPath = (parsedArgs, sourceFile) => (0, import_path.join)(parsedArgs.config.contractsDir ?? "contracts", sourceFile);
|
|
184
|
+
var emitExternalError = (err, sourceFile) => {
|
|
185
|
+
(0, import_node_sdk2.sendErr)(`
|
|
186
|
+
=== Error messages for ${sourceFile} ===`);
|
|
187
|
+
err instanceof Error ? (0, import_node_sdk2.sendErr)(err.message.replace(/Command failed.+?\n/, "")) : (0, import_node_sdk2.sendErr)(err);
|
|
188
|
+
(0, import_node_sdk2.sendErr)(`
|
|
189
|
+
===`);
|
|
140
190
|
};
|
|
141
|
-
var $40622e3a438d0515$export$2e2bcd8739ae039 = $40622e3a438d0515$var$createContract;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
191
|
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
192
|
+
// compile.ts
|
|
193
|
+
var import_node_sdk3 = require("@taqueria/node-sdk");
|
|
194
|
+
var import_promises2 = require("fs/promises");
|
|
195
|
+
var import_path2 = require("path");
|
|
196
|
+
var COMPILE_ERR_MSG = "Not compiled";
|
|
197
|
+
var isStorageKind = (exprKind) => exprKind === "storage" || exprKind === "default_storage";
|
|
198
|
+
var isLIGOFile = (sourceFile) => /.+\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
|
|
199
|
+
var isStorageListFile = (sourceFile) => /.+\.(storageList|storages)\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
|
|
200
|
+
var isParameterListFile = (sourceFile) => /.+\.(parameterList|parameters)\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
|
|
201
|
+
var isContractFile = (sourceFile) => isLIGOFile(sourceFile) && !isStorageListFile(sourceFile) && !isParameterListFile(sourceFile);
|
|
202
|
+
var extractExt = (path) => {
|
|
203
|
+
const matchResult = path.match(/\.(ligo|religo|mligo|jsligo)$/);
|
|
204
|
+
return matchResult ? matchResult[0] : "";
|
|
156
205
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const $24b2f47d8f306cb3$var$COMPILE_ERR_MSG = "Not compiled";
|
|
164
|
-
const $24b2f47d8f306cb3$var$isStorageKind = (exprKind)=>exprKind === "storage" || exprKind === "default_storage";
|
|
165
|
-
const $24b2f47d8f306cb3$var$isLIGOFile = (sourceFile)=>/.+\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
|
|
166
|
-
const $24b2f47d8f306cb3$var$isStorageListFile = (sourceFile)=>/.+\.(storageList|storages)\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
|
|
167
|
-
const $24b2f47d8f306cb3$var$isParameterListFile = (sourceFile)=>/.+\.(parameterList|parameters)\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);
|
|
168
|
-
const $24b2f47d8f306cb3$var$isContractFile = (sourceFile)=>$24b2f47d8f306cb3$var$isLIGOFile(sourceFile) && !$24b2f47d8f306cb3$var$isStorageListFile(sourceFile) && !$24b2f47d8f306cb3$var$isParameterListFile(sourceFile);
|
|
169
|
-
const $24b2f47d8f306cb3$var$extractExt = (path)=>{
|
|
170
|
-
const matchResult = path.match(/\.(ligo|religo|mligo|jsligo)$/);
|
|
171
|
-
return matchResult ? matchResult[0] : "";
|
|
206
|
+
var removeExt = (path) => {
|
|
207
|
+
const extRegex = new RegExp(extractExt(path));
|
|
208
|
+
return path.replace(extRegex, "");
|
|
172
209
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
210
|
+
var isOutputFormatJSON = (parsedArgs) => parsedArgs.json;
|
|
211
|
+
var getOutputContractFilename = (parsedArgs, sourceFile) => {
|
|
212
|
+
const outputFile = (0, import_path2.basename)(sourceFile, (0, import_path2.extname)(sourceFile));
|
|
213
|
+
const ext = isOutputFormatJSON(parsedArgs) ? ".json" : ".tz";
|
|
214
|
+
return (0, import_path2.join)((0, import_node_sdk3.getArtifactsDir)(parsedArgs), `${outputFile}${ext}`);
|
|
176
215
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
216
|
+
var getContractNameForExpr = (sourceFile, exprKind) => {
|
|
217
|
+
try {
|
|
218
|
+
return isStorageKind(exprKind) ? sourceFile.match(/.+(?=\.(?:storageList|storages)\.(ligo|religo|mligo|jsligo))/).join(".") : sourceFile.match(/.+(?=\.(?:parameterList|parameters)\.(ligo|religo|mligo|jsligo))/).join(".");
|
|
219
|
+
} catch (err) {
|
|
220
|
+
throw new Error(`Something went wrong internally when dealing with filename format: ${err}`);
|
|
221
|
+
}
|
|
182
222
|
};
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
223
|
+
var getOutputExprFilename = (parsedArgs, sourceFile, exprKind, exprName) => {
|
|
224
|
+
const contractName = (0, import_path2.basename)(getContractNameForExpr(sourceFile, exprKind), (0, import_path2.extname)(sourceFile));
|
|
225
|
+
const ext = isOutputFormatJSON(parsedArgs) ? ".json" : ".tz";
|
|
226
|
+
const outputFile = exprKind === "default_storage" ? `${contractName}.default_storage${ext}` : `${contractName}.${exprKind}.${exprName}${ext}`;
|
|
227
|
+
return (0, import_path2.join)((0, import_node_sdk3.getArtifactsDir)(parsedArgs), `${outputFile}`);
|
|
228
|
+
};
|
|
229
|
+
var getCompileContractCmd = (parsedArgs, sourceFile) => {
|
|
230
|
+
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
231
|
+
if (!projectDir)
|
|
232
|
+
throw `No project directory provided`;
|
|
233
|
+
const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile contract`;
|
|
234
|
+
const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
|
|
235
|
+
const outputFile = `-o ${getOutputContractFilename(parsedArgs, sourceFile)}`;
|
|
236
|
+
const flags = isOutputFormatJSON(parsedArgs) ? " --michelson-format json " : "";
|
|
237
|
+
const cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}`;
|
|
238
|
+
return cmd;
|
|
191
239
|
};
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
240
|
+
var getCompileExprCmd = (parsedArgs, sourceFile, exprKind, exprName) => {
|
|
241
|
+
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
242
|
+
if (!projectDir)
|
|
243
|
+
throw `No project directory provided`;
|
|
244
|
+
const compilerType = isStorageKind(exprKind) ? "storage" : "parameter";
|
|
245
|
+
const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} compile ${compilerType}`;
|
|
246
|
+
const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
|
|
247
|
+
const outputFile = `-o ${getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)}`;
|
|
248
|
+
const flags = isOutputFormatJSON(parsedArgs) ? " --michelson-format json " : "";
|
|
249
|
+
const cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags}`;
|
|
250
|
+
return cmd;
|
|
198
251
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
252
|
+
var compileContract = (parsedArgs, sourceFile) => (0, import_node_sdk3.getArch)().then(() => getCompileContractCmd(parsedArgs, sourceFile)).then(import_node_sdk3.execCmd).then(({ stderr }) => {
|
|
253
|
+
if (stderr.length > 0)
|
|
254
|
+
(0, import_node_sdk3.sendWarn)(stderr);
|
|
255
|
+
return {
|
|
256
|
+
contract: sourceFile,
|
|
257
|
+
artifact: getOutputContractFilename(parsedArgs, sourceFile)
|
|
258
|
+
};
|
|
259
|
+
}).catch((err) => {
|
|
260
|
+
emitExternalError(err, sourceFile);
|
|
261
|
+
return {
|
|
262
|
+
contract: sourceFile,
|
|
263
|
+
artifact: COMPILE_ERR_MSG
|
|
264
|
+
};
|
|
265
|
+
});
|
|
266
|
+
var compileExpr = (parsedArgs, sourceFile, exprKind) => (exprName) => (0, import_node_sdk3.getArch)().then(() => getCompileExprCmd(parsedArgs, sourceFile, exprKind, exprName)).then(import_node_sdk3.execCmd).then(({ stderr }) => {
|
|
267
|
+
if (stderr.length > 0)
|
|
268
|
+
(0, import_node_sdk3.sendWarn)(stderr);
|
|
269
|
+
return {
|
|
270
|
+
contract: sourceFile,
|
|
271
|
+
artifact: getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)
|
|
272
|
+
};
|
|
273
|
+
}).catch((err) => {
|
|
274
|
+
emitExternalError(err, sourceFile);
|
|
275
|
+
return {
|
|
276
|
+
contract: sourceFile,
|
|
277
|
+
artifact: COMPILE_ERR_MSG
|
|
278
|
+
};
|
|
279
|
+
});
|
|
280
|
+
var getExprNames = (parsedArgs, sourceFile) => (0, import_promises2.readFile)(getInputFilenameAbsPath(parsedArgs, sourceFile), "utf8").then((data) => data.match(/(?<=\n\s*(let|const)\s+)[a-zA-Z0-9_]+/g) ?? []);
|
|
281
|
+
var compileExprs = (parsedArgs, sourceFile, exprKind) => getExprNames(parsedArgs, sourceFile).then((exprNames) => {
|
|
282
|
+
if (exprNames.length === 0)
|
|
283
|
+
return [];
|
|
284
|
+
const firstExprName = exprNames.slice(0, 1)[0];
|
|
285
|
+
const restExprNames = exprNames.slice(1, exprNames.length);
|
|
286
|
+
const firstExprKind = isStorageKind(exprKind) ? "default_storage" : "parameter";
|
|
287
|
+
const restExprKind = isStorageKind(exprKind) ? "storage" : "parameter";
|
|
288
|
+
const firstExprResult = compileExpr(parsedArgs, sourceFile, firstExprKind)(firstExprName);
|
|
289
|
+
const restExprResults = restExprNames.map(compileExpr(parsedArgs, sourceFile, restExprKind));
|
|
290
|
+
return Promise.all([firstExprResult].concat(restExprResults));
|
|
291
|
+
}).catch((err) => {
|
|
292
|
+
emitExternalError(err, sourceFile);
|
|
293
|
+
return [{
|
|
294
|
+
contract: sourceFile,
|
|
295
|
+
artifact: `No ${isStorageKind(exprKind) ? "storage" : "parameter"} values compiled`
|
|
296
|
+
}];
|
|
297
|
+
}).then(mergeArtifactsOutput(sourceFile));
|
|
298
|
+
var tryLegacyStorageNamingConvention = (parsedArgs, sourceFile) => {
|
|
299
|
+
const storageListFile = `${removeExt(sourceFile)}.storages${extractExt(sourceFile)}`;
|
|
300
|
+
const storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);
|
|
301
|
+
return (0, import_promises2.access)(storageListFilename).then(() => {
|
|
302
|
+
(0, import_node_sdk3.sendWarn)(
|
|
303
|
+
`Warning: The naming convention of "<CONTRACT>.storages.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.storageList.<EXTENSION>". Please adjust your storage file names accordingly
|
|
304
|
+
`
|
|
305
|
+
);
|
|
306
|
+
return compileExprs(parsedArgs, storageListFile, "storage");
|
|
307
|
+
});
|
|
208
308
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
309
|
+
var tryLegacyParameterNamingConvention = (parsedArgs, sourceFile) => {
|
|
310
|
+
const parameterListFile = `${removeExt(sourceFile)}.parameters${extractExt(sourceFile)}`;
|
|
311
|
+
const parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);
|
|
312
|
+
return (0, import_promises2.access)(parameterListFilename).then(() => {
|
|
313
|
+
(0, import_node_sdk3.sendWarn)(
|
|
314
|
+
`Warning: The naming convention of "<CONTRACT>.parameters.<EXTENSION>" is deprecated and renamed to "<CONTRACT>.parameterList.<EXTENSION>". Please adjust your parameter file names accordingly
|
|
315
|
+
`
|
|
316
|
+
);
|
|
317
|
+
return compileExprs(parsedArgs, parameterListFile, "parameter");
|
|
318
|
+
});
|
|
219
319
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
contract: sourceFile,
|
|
237
|
-
artifact: $24b2f47d8f306cb3$var$getOutputExprFilename(parsedArgs, sourceFile, exprKind, exprName)
|
|
238
|
-
};
|
|
239
|
-
}).catch((err)=>{
|
|
240
|
-
(0, $844cb58d66fbf6db$export$b59ff90dc389ce6d)(err, sourceFile);
|
|
241
|
-
return {
|
|
242
|
-
contract: sourceFile,
|
|
243
|
-
artifact: $24b2f47d8f306cb3$var$COMPILE_ERR_MSG
|
|
244
|
-
};
|
|
245
|
-
});
|
|
246
|
-
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) ?? []);
|
|
247
|
-
const $24b2f47d8f306cb3$var$compileExprs = (parsedArgs, sourceFile, exprKind)=>$24b2f47d8f306cb3$var$getExprNames(parsedArgs, sourceFile).then((exprNames)=>{
|
|
248
|
-
if (exprNames.length === 0) return [];
|
|
249
|
-
const firstExprName = exprNames.slice(0, 1)[0];
|
|
250
|
-
const restExprNames = exprNames.slice(1, exprNames.length);
|
|
251
|
-
const firstExprKind = $24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "default_storage" : "parameter";
|
|
252
|
-
const restExprKind = $24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "storage" : "parameter";
|
|
253
|
-
const firstExprResult = $24b2f47d8f306cb3$var$compileExpr(parsedArgs, sourceFile, firstExprKind)(firstExprName);
|
|
254
|
-
const restExprResults = restExprNames.map($24b2f47d8f306cb3$var$compileExpr(parsedArgs, sourceFile, restExprKind));
|
|
255
|
-
return Promise.all([
|
|
256
|
-
firstExprResult
|
|
257
|
-
].concat(restExprResults));
|
|
258
|
-
}).catch((err)=>{
|
|
259
|
-
(0, $844cb58d66fbf6db$export$b59ff90dc389ce6d)(err, sourceFile);
|
|
260
|
-
return [
|
|
261
|
-
{
|
|
262
|
-
contract: sourceFile,
|
|
263
|
-
artifact: `No ${$24b2f47d8f306cb3$var$isStorageKind(exprKind) ? "storage" : "parameter"} values compiled`
|
|
264
|
-
}
|
|
265
|
-
];
|
|
266
|
-
}).then($24b2f47d8f306cb3$var$mergeArtifactsOutput(sourceFile));
|
|
267
|
-
// TODO: Just for backwards compatibility. Can be deleted in the future.
|
|
268
|
-
const $24b2f47d8f306cb3$var$tryLegacyStorageNamingConvention = (parsedArgs, sourceFile)=>{
|
|
269
|
-
const storageListFile = `${$24b2f47d8f306cb3$var$removeExt(sourceFile)}.storages${$24b2f47d8f306cb3$var$extractExt(sourceFile)}`;
|
|
270
|
-
const storageListFilename = (0, $844cb58d66fbf6db$export$17f107107c3c82c6)(parsedArgs, storageListFile);
|
|
271
|
-
return (0, $kQNfl$fspromises.access)(storageListFilename).then(()=>{
|
|
272
|
-
(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`);
|
|
273
|
-
return $24b2f47d8f306cb3$var$compileExprs(parsedArgs, storageListFile, "storage");
|
|
274
|
-
});
|
|
320
|
+
var initContentForStorage = (sourceFile) => {
|
|
321
|
+
const linkToContract = `#include "${sourceFile}"
|
|
322
|
+
|
|
323
|
+
`;
|
|
324
|
+
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";
|
|
325
|
+
const ext = extractExt(sourceFile);
|
|
326
|
+
let syntax = "";
|
|
327
|
+
if (ext === ".ligo")
|
|
328
|
+
syntax = "// E.g. const aStorageValue : aStorageType = 10;\n\n";
|
|
329
|
+
else if (ext === ".religo")
|
|
330
|
+
syntax = "// E.g. let aStorageValue : aStorageType = 10;\n\n";
|
|
331
|
+
else if (ext === ".mligo")
|
|
332
|
+
syntax = "// E.g. let aStorageValue : aStorageType = 10\n\n";
|
|
333
|
+
else if (ext === ".jsligo")
|
|
334
|
+
syntax = "// E.g. const aStorageValue : aStorageType = 10;\n\n";
|
|
335
|
+
return linkToContract + instruction + syntax;
|
|
275
336
|
};
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
337
|
+
var initContentForParameter = (sourceFile) => {
|
|
338
|
+
const linkToContract = `#include "${sourceFile}"
|
|
339
|
+
|
|
340
|
+
`;
|
|
341
|
+
const instruction = "// Define your parameter values as a list of LIGO variable definitions\n";
|
|
342
|
+
const ext = extractExt(sourceFile);
|
|
343
|
+
let syntax = "";
|
|
344
|
+
if (ext === ".ligo")
|
|
345
|
+
syntax = "// E.g. const aParameterValue : aParameterType = Increment(1);\n\n";
|
|
346
|
+
else if (ext === ".religo")
|
|
347
|
+
syntax = "// E.g. let aParameterValue : aParameterType = (Increment (1));\n\n";
|
|
348
|
+
else if (ext === ".mligo")
|
|
349
|
+
syntax = "// E.g. let aParameterValue : aParameterType = Increment 1\n\n";
|
|
350
|
+
else if (ext === ".jsligo")
|
|
351
|
+
syntax = "// E.g. const aParameterValue : aParameterType = (Increment (1));\n\n";
|
|
352
|
+
return linkToContract + instruction + syntax;
|
|
284
353
|
};
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
354
|
+
var compileContractWithStorageAndParameter = async (parsedArgs, sourceFile) => {
|
|
355
|
+
const contractCompileResult = await compileContract(parsedArgs, sourceFile);
|
|
356
|
+
if (contractCompileResult.artifact === COMPILE_ERR_MSG)
|
|
357
|
+
return [contractCompileResult];
|
|
358
|
+
const storageListFile = `${removeExt(sourceFile)}.storageList${extractExt(sourceFile)}`;
|
|
359
|
+
const storageListFilename = getInputFilenameAbsPath(parsedArgs, storageListFile);
|
|
360
|
+
const storageCompileResult = await (0, import_promises2.access)(storageListFilename).then(() => compileExprs(parsedArgs, storageListFile, "storage")).catch(() => tryLegacyStorageNamingConvention(parsedArgs, sourceFile)).catch(() => {
|
|
361
|
+
(0, import_node_sdk3.sendWarn)(
|
|
362
|
+
`Note: storage file associated with "${sourceFile}" can't be found, so "${storageListFile}" has been created for you. Use this file to define all initial storage values for this contract
|
|
363
|
+
`
|
|
364
|
+
);
|
|
365
|
+
(0, import_promises2.writeFile)(storageListFilename, initContentForStorage(sourceFile), "utf8");
|
|
366
|
+
});
|
|
367
|
+
const parameterListFile = `${removeExt(sourceFile)}.parameterList${extractExt(sourceFile)}`;
|
|
368
|
+
const parameterListFilename = getInputFilenameAbsPath(parsedArgs, parameterListFile);
|
|
369
|
+
const parameterCompileResult = await (0, import_promises2.access)(parameterListFilename).then(() => compileExprs(parsedArgs, parameterListFile, "parameter")).catch(() => tryLegacyParameterNamingConvention(parsedArgs, sourceFile)).catch(() => {
|
|
370
|
+
(0, import_node_sdk3.sendWarn)(
|
|
371
|
+
`Note: parameter file associated with "${sourceFile}" can't be found, so "${parameterListFile}" has been created for you. Use this file to define all parameter values for this contract
|
|
372
|
+
`
|
|
373
|
+
);
|
|
374
|
+
(0, import_promises2.writeFile)(parameterListFilename, initContentForParameter(sourceFile), "utf8");
|
|
375
|
+
});
|
|
376
|
+
let compileResults = [contractCompileResult];
|
|
377
|
+
if (storageCompileResult)
|
|
378
|
+
compileResults = compileResults.concat(storageCompileResult);
|
|
379
|
+
if (parameterCompileResult)
|
|
380
|
+
compileResults = compileResults.concat(parameterCompileResult);
|
|
381
|
+
return compileResults;
|
|
295
382
|
};
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
383
|
+
var mergeArtifactsOutput = (sourceFile) => (tableRows) => {
|
|
384
|
+
const artifactsOutput = tableRows.reduce(
|
|
385
|
+
(acc, row) => row.artifact === COMPILE_ERR_MSG ? acc : `${acc}${row.artifact}
|
|
386
|
+
`,
|
|
387
|
+
""
|
|
388
|
+
);
|
|
389
|
+
return [{
|
|
390
|
+
contract: sourceFile,
|
|
391
|
+
artifact: artifactsOutput
|
|
392
|
+
}];
|
|
306
393
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
(0, $kQNfl$fspromises.writeFile)(parameterListFilename, $24b2f47d8f306cb3$var$initContentForParameter(sourceFile), "utf8");
|
|
323
|
-
});
|
|
324
|
-
let compileResults = [
|
|
325
|
-
contractCompileResult
|
|
326
|
-
];
|
|
327
|
-
if (storageCompileResult) compileResults = compileResults.concat(storageCompileResult);
|
|
328
|
-
if (parameterCompileResult) compileResults = compileResults.concat(parameterCompileResult);
|
|
329
|
-
return compileResults;
|
|
394
|
+
var compile = (parsedArgs) => {
|
|
395
|
+
const sourceFile = parsedArgs.sourceFile;
|
|
396
|
+
let p;
|
|
397
|
+
if (isStorageListFile(sourceFile))
|
|
398
|
+
p = compileExprs(parsedArgs, sourceFile, "storage");
|
|
399
|
+
else if (isParameterListFile(sourceFile))
|
|
400
|
+
p = compileExprs(parsedArgs, sourceFile, "parameter");
|
|
401
|
+
else if (isContractFile(sourceFile))
|
|
402
|
+
p = compileContractWithStorageAndParameter(parsedArgs, sourceFile);
|
|
403
|
+
else {
|
|
404
|
+
return (0, import_node_sdk3.sendAsyncErr)(
|
|
405
|
+
`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
return p.then(import_node_sdk3.sendJsonRes).catch((err) => (0, import_node_sdk3.sendErr)(err, false));
|
|
330
409
|
};
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const artifactsOutput = tableRows.reduce((acc, row)=>row.artifact === $24b2f47d8f306cb3$var$COMPILE_ERR_MSG ? acc : `${acc}${row.artifact}\n`, "");
|
|
352
|
-
return [
|
|
353
|
-
{
|
|
354
|
-
contract: sourceFile,
|
|
355
|
-
artifact: artifactsOutput
|
|
356
|
-
}
|
|
357
|
-
];
|
|
358
|
-
};
|
|
359
|
-
const $24b2f47d8f306cb3$var$compile = (parsedArgs)=>{
|
|
360
|
-
const sourceFile = parsedArgs.sourceFile;
|
|
361
|
-
let p;
|
|
362
|
-
if ($24b2f47d8f306cb3$var$isStorageListFile(sourceFile)) p = $24b2f47d8f306cb3$var$compileExprs(parsedArgs, sourceFile, "storage");
|
|
363
|
-
else if ($24b2f47d8f306cb3$var$isParameterListFile(sourceFile)) p = $24b2f47d8f306cb3$var$compileExprs(parsedArgs, sourceFile, "parameter");
|
|
364
|
-
else if ($24b2f47d8f306cb3$var$isContractFile(sourceFile)) p = $24b2f47d8f306cb3$var$compileContractWithStorageAndParameter(parsedArgs, sourceFile);
|
|
365
|
-
else return (0, $kQNfl$taquerianodesdk.sendAsyncErr)(`${sourceFile} doesn't have a valid LIGO extension ('.ligo', '.religo', '.mligo' or '.jsligo')`);
|
|
366
|
-
return p.then((0, $kQNfl$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $kQNfl$taquerianodesdk.sendAsyncErr)(err, false));
|
|
410
|
+
var compile_default = compile;
|
|
411
|
+
|
|
412
|
+
// compile-all.ts
|
|
413
|
+
var import_node_sdk4 = require("@taqueria/node-sdk");
|
|
414
|
+
var import_fast_glob = __toESM(require("fast-glob"));
|
|
415
|
+
var import_promises3 = require("fs/promises");
|
|
416
|
+
var import_path3 = require("path");
|
|
417
|
+
var isMainContract = (parsedArgs, contactFilename) => (0, import_promises3.readFile)(getInputFilenameAbsPath(parsedArgs, contactFilename), "utf8").then((data) => /(const|let|function)\s+main/.test(data));
|
|
418
|
+
var compileAll = async (parsedArgs) => {
|
|
419
|
+
let p = [];
|
|
420
|
+
const contractFilenames = await (0, import_fast_glob.default)(
|
|
421
|
+
["**/*.ligo", "**/*.religo", "**/*.mligo", "**/*.jsligo"],
|
|
422
|
+
{ cwd: (0, import_path3.join)(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? "contracts"), absolute: false }
|
|
423
|
+
);
|
|
424
|
+
for (const filename of contractFilenames) {
|
|
425
|
+
if (await isMainContract(parsedArgs, filename)) {
|
|
426
|
+
p.push(compileContractWithStorageAndParameter(parsedArgs, filename));
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return Promise.all(p).then((tables) => tables.flat()).then(import_node_sdk4.sendJsonRes).catch((err) => (0, import_node_sdk4.sendErr)(err, false));
|
|
367
430
|
};
|
|
368
|
-
var
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
const args = baseArgs.concat(processedUserArgs);
|
|
388
|
-
const envVars = {
|
|
389
|
-
"DOCKER_DEFAULT_PLATFORM": "linux/amd64"
|
|
390
|
-
};
|
|
391
|
-
return [
|
|
392
|
-
binary,
|
|
393
|
-
args,
|
|
394
|
-
envVars
|
|
395
|
-
];
|
|
431
|
+
var compile_all_default = compileAll;
|
|
432
|
+
|
|
433
|
+
// ligo.ts
|
|
434
|
+
var import_node_sdk5 = require("@taqueria/node-sdk");
|
|
435
|
+
var getArbitraryLigoCmd = (parsedArgs, userArgs) => {
|
|
436
|
+
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
437
|
+
if (!projectDir)
|
|
438
|
+
throw `No project directory provided`;
|
|
439
|
+
const binary = "docker";
|
|
440
|
+
const baseArgs = ["run", "--rm", "-v", `${projectDir}:/project`, "-w", "/project", getLigoDockerImage()];
|
|
441
|
+
const processedUserArgs = userArgs.split(" ").map((arg) => arg.startsWith("\\-") ? arg.substring(1) : arg).filter(
|
|
442
|
+
(arg) => arg
|
|
443
|
+
);
|
|
444
|
+
const args = baseArgs.concat(processedUserArgs);
|
|
445
|
+
const envVars = { "DOCKER_DEFAULT_PLATFORM": "linux/amd64" };
|
|
446
|
+
return [
|
|
447
|
+
[binary, ...args].join(" "),
|
|
448
|
+
envVars
|
|
449
|
+
];
|
|
396
450
|
};
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
451
|
+
var runArbitraryLigoCmd = (parsedArgs, cmd) => (0, import_node_sdk5.getArch)().then(() => getArbitraryLigoCmd(parsedArgs, cmd)).then(([cmd2, envVars]) => (0, import_node_sdk5.spawnCmd)(cmd2, envVars)).then(
|
|
452
|
+
(code) => code !== null && code === 0 ? `Command "${cmd}" ran successfully by LIGO` : `Command "${cmd}" failed. Please check your command`
|
|
453
|
+
).catch((err) => (0, import_node_sdk5.sendAsyncErr)(`An internal error has occurred: ${err.message}`));
|
|
454
|
+
var ligo = (parsedArgs) => {
|
|
455
|
+
const args = parsedArgs.command;
|
|
456
|
+
return runArbitraryLigoCmd(parsedArgs, args).then(import_node_sdk5.sendRes).catch((err) => (0, import_node_sdk5.sendAsyncErr)(err, false));
|
|
401
457
|
};
|
|
402
|
-
var
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
458
|
+
var ligo_default = ligo;
|
|
459
|
+
|
|
460
|
+
// test.ts
|
|
461
|
+
var import_node_sdk6 = require("@taqueria/node-sdk");
|
|
462
|
+
var getTestContractCmd = (parsedArgs, sourceFile) => {
|
|
463
|
+
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
464
|
+
if (!projectDir)
|
|
465
|
+
throw `No project directory provided`;
|
|
466
|
+
const baseCmd = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v "${projectDir}":/project -w /project -u $(id -u):$(id -g) ${getLigoDockerImage()} run test`;
|
|
467
|
+
const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
|
|
468
|
+
const cmd = `${baseCmd} ${inputFile}`;
|
|
469
|
+
return cmd;
|
|
414
470
|
};
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
471
|
+
var testContract = (parsedArgs, sourceFile) => (0, import_node_sdk6.getArch)().then(() => getTestContractCmd(parsedArgs, sourceFile)).then(import_node_sdk6.execCmd).then(({ stdout, stderr }) => {
|
|
472
|
+
if (stderr.length > 0)
|
|
473
|
+
(0, import_node_sdk6.sendWarn)(stderr);
|
|
474
|
+
const result = "\u{1F389} All tests passed \u{1F389}";
|
|
475
|
+
return {
|
|
476
|
+
contract: sourceFile,
|
|
477
|
+
testResults: stdout.length > 0 ? `${stdout}
|
|
478
|
+
${result}` : result
|
|
479
|
+
};
|
|
480
|
+
}).catch((err) => {
|
|
481
|
+
emitExternalError(err, sourceFile);
|
|
482
|
+
return {
|
|
483
|
+
contract: sourceFile,
|
|
484
|
+
testResults: "Some tests failed :("
|
|
485
|
+
};
|
|
486
|
+
});
|
|
487
|
+
var test = (parsedArgs) => {
|
|
488
|
+
const sourceFile = parsedArgs.sourceFile;
|
|
489
|
+
if (!sourceFile)
|
|
490
|
+
return (0, import_node_sdk6.sendAsyncErr)(`No source file provided`);
|
|
491
|
+
return testContract(parsedArgs, sourceFile).then((result) => [result]).then(import_node_sdk6.sendJsonRes).catch(
|
|
492
|
+
(err) => (0, import_node_sdk6.sendAsyncErr)(err, false)
|
|
493
|
+
);
|
|
435
494
|
};
|
|
436
|
-
var
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
495
|
+
var test_default = test;
|
|
496
|
+
|
|
497
|
+
// main.ts
|
|
498
|
+
var main = (parsedArgs) => {
|
|
499
|
+
const unsafeOpts = parsedArgs;
|
|
500
|
+
switch (unsafeOpts.task) {
|
|
501
|
+
case "ligo":
|
|
502
|
+
return ligo_default(unsafeOpts);
|
|
503
|
+
case "compile":
|
|
504
|
+
return compile_default(unsafeOpts);
|
|
505
|
+
case "compile-all":
|
|
506
|
+
return compile_all_default(unsafeOpts);
|
|
507
|
+
case "test":
|
|
508
|
+
return test_default(parsedArgs);
|
|
509
|
+
case "get-image":
|
|
510
|
+
return (0, import_node_sdk7.sendAsyncRes)(getLigoDockerImage());
|
|
511
|
+
default:
|
|
512
|
+
return (0, import_node_sdk7.sendAsyncErr)(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);
|
|
513
|
+
}
|
|
453
514
|
};
|
|
454
|
-
var
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
515
|
+
var main_default = main;
|
|
516
|
+
|
|
517
|
+
// index.ts
|
|
518
|
+
import_node_sdk8.Plugin.create((i18n) => ({
|
|
519
|
+
schema: "1.0",
|
|
520
|
+
version: "0.1",
|
|
521
|
+
alias: "ligo",
|
|
522
|
+
tasks: [
|
|
523
|
+
import_node_sdk8.Task.create({
|
|
524
|
+
task: "ligo",
|
|
525
|
+
command: "ligo",
|
|
526
|
+
description: "This task allows you to run arbitrary LIGO native commands. Note that they might not benefit from the abstractions provided by Taqueria",
|
|
527
|
+
options: [
|
|
528
|
+
import_node_sdk8.Option.create({
|
|
529
|
+
shortFlag: "c",
|
|
530
|
+
flag: "command",
|
|
531
|
+
type: "string",
|
|
532
|
+
description: "The command to be passed to the underlying LIGO binary, wrapped in quotes",
|
|
533
|
+
required: true
|
|
534
|
+
})
|
|
535
|
+
],
|
|
536
|
+
handler: "proxy",
|
|
537
|
+
encoding: "none"
|
|
538
|
+
}),
|
|
539
|
+
import_node_sdk8.Task.create({
|
|
540
|
+
task: "compile",
|
|
541
|
+
command: "compile <sourceFile>",
|
|
542
|
+
aliases: ["c", "compile-ligo"],
|
|
543
|
+
description: "Compile a smart contract written in a LIGO syntax to Michelson code, along with its associated storage/parameter list files if they are found",
|
|
544
|
+
options: [
|
|
545
|
+
import_node_sdk8.Option.create({
|
|
546
|
+
flag: "json",
|
|
547
|
+
boolean: true,
|
|
548
|
+
description: "Emit JSON-encoded Michelson"
|
|
549
|
+
})
|
|
550
|
+
],
|
|
551
|
+
handler: "proxy",
|
|
552
|
+
encoding: "json"
|
|
553
|
+
}),
|
|
554
|
+
import_node_sdk8.Task.create({
|
|
555
|
+
task: "compile-all",
|
|
556
|
+
command: "compile-all",
|
|
557
|
+
description: "Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found",
|
|
558
|
+
options: [
|
|
559
|
+
import_node_sdk8.Option.create({
|
|
560
|
+
flag: "json",
|
|
561
|
+
boolean: true,
|
|
562
|
+
description: "Emit JSON-encoded Michelson"
|
|
563
|
+
})
|
|
564
|
+
],
|
|
565
|
+
handler: "proxy",
|
|
566
|
+
encoding: "json"
|
|
567
|
+
}),
|
|
568
|
+
import_node_sdk8.Task.create({
|
|
569
|
+
task: "test",
|
|
570
|
+
command: "test <sourceFile>",
|
|
571
|
+
description: "Test a smart contract written in LIGO",
|
|
572
|
+
handler: "proxy",
|
|
573
|
+
encoding: "json"
|
|
574
|
+
}),
|
|
575
|
+
import_node_sdk8.Task.create({
|
|
576
|
+
task: "get-image",
|
|
577
|
+
command: "get-image",
|
|
578
|
+
description: "Gets the name of the image to be used",
|
|
579
|
+
handler: "proxy",
|
|
580
|
+
hidden: true
|
|
581
|
+
})
|
|
582
|
+
],
|
|
583
|
+
templates: [
|
|
584
|
+
import_node_sdk8.Template.create({
|
|
585
|
+
template: "contract",
|
|
586
|
+
command: "contract <sourceFileName>",
|
|
587
|
+
description: "Create a LIGO contract with boilerplate code",
|
|
588
|
+
positionals: [
|
|
589
|
+
import_node_sdk8.PositionalArg.create({
|
|
590
|
+
placeholder: "sourceFileName",
|
|
591
|
+
type: "string",
|
|
592
|
+
description: "The name of the LIGO contract to generate"
|
|
593
|
+
})
|
|
594
|
+
],
|
|
595
|
+
options: [
|
|
596
|
+
import_node_sdk8.Option.create({
|
|
597
|
+
shortFlag: "s",
|
|
598
|
+
flag: "syntax",
|
|
599
|
+
type: "string",
|
|
600
|
+
description: "The syntax used in the contract"
|
|
601
|
+
})
|
|
602
|
+
],
|
|
603
|
+
handler: createContract_default
|
|
604
|
+
})
|
|
605
|
+
],
|
|
606
|
+
proxy: main_default
|
|
607
|
+
}), process.argv);
|
|
608
|
+
//# sourceMappingURL=index.js.map
|