@taqueria/lib-ligo 0.56.15 → 0.57.8
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/common.d.ts +31 -0
- package/common.d.ts.map +1 -0
- package/compile-all.d.ts +4 -0
- package/compile-all.d.ts.map +1 -0
- package/compile.d.ts +34 -0
- package/compile.d.ts.map +1 -0
- package/createContract.d.ts +4 -0
- package/createContract.d.ts.map +1 -0
- package/index.d.ts +3 -4
- package/index.d.ts.map +1 -0
- package/index.js +19 -38
- package/index.js.map +1 -1
- package/index.mjs +19 -38
- package/index.mjs.map +1 -1
- package/ligo.d.ts +4 -0
- package/ligo.d.ts.map +1 -0
- package/ligo_templates.d.ts +3 -0
- package/ligo_templates.d.ts.map +1 -0
- package/main.d.ts +4 -0
- package/main.d.ts.map +1 -0
- package/package.json +70 -67
- package/test.d.ts +4 -0
- package/test.d.ts.map +1 -0
- package/tsconfig.json +15 -6
- package/tsconfig.tsbuildinfo +1 -0
package/common.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';
|
|
2
|
+
export interface LigoOpts extends ProxyTaskArgs.t {
|
|
3
|
+
command: string;
|
|
4
|
+
}
|
|
5
|
+
export interface CompileOpts extends ProxyTaskArgs.t {
|
|
6
|
+
sourceFile: string;
|
|
7
|
+
json: boolean;
|
|
8
|
+
module?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CompileAllOpts extends ProxyTaskArgs.t {
|
|
11
|
+
json: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface TestOpts extends RequestArgs.t {
|
|
14
|
+
task?: string;
|
|
15
|
+
sourceFile?: string;
|
|
16
|
+
}
|
|
17
|
+
export type IntersectionOpts = LigoOpts & CompileOpts & CompileAllOpts & TestOpts;
|
|
18
|
+
export type UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;
|
|
19
|
+
export declare const getInputFilenameAbsPath: (parsedArgs: UnionOpts, sourceFile: string) => string;
|
|
20
|
+
export declare const getInputFilenameRelPath: (parsedArgs: UnionOpts, sourceFile: string) => string;
|
|
21
|
+
export declare const formatLigoError: (err: Error) => Error;
|
|
22
|
+
export declare const emitExternalError: (errs: unknown[] | unknown, sourceFile: string) => void;
|
|
23
|
+
export declare const configure: (dockerImage: string, dockerImageEnvVar: string, canUseLIGOBinary: boolean) => {
|
|
24
|
+
LIGO_DEFAULT_IMAGE: string;
|
|
25
|
+
LIGO_IMAGE_ENV_VAR: string;
|
|
26
|
+
getLigoDockerImage: () => string;
|
|
27
|
+
baseDriverCmd: (projectDir: string) => string;
|
|
28
|
+
};
|
|
29
|
+
export type Common = ReturnType<typeof configure>;
|
|
30
|
+
export declare const formatStdErr: (stderr: string) => string;
|
|
31
|
+
//# sourceMappingURL=common.d.ts.map
|
package/common.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAItE,MAAM,WAAW,QAAS,SAAQ,aAAa,CAAC,CAAC;IAChD,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAY,SAAQ,aAAa,CAAC,CAAC;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa,CAAC,CAAC;IACtD,IAAI,EAAE,OAAO,CAAC;CACd;AAED,MAAM,WAAW,QAAS,SAAQ,WAAW,CAAC,CAAC;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GACzB,QAAQ,GACR,WAAW,GACX,cAAc,GACd,QAAQ,CAAC;AAEZ,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,cAAc,GAAG,QAAQ,CAAC;AAE3E,eAAO,MAAM,uBAAuB,eACvB,SAAS,cACT,MAAM,KAChB,MAKD,CAAC;AAEH,eAAO,MAAM,uBAAuB,eACvB,SAAS,cACT,MAAM,KAChB,MAAyE,CAAC;AAE7E,eAAO,MAAM,eAAe,QAAS,KAAK,KAAG,KA+B5C,CAAC;AAEF,eAAO,MAAM,iBAAiB,SACvB,OAAO,EAAE,GAAG,OAAO,cACb,MAAM,KAChB,IAOF,CAAC;AAEF,eAAO,MAAM,SAAS,gBAAiB,MAAM,qBAAqB,MAAM,oBAAoB,OAAO;;;;gCAItE,MAAM;CACjC,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAsClD,eAAO,MAAM,YAAY,WAAY,MAAM,WAS1C,CAAC"}
|
package/compile-all.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-all.d.ts","sourceRoot":"","sources":["compile-all.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAkB,cAAc,IAAI,IAAI,EAAe,MAAM,UAAU,CAAC;AAGvF,QAAA,MAAM,UAAU,cAAqB,MAAM,cAAc,IAAI,KAAG,OAAO,CAAC,IAAI,CAyB3E,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/compile.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Common, CompileOpts as Opts, UnionOpts } from './common';
|
|
2
|
+
export type TableRow = {
|
|
3
|
+
source: string;
|
|
4
|
+
artifact: string;
|
|
5
|
+
err?: unknown;
|
|
6
|
+
};
|
|
7
|
+
export type ExprKind = 'storage' | 'default_storage' | 'parameter';
|
|
8
|
+
export type Syntax = 'mligo' | 'jsligo' | 'religo' | 'ligo';
|
|
9
|
+
export type ModuleInfo = {
|
|
10
|
+
moduleName: string;
|
|
11
|
+
sourceName: string;
|
|
12
|
+
sourceFile: string;
|
|
13
|
+
syntax: Syntax;
|
|
14
|
+
type: 'file-main' | 'file-entry' | 'module-main' | 'module-entry';
|
|
15
|
+
};
|
|
16
|
+
export declare const isSupportedLigoSyntax: (sourceFile: string) => boolean;
|
|
17
|
+
export declare const isUnsupportedLigoSyntax: (sourceFile: string) => boolean;
|
|
18
|
+
export declare const isLIGOFile: (sourceFile: string) => boolean;
|
|
19
|
+
export declare const isStorageListFile: (sourceFile: string) => boolean;
|
|
20
|
+
export declare const isParameterListFile: (sourceFile: string) => boolean;
|
|
21
|
+
export declare const inject: (commonObj: Common) => {
|
|
22
|
+
getLigoDockerImage: () => string;
|
|
23
|
+
getListDeclarationsCmd: (parsedArgs: UnionOpts, sourceFile: string) => Promise<string>;
|
|
24
|
+
listContractModules: (parsedArgs: UnionOpts, sourceFile: string) => Promise<ModuleInfo[]>;
|
|
25
|
+
getCompileContractCmd: (parsedArgs: Opts, sourceFile: string, module: ModuleInfo) => Promise<string>;
|
|
26
|
+
compileContract: (parsedArgs: Opts, sourceFile: string, module: ModuleInfo) => Promise<TableRow>;
|
|
27
|
+
getCompileExprCmd: (parsedArgs: Opts, sourceFile: string, module: ModuleInfo, exprKind: ExprKind, exprName: string) => string;
|
|
28
|
+
compileExpr: (parsedArgs: Opts, sourceFile: string, module: ModuleInfo, exprKind: ExprKind) => (exprName: string) => Promise<TableRow>;
|
|
29
|
+
compileExprs: (parsedArgs: Opts, sourceFile: string, module: ModuleInfo, exprKind: ExprKind) => Promise<TableRow[]>;
|
|
30
|
+
compileContractWithStorageAndParameter: (parsedArgs: Opts, sourceFile: string, module: ModuleInfo) => Promise<TableRow[]>;
|
|
31
|
+
};
|
|
32
|
+
export declare const compile: (commonObj: Common, parsedArgs: Opts) => Promise<void>;
|
|
33
|
+
export default compile;
|
|
34
|
+
//# sourceMappingURL=compile.d.ts.map
|
package/compile.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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IAAI,cACJ,MAAM,UACV,UAAU,YACR,QAAQ,YACR,MAAM,KACd,MAAM;8BAkCI,IAAI,cACJ,MAAM,UACV,UAAU,YACR,QAAQ,gBAER,MAAM,KAAG,OAAO,CAAC,QAAQ,CAAC;+BA4BxB,IAAI,cACJ,MAAM,UACV,UAAU,YACR,QAAQ,KAChB,OAAO,CAAC,QAAQ,EAAE,CAAC;yDA2DT,IAAI,cACJ,MAAM,UACV,UAAU,KAChB,OAAO,CAAC,QAAQ,EAAE,CAAC;CAsFtB,CAAC;AAEF,eAAO,MAAM,OAAO,cACR,MAAM,cACL,IAAI,KACd,OAAO,CAAC,IAAI,CAsDd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createContract.d.ts","sourceRoot":"","sources":["createContract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAgCjD,QAAA,MAAM,cAAc,eAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,WAAW,CAAC,CAAC,kBAOlF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as PluginSchema from '@taqueria/protocol/PluginSchema';
|
|
2
|
-
|
|
3
2
|
type PluginConfigurator = (plugin: PluginSchema.RawPluginSchema) => PluginSchema.RawPluginSchema;
|
|
4
3
|
type ConfiguratorArgs = {
|
|
5
4
|
name: string;
|
|
@@ -11,6 +10,6 @@ type ConfiguratorArgs = {
|
|
|
11
10
|
canUseLIGOBinary: boolean;
|
|
12
11
|
templates?: Record<string, string>;
|
|
13
12
|
};
|
|
14
|
-
declare const configurePlugin: (settings: ConfiguratorArgs) => Promise<
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export declare const configurePlugin: (settings: ConfiguratorArgs) => Promise<any>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,YAAY,MAAM,iCAAiC,CAAC;AAKhE,KAAK,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,eAAe,KAAK,YAAY,CAAC,eAAe,CAAC;AACjG,KAAK,gBAAgB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc,gBAAgB,iBAwGzD,CAAC"}
|
package/index.js
CHANGED
|
@@ -81,15 +81,11 @@ var getLigoTemplate = async (contractName, syntax, templateOverrides) => {
|
|
|
81
81
|
const matchResult = contractName.match(/\.[^.]+$/);
|
|
82
82
|
const ext = matchResult ? matchResult[0].substring(1) : null;
|
|
83
83
|
const templates = templateOverrides ?? ligo_templates_exports;
|
|
84
|
-
if (syntax === "mligo")
|
|
85
|
-
|
|
86
|
-
if (syntax === "jsligo")
|
|
87
|
-
return templates.jsligo_template;
|
|
84
|
+
if (syntax === "mligo") return templates.mligo_template;
|
|
85
|
+
if (syntax === "jsligo") return templates.jsligo_template;
|
|
88
86
|
if (syntax === void 0) {
|
|
89
|
-
if (ext === "mligo")
|
|
90
|
-
|
|
91
|
-
if (ext === "jsligo")
|
|
92
|
-
return templates.jsligo_template;
|
|
87
|
+
if (ext === "mligo") return templates.mligo_template;
|
|
88
|
+
if (ext === "jsligo") return templates.jsligo_template;
|
|
93
89
|
return (0, import_node_sdk.sendAsyncErr)(
|
|
94
90
|
`Unable to infer LIGO syntax from "${contractName}". Please specify a LIGO syntax via the --syntax option`
|
|
95
91
|
);
|
|
@@ -292,8 +288,7 @@ var inject = (commonObj) => {
|
|
|
292
288
|
const { getLigoDockerImage } = commonObj;
|
|
293
289
|
const getListDeclarationsCmd = async (parsedArgs, sourceFile) => {
|
|
294
290
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
295
|
-
if (!projectDir)
|
|
296
|
-
throw new Error(`No project directory provided`);
|
|
291
|
+
if (!projectDir) throw new Error(`No project directory provided`);
|
|
297
292
|
const baseCmd = `${commonObj.baseDriverCmd(projectDir)} info list-declarations`;
|
|
298
293
|
const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
|
|
299
294
|
const flags = "--display-format json";
|
|
@@ -307,8 +302,7 @@ var inject = (commonObj) => {
|
|
|
307
302
|
const { stderr: unformattedStderr, stdout: unformattedStdout } = await (0, import_node_sdk3.execCmd)(cmd);
|
|
308
303
|
const stdout = unformattedStdout.replace(/method not allowed/i, "");
|
|
309
304
|
const stderr = formatStdErr(unformattedStderr);
|
|
310
|
-
if (stderr.length > 0)
|
|
311
|
-
return Promise.reject(stderr);
|
|
305
|
+
if (stderr.length > 0) return Promise.reject(stderr);
|
|
312
306
|
return JSON.parse(stdout).declarations.reduce(
|
|
313
307
|
(acc, decl) => {
|
|
314
308
|
const srcFile = removeExt((0, import_path2.basename)(sourceFile));
|
|
@@ -372,8 +366,7 @@ var inject = (commonObj) => {
|
|
|
372
366
|
};
|
|
373
367
|
const getCompileContractCmd = async (parsedArgs, sourceFile, module2) => {
|
|
374
368
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
375
|
-
if (!projectDir)
|
|
376
|
-
throw new Error(`No project directory provided`);
|
|
369
|
+
if (!projectDir) throw new Error(`No project directory provided`);
|
|
377
370
|
const baseCmd = `${commonObj.baseDriverCmd(projectDir)} compile contract`;
|
|
378
371
|
const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
|
|
379
372
|
const outputFile = `-o ${getOutputContractFilename(parsedArgs, module2)}`;
|
|
@@ -388,8 +381,7 @@ var inject = (commonObj) => {
|
|
|
388
381
|
const cmd = await getCompileContractCmd(parsedArgs, sourceFile, module2);
|
|
389
382
|
const { stderr: unformattedStderr } = await (0, import_node_sdk3.execCmd)(cmd);
|
|
390
383
|
const stderr = formatStdErr(unformattedStderr);
|
|
391
|
-
if (stderr.length > 0)
|
|
392
|
-
(0, import_node_sdk3.sendWarn)(stderr);
|
|
384
|
+
if (stderr.length > 0) (0, import_node_sdk3.sendWarn)(stderr);
|
|
393
385
|
return {
|
|
394
386
|
source: module2.sourceName,
|
|
395
387
|
artifact: getOutputContractFilename(parsedArgs, module2)
|
|
@@ -404,8 +396,7 @@ var inject = (commonObj) => {
|
|
|
404
396
|
};
|
|
405
397
|
const getCompileExprCmd = (parsedArgs, sourceFile, module2, exprKind, exprName) => {
|
|
406
398
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
407
|
-
if (!projectDir)
|
|
408
|
-
throw new Error(`No project directory provided`);
|
|
399
|
+
if (!projectDir) throw new Error(`No project directory provided`);
|
|
409
400
|
const compilerType = isStorageKind(exprKind) ? "storage" : "parameter";
|
|
410
401
|
const baseCmd = `${commonObj.baseDriverCmd(projectDir)} compile ${compilerType}`;
|
|
411
402
|
const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
|
|
@@ -431,8 +422,7 @@ var inject = (commonObj) => {
|
|
|
431
422
|
const compileExpr = (parsedArgs, sourceFile, module2, exprKind) => (exprName) => {
|
|
432
423
|
return (0, import_node_sdk3.getArch)().then(() => getCompileExprCmd(parsedArgs, sourceFile, module2, exprKind, exprName)).then(import_node_sdk3.execCmd).then(({ stderr: unformattedStderr }) => {
|
|
433
424
|
const stderr = formatStdErr(unformattedStderr);
|
|
434
|
-
if (stderr.length > 0)
|
|
435
|
-
(0, import_node_sdk3.sendWarn)(stderr);
|
|
425
|
+
if (stderr.length > 0) (0, import_node_sdk3.sendWarn)(stderr);
|
|
436
426
|
const artifactName = getOutputExprFilename(
|
|
437
427
|
parsedArgs,
|
|
438
428
|
module2,
|
|
@@ -477,8 +467,7 @@ var inject = (commonObj) => {
|
|
|
477
467
|
);
|
|
478
468
|
const errors = results.reduce((acc, result) => {
|
|
479
469
|
if (result.err) {
|
|
480
|
-
if (!(result.err instanceof Error))
|
|
481
|
-
return [...acc, result.err];
|
|
470
|
+
if (!(result.err instanceof Error)) return [...acc, result.err];
|
|
482
471
|
const ligoErrs = acc.filter((err) => err instanceof Error).map((err) => err.message);
|
|
483
472
|
const formattedError = formatLigoError(result.err);
|
|
484
473
|
return ligoErrs.includes(formattedError.message) ? acc : [...acc, formattedError];
|
|
@@ -489,8 +478,7 @@ var inject = (commonObj) => {
|
|
|
489
478
|
source,
|
|
490
479
|
artifact
|
|
491
480
|
}));
|
|
492
|
-
if (errors.length)
|
|
493
|
-
emitExternalError(errors, sourceFile);
|
|
481
|
+
if (errors.length) emitExternalError(errors, sourceFile);
|
|
494
482
|
return retval;
|
|
495
483
|
};
|
|
496
484
|
const compileContractWithStorageAndParameter = async (parsedArgs, sourceFile, module2) => {
|
|
@@ -499,8 +487,7 @@ var inject = (commonObj) => {
|
|
|
499
487
|
sourceFile,
|
|
500
488
|
module2
|
|
501
489
|
);
|
|
502
|
-
if (contractCompileResult.artifact === COMPILE_ERR_MSG)
|
|
503
|
-
return [contractCompileResult];
|
|
490
|
+
if (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];
|
|
504
491
|
const storageListFile = `${module2.moduleName}.storageList${extractExt(
|
|
505
492
|
sourceFile
|
|
506
493
|
)}`;
|
|
@@ -595,8 +582,7 @@ If your contract is defined within a namespace, please ensure that it is exporte
|
|
|
595
582
|
}
|
|
596
583
|
let allCompileResults = [];
|
|
597
584
|
for (const module2 of modules) {
|
|
598
|
-
if (parsedArgs.module && parsedArgs.module !== module2.moduleName)
|
|
599
|
-
continue;
|
|
585
|
+
if (parsedArgs.module && parsedArgs.module !== module2.moduleName) continue;
|
|
600
586
|
const compileResults = await compileContractWithStorageAndParameter(
|
|
601
587
|
parsedArgs,
|
|
602
588
|
sourceFile,
|
|
@@ -629,8 +615,7 @@ var compileAll = async (commonObj, parsedArgs) => {
|
|
|
629
615
|
}
|
|
630
616
|
);
|
|
631
617
|
for (const filename of contractFilenames) {
|
|
632
|
-
if (isStorageListFile(filename) || isParameterListFile(filename))
|
|
633
|
-
continue;
|
|
618
|
+
if (isStorageListFile(filename) || isParameterListFile(filename)) continue;
|
|
634
619
|
const moduleNames = await listContractModules(parsedArgs, filename);
|
|
635
620
|
for (const moduleName of moduleNames) {
|
|
636
621
|
compilePromises.push(compileContractWithStorageAndParameter(parsedArgs, filename, moduleName));
|
|
@@ -644,8 +629,7 @@ var compile_all_default = compileAll;
|
|
|
644
629
|
var import_node_sdk5 = require("@taqueria/node-sdk");
|
|
645
630
|
var getArbitraryLigoCmd = (commonObj, parsedArgs, userArgs) => {
|
|
646
631
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
647
|
-
if (!projectDir)
|
|
648
|
-
throw `No project directory provided`;
|
|
632
|
+
if (!projectDir) throw `No project directory provided`;
|
|
649
633
|
const processedUserArgs = userArgs.split(" ").map((arg) => arg.startsWith("\\-") ? arg.substring(1) : arg).filter((arg) => arg);
|
|
650
634
|
const cmd = `${commonObj.baseDriverCmd(projectDir)} ${processedUserArgs.join(" ")}`;
|
|
651
635
|
const envVars = { DOCKER_DEFAULT_PLATFORM: "linux/amd64" };
|
|
@@ -669,8 +653,7 @@ var inject2 = (commonObj) => {
|
|
|
669
653
|
const { baseDriverCmd: baseDriverCmd2 } = commonObj;
|
|
670
654
|
const getTestContractCmd = (parsedArgs, sourceFile) => {
|
|
671
655
|
const projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;
|
|
672
|
-
if (!projectDir)
|
|
673
|
-
throw `No project directory provided`;
|
|
656
|
+
if (!projectDir) throw `No project directory provided`;
|
|
674
657
|
const baseCmd = `${baseDriverCmd2(projectDir)} run test`;
|
|
675
658
|
const inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);
|
|
676
659
|
const cmd = `${baseCmd} ${inputFile}`;
|
|
@@ -679,8 +662,7 @@ var inject2 = (commonObj) => {
|
|
|
679
662
|
const testContract = (parsedArgs, sourceFile) => (0, import_node_sdk6.getArch)().then(() => getTestContractCmd(parsedArgs, sourceFile)).then(import_node_sdk6.execCmd).then(({ stdout: unformattedStdout, stderr: unformattedStdErr }) => {
|
|
680
663
|
const stdout = unformattedStdout.replace(/method not allowed\n/gi, "");
|
|
681
664
|
const stderr = formatStdErr(unformattedStdErr);
|
|
682
|
-
if (stderr.length > 0)
|
|
683
|
-
(0, import_node_sdk6.sendWarn)(stderr);
|
|
665
|
+
if (stderr.length > 0) (0, import_node_sdk6.sendWarn)(stderr);
|
|
684
666
|
const result = "\u{1F389} All tests passed \u{1F389}";
|
|
685
667
|
return {
|
|
686
668
|
contract: sourceFile,
|
|
@@ -702,8 +684,7 @@ ${result}` : result
|
|
|
702
684
|
var test = (commonObj, parsedArgs) => {
|
|
703
685
|
const { testContract } = inject2(commonObj);
|
|
704
686
|
const sourceFile = parsedArgs.sourceFile;
|
|
705
|
-
if (!sourceFile)
|
|
706
|
-
return (0, import_node_sdk6.sendAsyncErr)(`No source file provided`);
|
|
687
|
+
if (!sourceFile) return (0, import_node_sdk6.sendAsyncErr)(`No source file provided`);
|
|
707
688
|
return testContract(parsedArgs, sourceFile).then((result) => [result]).then(import_node_sdk6.sendJsonRes).catch((err) => (0, import_node_sdk6.sendAsyncErr)(err, false));
|
|
708
689
|
};
|
|
709
690
|
var test_default = test;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","compile-all.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport * as PluginSchema from '@taqueria/protocol/PluginSchema';\n\nimport createContract from './createContract';\nimport main from './main';\n\ntype PluginConfigurator = (plugin: PluginSchema.RawPluginSchema) => PluginSchema.RawPluginSchema;\ntype ConfiguratorArgs = {\n\tname: string;\n\talias: string;\n\tconfigurator?: PluginConfigurator;\n\tunparsedArgs: string[];\n\tdockerImage: string;\n\tdockerImageEnvVar: string;\n\tcanUseLIGOBinary: boolean;\n\ttemplates?: Record<string, string>;\n};\n\nexport const configurePlugin = (settings: ConfiguratorArgs) => {\n\tconst schema = {\n\t\tname: settings.name,\n\t\tschema: '1.0',\n\t\tversion: '0.1',\n\t\talias: settings.alias,\n\t\ttasks: [\n\t\t\tTask.create({\n\t\t\t\ttask: 'ligo',\n\t\t\t\tcommand: 'ligo',\n\t\t\t\tdescription:\n\t\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\t\toptions: [\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\t\tflag: 'command',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\thandler: 'proxy',\n\t\t\t\tencoding: 'none',\n\t\t\t}),\n\t\t\tTask.create({\n\t\t\t\ttask: 'compile',\n\t\t\t\tcommand: 'compile <sourceFile>',\n\t\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\t\tdescription:\n\t\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\t\toptions: [\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tflag: 'json',\n\t\t\t\t\t\tboolean: true,\n\t\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t\t}),\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tflag: 'module',\n\t\t\t\t\t\tshortFlag: 'm',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The LIGO module to be compiled',\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\thandler: 'proxy',\n\t\t\t\tencoding: 'json',\n\t\t\t}),\n\t\t\tTask.create({\n\t\t\t\ttask: 'compile-all',\n\t\t\t\tcommand: 'compile-all',\n\t\t\t\tdescription:\n\t\t\t\t\t'Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found',\n\t\t\t\toptions: [\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tflag: 'json',\n\t\t\t\t\t\tboolean: true,\n\t\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\thandler: 'proxy',\n\t\t\t\tencoding: 'json',\n\t\t\t}),\n\t\t\tTask.create({\n\t\t\t\ttask: 'test',\n\t\t\t\tcommand: 'test <sourceFile>',\n\t\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\t\thandler: 'proxy',\n\t\t\t\tencoding: 'json',\n\t\t\t}),\n\t\t\tTask.create({\n\t\t\t\ttask: 'get-image',\n\t\t\t\tcommand: 'get-image',\n\t\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\t\thandler: 'proxy',\n\t\t\t\thidden: true,\n\t\t\t}),\n\t\t],\n\t\ttemplates: [\n\t\t\tTemplate.create({\n\t\t\t\ttemplate: 'contract',\n\t\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\t\tpositionals: [\n\t\t\t\t\tPositionalArg.create({\n\t\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\toptions: [\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\thandler: createContract(settings.templates),\n\t\t\t}),\n\t\t],\n\t\tproxy: main(settings.dockerImage, settings.dockerImageEnvVar, settings.canUseLIGOBinary),\n\t\tpostInstall: `node ${__dirname}/postinstall.js`,\n\t};\n\n\treturn Plugin.create(() => settings.configurator ? settings.configurator(schema) : schema, settings.unparsedArgs);\n};\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport * as default_templates from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst getLigoTemplate = async (\n\tcontractName: string,\n\tsyntax: string | undefined,\n\ttemplateOverrides?: Record<string, string>,\n): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\tconst templates = templateOverrides ?? default_templates;\n\n\tif (syntax === 'mligo') return templates.mligo_template;\n\tif (syntax === 'jsligo') return templates.jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return templates.mligo_template;\n\t\tif (ext === 'jsligo') return templates.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 = (templates?: Record<string, string>) => (args: RequestArgs.t) => {\n\tconst unsafeOpts = args as unknown as Opts;\n\tconst contractName = unsafeOpts.sourceFileName as string;\n\tconst syntax = unsafeOpts.syntax;\n\tconst contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax, templates)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\ntype return = operation list * storage\n\n(* Three entrypoints *)\n[@entry] let increment (delta : int) (store : storage) : return =\n [], store + delta\n[@entry] let decrement (delta : int) (store : storage) : return =\n [], store - delta\n[@entry] let reset (() : unit) (_ : storage) : return =\n [], 0\n`;\n\nexport const jsligo_template = `\ntype storage = int;\ntype ret = [list<operation>, storage];\n\n// Three entrypoints\n\n// @entry\nconst increment = (delta : int, store : storage) : ret =>\n [list([]), store + delta];\n\n// @entry\nconst decrement = (delta : int, store : storage) : ret =>\n [list([]), store - delta];\n\n// @entry\nconst reset = (_ : unit, _ : storage) : ret =>\n [list([]), 0];\n`;\n","import { RequestArgs, sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';\nimport { configure, IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport compileAll from './compile-all';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main =\n\t(dockerImage: string, dockerImageEnvVar: string, canUseLIGOBinary: boolean) =>\n\t(parsedArgs: RequestArgs.t): Promise<void> => {\n\t\tconst commonObj = configure(dockerImage, dockerImageEnvVar, canUseLIGOBinary);\n\t\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\t\tswitch (unsafeOpts.task) {\n\t\t\tcase 'ligo':\n\t\t\t\treturn ligo(commonObj, unsafeOpts);\n\t\t\tcase 'compile':\n\t\t\t\treturn compile(commonObj, unsafeOpts);\n\t\t\tcase 'compile-all':\n\t\t\t\treturn compileAll(commonObj, unsafeOpts);\n\t\t\tcase 'test':\n\t\t\t\treturn test(commonObj, parsedArgs);\n\t\t\tcase 'get-image':\n\t\t\t\treturn sendAsyncRes(commonObj.getLigoDockerImage());\n\t\t\tdefault:\n\t\t\t\treturn sendAsyncErr(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);\n\t\t}\n\t};\n\nexport default main;\n","import { getDockerImage, sendErr } from '@taqueria/node-sdk';\nimport { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';\nimport * as fs from 'fs';\nimport { delimiter, join } from 'path';\n\nexport interface LigoOpts extends ProxyTaskArgs.t {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends ProxyTaskArgs.t {\n\tsourceFile: string;\n\tjson: boolean;\n\tmodule?: string;\n}\n\nexport interface CompileAllOpts extends ProxyTaskArgs.t {\n\tjson: boolean;\n}\n\nexport interface TestOpts extends RequestArgs.t {\n\ttask?: string;\n\tsourceFile?: string;\n}\n\nexport type IntersectionOpts =\n\t& LigoOpts\n\t& CompileOpts\n\t& CompileAllOpts\n\t& TestOpts;\n\nexport type UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;\n\nexport const getInputFilenameAbsPath = (\n\tparsedArgs: UnionOpts,\n\tsourceFile: string,\n): string =>\n\tjoin(\n\t\tparsedArgs.config.projectDir,\n\t\tparsedArgs.config.contractsDir ?? 'contracts',\n\t\tsourceFile,\n\t);\n\nexport const getInputFilenameRelPath = (\n\tparsedArgs: UnionOpts,\n\tsourceFile: string,\n): string => join(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const formatLigoError = (err: Error): Error => {\n\tlet result = err.message.replace(/Command failed.+?\\n/, '');\n\tif (\n\t\tresult.includes(\n\t\t\t'An internal error ocurred. Please, contact the developers.',\n\t\t)\n\t\t&& result.includes('Module Contract not found with last Contract.')\n\t) {\n\t\tresult =\n\t\t\t`By convention, Taqueria expects you to import your contract with Contract as the module name.\\nFor instance, if you have a contract in a file called \"increment.mligo\", in your parameter/storage list file you must include #import \"Increment.mligo\" \"Contract\" for compilation to be successful.`;\n\t} else {\n\t\tconst regex = /contracts\\/(.+): No such file or directory/;\n\t\tconst match = regex.exec(result);\n\t\tif (match) {\n\t\t\tconst filename = match[1];\n\t\t\tresult =\n\t\t\t\t`The file ${filename} was not found. Please ensure that the file exists and that it is in the contracts directory.`;\n\t\t}\n\t}\n\n\terr.message = result\n\t\t.replace(\n\t\t\t'An internal error ocurred. Please, contact the developers.',\n\t\t\t'The LIGO compiler experienced an internal error. Please contact the LIGO developers.',\n\t\t)\n\t\t.replace(\n\t\t\t/Module (\"Contract\\.[^\"]+\") not found/,\n\t\t\t'The module $1 was not found. If your contract is defined within a namespace, please ensure that it has been exported.',\n\t\t);\n\n\treturn err;\n};\n\nexport const emitExternalError = (\n\terrs: unknown[] | unknown,\n\tsourceFile: string,\n): void => {\n\tsendErr(`\\n=== Error messages for ${sourceFile} ===`);\n\tconst errors = Array.isArray(errs) ? errs : [errs];\n\terrors.map(err => {\n\t\terr instanceof Error ? sendErr(err.message) : sendErr(err as any);\n\t});\n\tsendErr(`===`);\n};\n\nexport const configure = (dockerImage: string, dockerImageEnvVar: string, canUseLIGOBinary: boolean) => ({\n\tLIGO_DEFAULT_IMAGE: dockerImage,\n\tLIGO_IMAGE_ENV_VAR: dockerImageEnvVar,\n\tgetLigoDockerImage: () => getDockerImage(dockerImage, dockerImageEnvVar),\n\tbaseDriverCmd: (projectDir: string) => baseDriverCmd(projectDir, dockerImage, canUseLIGOBinary),\n});\n\nexport type Common = ReturnType<typeof configure>;\nfunction exists(path: string): boolean {\n\ttry {\n\t\tfs.accessSync(path, fs.constants.X_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction getLigoBinaryFromPath() {\n\tconst { PATH } = process.env;\n\tif (!PATH) {\n\t\treturn null;\n\t}\n\tconst paths = PATH.split(delimiter);\n\tfor (const candidatePath of paths) {\n\t\tconst possibleLigoPath = join(candidatePath, 'ligo');\n\t\tif (exists(possibleLigoPath)) {\n\t\t\treturn possibleLigoPath;\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction baseDriverCmd(\n\tprojectDir: string,\n\tligoDockerImage: string,\n\tcanUseLIGOBinary: boolean,\n): string {\n\tconst ligoBinaryFromPath = canUseLIGOBinary ? getLigoBinaryFromPath() : null;\n\tif (ligoBinaryFromPath !== null) {\n\t\treturn ligoBinaryFromPath;\n\t} else {\n\t\treturn `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${ligoDockerImage}`;\n\t}\n}\n\nexport const formatStdErr = (stderr: string) => {\n\t// Temporary fix for issue: https://gitlab.com/ligolang/ligo/-/issues/2176\n\tif (stderr.length > 0 && stderr.includes('create directory //.ligo')) {\n\t\treturn stderr\n\t\t\t.replace(/create directory \\/\\/\\.ligo: Permission denied/, '')\n\t\t\t.replace(/create temporary file \\/\\/\\.ligo\\/.*.tmp: No such file or directory/, '')\n\t\t\t.trim();\n\t}\n\treturn stderr;\n};\n","import {\n\texecCmd,\n\tgetArch,\n\tgetArtifactsDir,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tsendRes,\n\tsendWarn,\n} from '@taqueria/node-sdk';\nimport { createReadStream } from 'fs';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport * as readline from 'readline';\nimport {\n\tCommon,\n\tCompileOpts as Opts,\n\temitExternalError,\n\tformatLigoError,\n\tformatStdErr,\n\tgetInputFilenameAbsPath,\n\tgetInputFilenameRelPath,\n\tUnionOpts,\n} from './common';\n\nexport type TableRow = { source: string; artifact: string; err?: unknown };\n\nexport type ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nexport type Syntax = 'mligo' | 'jsligo' | 'religo' | 'ligo';\n\nexport type ModuleInfo = {\n\tmoduleName: string;\n\tsourceName: string;\n\tsourceFile: string;\n\tsyntax: Syntax;\n\ttype: 'file-main' | 'file-entry' | 'module-main' | 'module-entry';\n};\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nexport const isSupportedLigoSyntax = (sourceFile: string) => /\\.(mligo|jsligo)$/.test(sourceFile);\n\nexport const isUnsupportedLigoSyntax = (sourceFile: string) => /\\.(ligo|religo)$/.test(sourceFile);\n\nexport const isLIGOFile = (sourceFile: string) =>\n\tisSupportedLigoSyntax(sourceFile) || isUnsupportedLigoSyntax(sourceFile);\n\nexport const isStorageListFile = (sourceFile: string): boolean =>\n\t/.+\\.(storageList|storages)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const isParameterListFile = (sourceFile: string): boolean =>\n\t/.+\\.(parameterList|parameters)\\.(ligo|religo|mligo|jsligo)$/.test(\n\t\tsourceFile,\n\t);\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst isOutputFormatJSON = (parsedArgs: Opts): boolean => parsedArgs.json;\n\nconst getOutputContractFilename = (\n\tparsedArgs: Opts,\n\tmodule: ModuleInfo,\n): string => {\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\treturn join(getArtifactsDir(parsedArgs), `${module.moduleName}${ext}`);\n};\n\nconst getOutputExprFilename = (\n\tparsedArgs: Opts,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n\texprName: string,\n): string => {\n\tconst contractName = module.moduleName;\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage${ext}`\n\t\t: `${contractName}.${exprKind}.${exprName}${ext}`;\n\treturn join(getArtifactsDir(parsedArgs), `${outputFile}`);\n};\n\nconst getExprNames = (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n): Promise<string[]> => {\n\treturn new Promise((resolve, reject) => {\n\t\tconst inputFilePath = getInputFilenameAbsPath(parsedArgs, sourceFile);\n\t\tconst readInterface = readline.createInterface({\n\t\t\tinput: createReadStream(inputFilePath),\n\t\t\toutput: process.stdout,\n\t\t});\n\n\t\tconst variableNames: string[] = [];\n\n\t\treadInterface.on('line', function(line) {\n\t\t\t// Skip lines that start with a comment\n\t\t\tif (!line.trim().startsWith('//')) {\n\t\t\t\tconst matches = line.match(/(?<=\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g);\n\t\t\t\tif (matches) {\n\t\t\t\t\tvariableNames.push(...matches);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treadInterface.on('close', function() {\n\t\t\tresolve(variableNames);\n\t\t});\n\t});\n};\n\n// Helper function to get the initial message based on the pair value\nconst getInitialMessage = (pair: string, module: ModuleInfo) => {\n\tconst messages = {\n\t\t'mligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t// ... any other combinations\n\t} as Record<string, string>;\n\n\treturn messages[pair] || '// This file was created by Taqueria.';\n};\n\n// Helper function to get a common message\nconst getCommonMsg = (langType: Syntax, listType: ExprKind, moduleInfo: ModuleInfo) => {\n\tconst varKeyword = langType === 'mligo' ? 'let' : 'const';\n\tconst namespaceSelector = moduleInfo.type.startsWith('module') ? '[Namespace].' : '';\n\tconst commonMsgForStorage = `// IMPORTANT: We suggest always explicitly typing your storage values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} storage: int = 10\\` or \\`${varKeyword} storage: Contract.${namespaceSelector}storage = 10\\``;\n\n\tconst commonMsgForParameter = `// IMPORTANT: We suggest always explicitly typing your parameter values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} parameter: int = 10\\` or \\`${varKeyword} parameter: Contract.${namespaceSelector}parameter = 10\\``;\n\n\treturn listType === 'storage' ? commonMsgForStorage : commonMsgForParameter;\n};\n\n// Main function to get the content for storage or parameter\nconst getContent = (moduleInfo: ModuleInfo, listType: ExprKind) => {\n\tconst linkToContract = `#import \"${moduleInfo.sourceFile}\" \"Contract\"`;\n\tconst pair = `${moduleInfo.syntax}-${moduleInfo.type}`;\n\tconst initialMsg = getInitialMessage(pair, moduleInfo);\n\tconst commonMsg = getCommonMsg(moduleInfo.syntax, listType, moduleInfo);\n\n\treturn `${linkToContract}\\n\\n${initialMsg}\\n\\n${commonMsg}`;\n};\n\n// Usage for storage list\nconst initContentForStorage = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'storage');\n\n// Usage for parameter list\nconst initContentForParameter = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'parameter');\n\n// Inject commonObj to return some functions\nexport const inject = (commonObj: Common) => {\n\tconst { getLigoDockerImage } = commonObj;\n\n\tconst getListDeclarationsCmd = async (\n\t\tparsedArgs: UnionOpts,\n\t\tsourceFile: string,\n\t): Promise<string> => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\t\tif (!projectDir) throw new Error(`No project directory provided`);\n\t\tconst baseCmd = `${commonObj.baseDriverCmd(projectDir)} info list-declarations`;\n\t\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\t\tconst flags = '--display-format json';\n\t\tconst cmd = `${baseCmd} ${inputFile} ${flags}`;\n\t\treturn cmd;\n\t};\n\n\tconst listContractModules = async (\n\t\tparsedArgs: UnionOpts,\n\t\tsourceFile: string,\n\t): Promise<ModuleInfo[]> => {\n\t\ttry {\n\t\t\tawait getArch();\n\t\t\tconst cmd = await getListDeclarationsCmd(parsedArgs, sourceFile);\n\t\t\tconst { stderr: unformattedStderr, stdout: unformattedStdout } = await execCmd(cmd);\n\n\t\t\t// Workaround for https://gitlab.com/ligolang/ligo/-/issues/2189\n\t\t\tconst stdout = unformattedStdout.replace(/method not allowed/i, '');\n\t\t\tconst stderr = formatStdErr(unformattedStderr);\n\n\t\t\tif (stderr.length > 0) return Promise.reject(stderr);\n\n\t\t\treturn JSON.parse(stdout).declarations.reduce(\n\t\t\t\t(acc: ModuleInfo[], decl: string) => {\n\t\t\t\t\t// We need to process delcarations (decl) like so:\n\t\t\t\t\t// 1. If the decl is equal to the string \"main\", then the module type is \"file-main\" and the name of the module is the sourceFile.\n\t\t\t\t\t// 2. If the decl is equal to $main, then the module type is \"file-entry\" and the name fo the module is the sourceFile.\n\t\t\t\t\t// 3. If the decl ends with .main, then the module type is \"module-main\" and the name of the module is the decl without the .main suffix.\n\t\t\t\t\t// 4. If the decl ends with .$main, then the module type is \"module-entry\" and the name of the module is the decl without the .$main suffix.\n\t\t\t\t\t// Otherwise, this is not a declaration we care about.\n\t\t\t\t\tconst srcFile = removeExt(basename(sourceFile));\n\t\t\t\t\tconst syntax = extractExt(sourceFile).replace('.', '');\n\n\t\t\t\t\tif (decl === 'main') {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoduleName: srcFile,\n\t\t\t\t\t\t\t\tsourceName: sourceFile,\n\t\t\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\t\t\ttype: 'file-main',\n\t\t\t\t\t\t\t\tsyntax,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t} else if (decl === '$main') {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoduleName: srcFile,\n\t\t\t\t\t\t\t\tsourceName: sourceFile,\n\t\t\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\t\t\ttype: 'file-entry',\n\t\t\t\t\t\t\t\tsyntax,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t} else if (decl.endsWith('.main')) {\n\t\t\t\t\t\tconst moduleName = decl.replace(/\\.main$/, '');\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\t\t\ttype: 'module-main',\n\t\t\t\t\t\t\t\tsyntax,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t} else if (decl.endsWith('.$main')) {\n\t\t\t\t\t\tconst moduleName = decl.replace(/\\.\\$main$/, '');\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\t\t\ttype: 'module-entry',\n\t\t\t\t\t\t\t\tsyntax,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t[],\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tconst formattedErr = err instanceof Error ? formatLigoError(err) : err;\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn [];\n\t\t}\n\t};\n\n\tconst getCompileContractCmd = async (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t): Promise<string> => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\t\tif (!projectDir) throw new Error(`No project directory provided`);\n\t\tconst baseCmd = `${commonObj.baseDriverCmd(projectDir)} compile contract`;\n\t\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\t\tconst outputFile = `-o ${getOutputContractFilename(parsedArgs, module)}`;\n\t\tconst flags = isOutputFormatJSON(parsedArgs)\n\t\t\t? ' --michelson-format json '\n\t\t\t: '';\n\t\tconst moduleFlag = module.type.startsWith('file-')\n\t\t\t? ''\n\t\t\t: `-m ${module.moduleName}`;\n\t\tconst cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}${moduleFlag}`;\n\t\treturn cmd;\n\t};\n\n\tconst compileContract = async (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t): Promise<TableRow> => {\n\t\ttry {\n\t\t\tawait getArch();\n\t\t\tconst cmd = await getCompileContractCmd(parsedArgs, sourceFile, module);\n\t\t\tconst { stderr: unformattedStderr } = await execCmd(cmd);\n\t\t\tconst stderr = formatStdErr(unformattedStderr);\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\n\t\t\treturn {\n\t\t\t\tsource: module.sourceName,\n\t\t\t\tartifact: getOutputContractFilename(parsedArgs, module),\n\t\t\t};\n\t\t} catch (err) {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tsource: module.sourceName,\n\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t};\n\t\t}\n\t};\n\n\tconst getCompileExprCmd = (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t\texprKind: ExprKind,\n\t\texprName: string,\n\t): string => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\t\tif (!projectDir) throw new Error(`No project directory provided`);\n\t\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\t\tconst baseCmd = `${commonObj.baseDriverCmd(projectDir)} compile ${compilerType}`;\n\t\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\t\tconst outputFile = `-o ${\n\t\t\tgetOutputExprFilename(\n\t\t\t\tparsedArgs,\n\t\t\t\tmodule,\n\t\t\t\texprKind,\n\t\t\t\texprName,\n\t\t\t)\n\t\t}`;\n\t\tconst flags = isOutputFormatJSON(parsedArgs)\n\t\t\t? ' --michelson-format json '\n\t\t\t: '';\n\n\t\t// Parameter and Storage list files are expected to import the smart contract file as the \"Contract\" module.\n\t\tconst moduleFlag = (() => {\n\t\t\tswitch (module.type) {\n\t\t\t\tcase 'file-main':\n\t\t\t\tcase 'file-entry':\n\t\t\t\t\treturn '-m Contract';\n\t\t\t\tdefault:\n\t\t\t\t\treturn `-m Contract.${module.moduleName}`;\n\t\t\t}\n\t\t})();\n\n\t\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags} ${moduleFlag}`;\n\t\treturn cmd;\n\t};\n\n\tconst compileExpr = (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t\texprKind: ExprKind,\n\t) =>\n\t(exprName: string): Promise<TableRow> => {\n\t\treturn getArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, module, exprKind, exprName))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr: unformattedStderr }) => {\n\t\t\t\tconst stderr = formatStdErr(unformattedStderr);\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\tconst artifactName = getOutputExprFilename(\n\t\t\t\t\tparsedArgs,\n\t\t\t\t\tmodule,\n\t\t\t\t\texprKind,\n\t\t\t\t\texprName,\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: artifactName,\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: `${exprName} in ${sourceFile} not compiled`,\n\t\t\t\t\terr,\n\t\t\t\t};\n\t\t\t});\n\t};\n\n\tconst compileExprs = async (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t\texprKind: ExprKind,\n\t): Promise<TableRow[]> => {\n\t\t// Get expressions from file\n\t\tlet exprs = [];\n\t\ttry {\n\t\t\texprs = await getExprNames(parsedArgs, sourceFile);\n\t\t} catch (err) {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} expressions compiled`,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\tconst results = await Promise.all(\n\t\t\texprs.map(async (exprName, index) => {\n\t\t\t\tconst compileResult = await compileExpr(\n\t\t\t\t\tparsedArgs,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tmodule,\n\t\t\t\t\texprKind === 'storage' && exprName === 'default_storage' ? 'default_storage' : exprKind,\n\t\t\t\t)(exprName);\n\t\t\t\treturn compileResult;\n\t\t\t}),\n\t\t);\n\n\t\t// Collect errors\n\t\tconst errors = results.reduce((acc, result) => {\n\t\t\tif (result.err) {\n\t\t\t\t// If its not an Error object, then just add it to the list\n\t\t\t\tif (!(result.err instanceof Error)) return [...acc, result.err];\n\n\t\t\t\t// Otherwise, get all ligo errors and ensure that the list is unique\n\t\t\t\tconst ligoErrs = (\n\t\t\t\t\tacc.filter(err => err instanceof Error) as Error[]\n\t\t\t\t).map(err => err.message);\n\n\t\t\t\tconst formattedError = formatLigoError(result.err);\n\n\t\t\t\treturn ligoErrs.includes(formattedError.message)\n\t\t\t\t\t? acc\n\t\t\t\t\t: [...acc, formattedError];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] as unknown[]);\n\n\t\t// Collect table rows\n\t\tconst retval = results.map(({ source, artifact }) => ({\n\t\t\tsource,\n\t\t\tartifact,\n\t\t}));\n\n\t\tif (errors.length) emitExternalError(errors, sourceFile);\n\n\t\treturn retval;\n\t};\n\n\tconst compileContractWithStorageAndParameter = async (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t): Promise<TableRow[]> => {\n\t\tconst contractCompileResult = await compileContract(\n\t\t\tparsedArgs,\n\t\t\tsourceFile,\n\t\t\tmodule,\n\t\t);\n\t\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\n\t\tconst storageListFile = `${module.moduleName}.storageList${\n\t\t\textractExt(\n\t\t\t\tsourceFile,\n\t\t\t)\n\t\t}`;\n\t\tconst storageListFilename = getInputFilenameAbsPath(\n\t\t\tparsedArgs,\n\t\t\tstorageListFile,\n\t\t);\n\t\tconst storageCompileResult = await access(storageListFilename)\n\t\t\t.then(() => compileExprs(parsedArgs, storageListFile, module, 'storage'))\n\t\t\t.catch(() => {\n\t\t\t\tsendWarn(\n\t\t\t\t\t`Note: storage file associated with \"${module.moduleName}\" 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\t);\n\t\t\t\treturn writeFile(\n\t\t\t\t\tstorageListFilename,\n\t\t\t\t\tinitContentForStorage(module),\n\t\t\t\t\t'utf8',\n\t\t\t\t);\n\t\t\t});\n\n\t\tconst parameterListFile = `${module.moduleName}.parameterList${\n\t\t\textractExt(\n\t\t\t\tsourceFile,\n\t\t\t)\n\t\t}`;\n\t\tconst parameterListFilename = getInputFilenameAbsPath(\n\t\t\tparsedArgs,\n\t\t\tparameterListFile,\n\t\t);\n\t\tconst parameterCompileResult = await access(parameterListFilename)\n\t\t\t.then(() => compileExprs(parsedArgs, parameterListFile, module, 'parameter'))\n\t\t\t.catch(() => {\n\t\t\t\tsendWarn(\n\t\t\t\t\t`Note: parameter file associated with \"${module.moduleName}\" 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\t);\n\t\t\t\treturn writeFile(\n\t\t\t\t\tparameterListFilename,\n\t\t\t\t\tinitContentForParameter(module),\n\t\t\t\t\t'utf8',\n\t\t\t\t);\n\t\t\t});\n\n\t\tconst storageArtifacts = storageCompileResult\n\t\t\t? storageCompileResult.map(res => res.artifact).join('\\n')\n\t\t\t: '';\n\t\tconst parameterArtifacts = parameterCompileResult\n\t\t\t? parameterCompileResult.map(res => res.artifact).join('\\n')\n\t\t\t: '';\n\n\t\tconst combinedArtifact = [\n\t\t\tcontractCompileResult.artifact,\n\t\t\tstorageArtifacts,\n\t\t\tparameterArtifacts,\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join('\\n');\n\n\t\tconst combinedRow: TableRow = {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: combinedArtifact,\n\t\t};\n\n\t\treturn [combinedRow];\n\t};\n\n\treturn {\n\t\tgetLigoDockerImage,\n\t\tgetListDeclarationsCmd,\n\t\tlistContractModules,\n\t\tgetCompileContractCmd,\n\t\tcompileContract,\n\t\tgetCompileExprCmd,\n\t\tcompileExpr,\n\t\tcompileExprs,\n\t\tcompileContractWithStorageAndParameter,\n\t};\n};\n\nexport const compile = async (\n\tcommonObj: Common,\n\tparsedArgs: Opts,\n): Promise<void> => {\n\tconst { listContractModules, compileContractWithStorageAndParameter } = inject(commonObj);\n\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!isLIGOFile(sourceFile)) {\n\t\tsendErr(`${sourceFile} is not a LIGO file`);\n\t\treturn;\n\t}\n\tif (isStorageListFile(sourceFile) || isParameterListFile(sourceFile)) {\n\t\tsendErr(\n\t\t\t`Storage and parameter list files are not meant to be compiled directly`,\n\t\t);\n\t\treturn;\n\t}\n\tif (isUnsupportedLigoSyntax(sourceFile)) {\n\t\tsendErr(\n\t\t\t`Unsupported LIGO syntax detected in ${sourceFile}. Note, we only support .jsligo and .mligo files.`,\n\t\t);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst modules = await listContractModules(parsedArgs, sourceFile);\n\t\tif (modules.length === 0) {\n\t\t\thttps:\n\t\t\t// gitlab.com/ligolang/ligo/-/issues/2189\n\t\t\treturn sendJsonRes([\n\t\t\t\t{\n\t\t\t\t\tsource: sourceFile,\n\t\t\t\t\tartifact:\n\t\t\t\t\t\t`No contract modules found in \"${sourceFile}\".\\nIf your contract is defined within a namespace, please ensure that it is exported from the contract file.\"`,\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tlet allCompileResults: TableRow[] = [];\n\t\tfor (const module of modules) {\n\t\t\t// If we're only to compile a particular module, then we'll skip any that don't match\n\t\t\tif (parsedArgs.module && parsedArgs.module !== module.moduleName) continue;\n\n\t\t\tconst compileResults = await compileContractWithStorageAndParameter(\n\t\t\t\tparsedArgs,\n\t\t\t\tsourceFile,\n\t\t\t\tmodule,\n\t\t\t);\n\t\t\tallCompileResults = allCompileResults.concat(compileResults);\n\t\t}\n\n\t\tsendJsonRes(allCompileResults, {\n\t\t\tfooter: `\\nCompiled ${allCompileResults.length} contract(s) in \"${sourceFile}\"`,\n\t\t});\n\t} catch (err) {\n\t\tsendErr(`Error processing \"${sourceFile}\": ${err}`);\n\t}\n};\n\nexport default compile;\n","import { sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport glob from 'fast-glob';\nimport { join } from 'path';\nimport { Common, CompileAllOpts, CompileAllOpts as Opts, CompileOpts } from './common';\nimport { inject, isParameterListFile, isStorageListFile, TableRow } from './compile';\n\nconst compileAll = async (commonObj: Common, parsedArgs: Opts): Promise<void> => {\n\tconst { listContractModules, compileContractWithStorageAndParameter } = inject(commonObj);\n\n\tlet compilePromises: Promise<TableRow[]>[] = [];\n\n\tconst contractFilenames = await glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{\n\t\t\tcwd: join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts'),\n\t\t\tabsolute: false,\n\t\t},\n\t);\n\n\tfor (const filename of contractFilenames) {\n\t\tif (isStorageListFile(filename) || isParameterListFile(filename)) continue;\n\t\tconst moduleNames = await listContractModules(parsedArgs as unknown as CompileAllOpts, filename);\n\t\tfor (const moduleName of moduleNames) {\n\t\t\tcompilePromises.push(compileContractWithStorageAndParameter(parsedArgs as CompileOpts, filename, moduleName));\n\t\t}\n\t}\n\n\treturn Promise.all(compilePromises)\n\t\t.then(tables => tables.flat())\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendErr(err, false));\n};\n\nexport default compileAll;\n","import { sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { Common, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (\n\tcommonObj: Common,\n\tparsedArgs: Opts,\n\tuserArgs: string,\n): [string, Record<string, string>] => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\n\tconst processedUserArgs = userArgs\n\t\t.split(' ')\n\t\t.map(arg => (arg.startsWith('\\\\-') ? arg.substring(1) : arg))\n\t\t.filter(arg => arg);\n\n\tconst cmd = `${commonObj.baseDriverCmd(projectDir)} ${processedUserArgs.join(' ')}`;\n\n\tconst envVars = { DOCKER_DEFAULT_PLATFORM: 'linux/amd64' };\n\treturn [cmd, envVars];\n};\n\nconst runArbitraryLigoCmd = (\n\tcommonObj: Common,\n\tparsedArgs: Opts,\n\tuserCmd: string,\n): Promise<string> => {\n\tlet [cmd, envVars] = getArbitraryLigoCmd(commonObj, parsedArgs, userCmd);\n\treturn spawnCmd(cmd, envVars)\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n};\n\nconst ligo = (commonObj: Common, parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(commonObj, parsedArgs, args)\n\t\t.then(sendRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { Common, emitExternalError, formatStdErr, getInputFilenameRelPath, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst inject = (commonObj: Common) => {\n\tconst { baseDriverCmd } = commonObj;\n\n\tconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\t\tif (!projectDir) throw `No project directory provided`;\n\t\tconst baseCmd = `${baseDriverCmd(projectDir)} run test`;\n\t\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\t\tconst cmd = `${baseCmd} ${inputFile}`;\n\t\treturn cmd;\n\t};\n\n\tconst testContract = (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t): Promise<TableRow> =>\n\t\tgetArch()\n\t\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stdout: unformattedStdout, stderr: unformattedStdErr }) => {\n\t\t\t\t// Workaround for https://gitlab.com/ligolang/ligo/-/issues/2189\n\t\t\t\tconst stdout = unformattedStdout.replace(/method not allowed\\n/gi, '');\n\n\t\t\t\tconst stderr = formatStdErr(unformattedStdErr);\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\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\ttestResults: 'Some tests failed :(',\n\t\t\t\t};\n\t\t\t});\n\n\treturn {\n\t\ttestContract,\n\t\tgetTestContractCmd,\n\t};\n};\n\nconst test = (commonObj: Common, parsedArgs: Opts): Promise<void> => {\n\tconst { testContract } = inject(commonObj);\n\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!sourceFile) return sendAsyncErr(`No source file provided`);\n\treturn testContract(parsedArgs, sourceFile)\n\t\t.then(result => [result])\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default test;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAA8D;;;ACA9D,sBAA6B;AAE7B,sBAA0B;;;ACF1B;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAavB,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ADH/B,IAAM,kBAAkB,OACvB,cACA,QACA,sBACqB;AACrB,QAAM,cAAc,aAAa,MAAM,UAAU;AACjD,QAAM,MAAM,cAAc,YAAY,CAAC,EAAE,UAAU,CAAC,IAAI;AACxD,QAAM,YAAY,qBAAqB;AAEvC,MAAI,WAAW;AAAS,WAAO,UAAU;AACzC,MAAI,WAAW;AAAU,WAAO,UAAU;AAE1C,MAAI,WAAW,QAAW;AACzB,QAAI,QAAQ;AAAS,aAAO,UAAU;AACt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eAAe,SAAS,aAAa,MAAM,IAAI,QAAQ,SAAS,YAAY;AACjH;","names":["import_node_sdk","import_node_sdk","import_node_sdk","import_node_sdk","import_promises","import_path","module","import_node_sdk","import_path","glob","import_node_sdk","import_node_sdk","inject","baseDriverCmd"]}
|
|
1
|
+
{"version":3,"sources":["index.ts","createContract.ts","ligo_templates.ts","main.ts","common.ts","compile.ts","compile-all.ts","ligo.ts","test.ts"],"sourcesContent":["import { Option, Plugin, PositionalArg, Task, Template } from '@taqueria/node-sdk';\nimport * as PluginSchema from '@taqueria/protocol/PluginSchema';\n\nimport createContract from './createContract';\nimport main from './main';\n\ntype PluginConfigurator = (plugin: PluginSchema.RawPluginSchema) => PluginSchema.RawPluginSchema;\ntype ConfiguratorArgs = {\n\tname: string;\n\talias: string;\n\tconfigurator?: PluginConfigurator;\n\tunparsedArgs: string[];\n\tdockerImage: string;\n\tdockerImageEnvVar: string;\n\tcanUseLIGOBinary: boolean;\n\ttemplates?: Record<string, string>;\n};\n\nexport const configurePlugin = (settings: ConfiguratorArgs) => {\n\tconst schema = {\n\t\tname: settings.name,\n\t\tschema: '1.0',\n\t\tversion: '0.1',\n\t\talias: settings.alias,\n\t\ttasks: [\n\t\t\tTask.create({\n\t\t\t\ttask: 'ligo',\n\t\t\t\tcommand: 'ligo',\n\t\t\t\tdescription:\n\t\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\t\toptions: [\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tshortFlag: 'c',\n\t\t\t\t\t\tflag: 'command',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The command to be passed to the underlying LIGO binary, wrapped in quotes',\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\thandler: 'proxy',\n\t\t\t\tencoding: 'none',\n\t\t\t}),\n\t\t\tTask.create({\n\t\t\t\ttask: 'compile',\n\t\t\t\tcommand: 'compile <sourceFile>',\n\t\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\t\tdescription:\n\t\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\t\toptions: [\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tflag: 'json',\n\t\t\t\t\t\tboolean: true,\n\t\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t\t}),\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tflag: 'module',\n\t\t\t\t\t\tshortFlag: 'm',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The LIGO module to be compiled',\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\thandler: 'proxy',\n\t\t\t\tencoding: 'json',\n\t\t\t}),\n\t\t\tTask.create({\n\t\t\t\ttask: 'compile-all',\n\t\t\t\tcommand: 'compile-all',\n\t\t\t\tdescription:\n\t\t\t\t\t'Compile all main smart contracts written in a LIGO syntax to Michelson code, along with their associated storage/parameter list files if they are found',\n\t\t\t\toptions: [\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tflag: 'json',\n\t\t\t\t\t\tboolean: true,\n\t\t\t\t\t\tdescription: 'Emit JSON-encoded Michelson',\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\thandler: 'proxy',\n\t\t\t\tencoding: 'json',\n\t\t\t}),\n\t\t\tTask.create({\n\t\t\t\ttask: 'test',\n\t\t\t\tcommand: 'test <sourceFile>',\n\t\t\t\tdescription: 'Test a smart contract written in LIGO',\n\t\t\t\thandler: 'proxy',\n\t\t\t\tencoding: 'json',\n\t\t\t}),\n\t\t\tTask.create({\n\t\t\t\ttask: 'get-image',\n\t\t\t\tcommand: 'get-image',\n\t\t\t\tdescription: 'Gets the name of the image to be used',\n\t\t\t\thandler: 'proxy',\n\t\t\t\thidden: true,\n\t\t\t}),\n\t\t],\n\t\ttemplates: [\n\t\t\tTemplate.create({\n\t\t\t\ttemplate: 'contract',\n\t\t\t\tcommand: 'contract <sourceFileName>',\n\t\t\t\tdescription: 'Create a LIGO contract with boilerplate code',\n\t\t\t\tpositionals: [\n\t\t\t\t\tPositionalArg.create({\n\t\t\t\t\t\tplaceholder: 'sourceFileName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The name of the LIGO contract to generate',\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\toptions: [\n\t\t\t\t\tOption.create({\n\t\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\thandler: createContract(settings.templates),\n\t\t\t}),\n\t\t],\n\t\tproxy: main(settings.dockerImage, settings.dockerImageEnvVar, settings.canUseLIGOBinary),\n\t\tpostInstall: `node ${__dirname}/postinstall.js`,\n\t};\n\n\treturn Plugin.create(() => settings.configurator ? settings.configurator(schema) : schema, settings.unparsedArgs);\n};\n","import { sendAsyncErr } from '@taqueria/node-sdk';\nimport { RequestArgs } from '@taqueria/node-sdk';\nimport { writeFile } from 'fs/promises';\nimport * as default_templates from './ligo_templates';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFileName?: string;\n\tsyntax?: string;\n}\n\nconst getLigoTemplate = async (\n\tcontractName: string,\n\tsyntax: string | undefined,\n\ttemplateOverrides?: Record<string, string>,\n): Promise<string> => {\n\tconst matchResult = contractName.match(/\\.[^.]+$/);\n\tconst ext = matchResult ? matchResult[0].substring(1) : null;\n\tconst templates = templateOverrides ?? default_templates;\n\n\tif (syntax === 'mligo') return templates.mligo_template;\n\tif (syntax === 'jsligo') return templates.jsligo_template;\n\n\tif (syntax === undefined) {\n\t\tif (ext === 'mligo') return templates.mligo_template;\n\t\tif (ext === 'jsligo') return templates.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 = (templates?: Record<string, string>) => (args: RequestArgs.t) => {\n\tconst unsafeOpts = args as unknown as Opts;\n\tconst contractName = unsafeOpts.sourceFileName as string;\n\tconst syntax = unsafeOpts.syntax;\n\tconst contractsDir = `${args.config.projectDir}/${args.config.contractsDir}`;\n\treturn getLigoTemplate(contractName, syntax, templates)\n\t\t.then(ligo_template => writeFile(`${contractsDir}/${contractName}`, ligo_template));\n};\n\nexport default createContract;\n","export const mligo_template = `\ntype storage = int\ntype return = operation list * storage\n\n(* Three entrypoints *)\n[@entry] let increment (delta : int) (store : storage) : return =\n [], store + delta\n[@entry] let decrement (delta : int) (store : storage) : return =\n [], store - delta\n[@entry] let reset (() : unit) (_ : storage) : return =\n [], 0\n`;\n\nexport const jsligo_template = `\ntype storage = int;\ntype ret = [list<operation>, storage];\n\n// Three entrypoints\n\n// @entry\nconst increment = (delta : int, store : storage) : ret =>\n [list([]), store + delta];\n\n// @entry\nconst decrement = (delta : int, store : storage) : ret =>\n [list([]), store - delta];\n\n// @entry\nconst reset = (_ : unit, _ : storage) : ret =>\n [list([]), 0];\n`;\n","import { RequestArgs, sendAsyncErr, sendAsyncRes } from '@taqueria/node-sdk';\nimport { configure, IntersectionOpts as Opts } from './common';\nimport compile from './compile';\nimport compileAll from './compile-all';\nimport ligo from './ligo';\nimport test from './test';\n\nconst main =\n\t(dockerImage: string, dockerImageEnvVar: string, canUseLIGOBinary: boolean) =>\n\t(parsedArgs: RequestArgs.t): Promise<void> => {\n\t\tconst commonObj = configure(dockerImage, dockerImageEnvVar, canUseLIGOBinary);\n\t\tconst unsafeOpts = parsedArgs as unknown as Opts;\n\t\tswitch (unsafeOpts.task) {\n\t\t\tcase 'ligo':\n\t\t\t\treturn ligo(commonObj, unsafeOpts);\n\t\t\tcase 'compile':\n\t\t\t\treturn compile(commonObj, unsafeOpts);\n\t\t\tcase 'compile-all':\n\t\t\t\treturn compileAll(commonObj, unsafeOpts);\n\t\t\tcase 'test':\n\t\t\t\treturn test(commonObj, parsedArgs);\n\t\t\tcase 'get-image':\n\t\t\t\treturn sendAsyncRes(commonObj.getLigoDockerImage());\n\t\t\tdefault:\n\t\t\t\treturn sendAsyncErr(`${unsafeOpts.task} is not an understood task by the LIGO plugin`);\n\t\t}\n\t};\n\nexport default main;\n","import { getDockerImage, sendErr } from '@taqueria/node-sdk';\nimport { ProxyTaskArgs, RequestArgs } from '@taqueria/node-sdk/types';\nimport * as fs from 'fs';\nimport { delimiter, join } from 'path';\n\nexport interface LigoOpts extends ProxyTaskArgs.t {\n\tcommand: string;\n}\n\nexport interface CompileOpts extends ProxyTaskArgs.t {\n\tsourceFile: string;\n\tjson: boolean;\n\tmodule?: string;\n}\n\nexport interface CompileAllOpts extends ProxyTaskArgs.t {\n\tjson: boolean;\n}\n\nexport interface TestOpts extends RequestArgs.t {\n\ttask?: string;\n\tsourceFile?: string;\n}\n\nexport type IntersectionOpts =\n\t& LigoOpts\n\t& CompileOpts\n\t& CompileAllOpts\n\t& TestOpts;\n\nexport type UnionOpts = LigoOpts | CompileOpts | CompileAllOpts | TestOpts;\n\nexport const getInputFilenameAbsPath = (\n\tparsedArgs: UnionOpts,\n\tsourceFile: string,\n): string =>\n\tjoin(\n\t\tparsedArgs.config.projectDir,\n\t\tparsedArgs.config.contractsDir ?? 'contracts',\n\t\tsourceFile,\n\t);\n\nexport const getInputFilenameRelPath = (\n\tparsedArgs: UnionOpts,\n\tsourceFile: string,\n): string => join(parsedArgs.config.contractsDir ?? 'contracts', sourceFile);\n\nexport const formatLigoError = (err: Error): Error => {\n\tlet result = err.message.replace(/Command failed.+?\\n/, '');\n\tif (\n\t\tresult.includes(\n\t\t\t'An internal error ocurred. Please, contact the developers.',\n\t\t)\n\t\t&& result.includes('Module Contract not found with last Contract.')\n\t) {\n\t\tresult =\n\t\t\t`By convention, Taqueria expects you to import your contract with Contract as the module name.\\nFor instance, if you have a contract in a file called \"increment.mligo\", in your parameter/storage list file you must include #import \"Increment.mligo\" \"Contract\" for compilation to be successful.`;\n\t} else {\n\t\tconst regex = /contracts\\/(.+): No such file or directory/;\n\t\tconst match = regex.exec(result);\n\t\tif (match) {\n\t\t\tconst filename = match[1];\n\t\t\tresult =\n\t\t\t\t`The file ${filename} was not found. Please ensure that the file exists and that it is in the contracts directory.`;\n\t\t}\n\t}\n\n\terr.message = result\n\t\t.replace(\n\t\t\t'An internal error ocurred. Please, contact the developers.',\n\t\t\t'The LIGO compiler experienced an internal error. Please contact the LIGO developers.',\n\t\t)\n\t\t.replace(\n\t\t\t/Module (\"Contract\\.[^\"]+\") not found/,\n\t\t\t'The module $1 was not found. If your contract is defined within a namespace, please ensure that it has been exported.',\n\t\t);\n\n\treturn err;\n};\n\nexport const emitExternalError = (\n\terrs: unknown[] | unknown,\n\tsourceFile: string,\n): void => {\n\tsendErr(`\\n=== Error messages for ${sourceFile} ===`);\n\tconst errors = Array.isArray(errs) ? errs : [errs];\n\terrors.map(err => {\n\t\terr instanceof Error ? sendErr(err.message) : sendErr(err as any);\n\t});\n\tsendErr(`===`);\n};\n\nexport const configure = (dockerImage: string, dockerImageEnvVar: string, canUseLIGOBinary: boolean) => ({\n\tLIGO_DEFAULT_IMAGE: dockerImage,\n\tLIGO_IMAGE_ENV_VAR: dockerImageEnvVar,\n\tgetLigoDockerImage: () => getDockerImage(dockerImage, dockerImageEnvVar),\n\tbaseDriverCmd: (projectDir: string) => baseDriverCmd(projectDir, dockerImage, canUseLIGOBinary),\n});\n\nexport type Common = ReturnType<typeof configure>;\nfunction exists(path: string): boolean {\n\ttry {\n\t\tfs.accessSync(path, fs.constants.X_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction getLigoBinaryFromPath() {\n\tconst { PATH } = process.env;\n\tif (!PATH) {\n\t\treturn null;\n\t}\n\tconst paths = PATH.split(delimiter);\n\tfor (const candidatePath of paths) {\n\t\tconst possibleLigoPath = join(candidatePath, 'ligo');\n\t\tif (exists(possibleLigoPath)) {\n\t\t\treturn possibleLigoPath;\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction baseDriverCmd(\n\tprojectDir: string,\n\tligoDockerImage: string,\n\tcanUseLIGOBinary: boolean,\n): string {\n\tconst ligoBinaryFromPath = canUseLIGOBinary ? getLigoBinaryFromPath() : null;\n\tif (ligoBinaryFromPath !== null) {\n\t\treturn ligoBinaryFromPath;\n\t} else {\n\t\treturn `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project -u $(id -u):$(id -g) ${ligoDockerImage}`;\n\t}\n}\n\nexport const formatStdErr = (stderr: string) => {\n\t// Temporary fix for issue: https://gitlab.com/ligolang/ligo/-/issues/2176\n\tif (stderr.length > 0 && stderr.includes('create directory //.ligo')) {\n\t\treturn stderr\n\t\t\t.replace(/create directory \\/\\/\\.ligo: Permission denied/, '')\n\t\t\t.replace(/create temporary file \\/\\/\\.ligo\\/.*.tmp: No such file or directory/, '')\n\t\t\t.trim();\n\t}\n\treturn stderr;\n};\n","import {\n\texecCmd,\n\tgetArch,\n\tgetArtifactsDir,\n\tsendAsyncErr,\n\tsendErr,\n\tsendJsonRes,\n\tsendRes,\n\tsendWarn,\n} from '@taqueria/node-sdk';\nimport { createReadStream } from 'fs';\nimport { access, readFile, writeFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\nimport * as readline from 'readline';\nimport {\n\tCommon,\n\tCompileOpts as Opts,\n\temitExternalError,\n\tformatLigoError,\n\tformatStdErr,\n\tgetInputFilenameAbsPath,\n\tgetInputFilenameRelPath,\n\tUnionOpts,\n} from './common';\n\nexport type TableRow = { source: string; artifact: string; err?: unknown };\n\nexport type ExprKind = 'storage' | 'default_storage' | 'parameter';\n\nexport type Syntax = 'mligo' | 'jsligo' | 'religo' | 'ligo';\n\nexport type ModuleInfo = {\n\tmoduleName: string;\n\tsourceName: string;\n\tsourceFile: string;\n\tsyntax: Syntax;\n\ttype: 'file-main' | 'file-entry' | 'module-main' | 'module-entry';\n};\n\nconst COMPILE_ERR_MSG: string = 'Not compiled';\n\nconst isStorageKind = (exprKind: ExprKind): boolean => exprKind === 'storage' || exprKind === 'default_storage';\n\nexport const isSupportedLigoSyntax = (sourceFile: string) => /\\.(mligo|jsligo)$/.test(sourceFile);\n\nexport const isUnsupportedLigoSyntax = (sourceFile: string) => /\\.(ligo|religo)$/.test(sourceFile);\n\nexport const isLIGOFile = (sourceFile: string) =>\n\tisSupportedLigoSyntax(sourceFile) || isUnsupportedLigoSyntax(sourceFile);\n\nexport const isStorageListFile = (sourceFile: string): boolean =>\n\t/.+\\.(storageList|storages)\\.(ligo|religo|mligo|jsligo)$/.test(sourceFile);\n\nexport const isParameterListFile = (sourceFile: string): boolean =>\n\t/.+\\.(parameterList|parameters)\\.(ligo|religo|mligo|jsligo)$/.test(\n\t\tsourceFile,\n\t);\n\nconst extractExt = (path: string): string => {\n\tconst matchResult = path.match(/\\.(ligo|religo|mligo|jsligo)$/);\n\treturn matchResult ? matchResult[0] : '';\n};\n\nconst removeExt = (path: string): string => {\n\tconst extRegex = new RegExp(extractExt(path));\n\treturn path.replace(extRegex, '');\n};\n\nconst isOutputFormatJSON = (parsedArgs: Opts): boolean => parsedArgs.json;\n\nconst getOutputContractFilename = (\n\tparsedArgs: Opts,\n\tmodule: ModuleInfo,\n): string => {\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\treturn join(getArtifactsDir(parsedArgs), `${module.moduleName}${ext}`);\n};\n\nconst getOutputExprFilename = (\n\tparsedArgs: Opts,\n\tmodule: ModuleInfo,\n\texprKind: ExprKind,\n\texprName: string,\n): string => {\n\tconst contractName = module.moduleName;\n\tconst ext = isOutputFormatJSON(parsedArgs) ? '.json' : '.tz';\n\tconst outputFile = exprKind === 'default_storage'\n\t\t? `${contractName}.default_storage${ext}`\n\t\t: `${contractName}.${exprKind}.${exprName}${ext}`;\n\treturn join(getArtifactsDir(parsedArgs), `${outputFile}`);\n};\n\nconst getExprNames = (\n\tparsedArgs: Opts,\n\tsourceFile: string,\n): Promise<string[]> => {\n\treturn new Promise((resolve, reject) => {\n\t\tconst inputFilePath = getInputFilenameAbsPath(parsedArgs, sourceFile);\n\t\tconst readInterface = readline.createInterface({\n\t\t\tinput: createReadStream(inputFilePath),\n\t\t\toutput: process.stdout,\n\t\t});\n\n\t\tconst variableNames: string[] = [];\n\n\t\treadInterface.on('line', function(line) {\n\t\t\t// Skip lines that start with a comment\n\t\t\tif (!line.trim().startsWith('//')) {\n\t\t\t\tconst matches = line.match(/(?<=\\s*(let|const)\\s+)[a-zA-Z0-9_]+/g);\n\t\t\t\tif (matches) {\n\t\t\t\t\tvariableNames.push(...matches);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treadInterface.on('close', function() {\n\t\t\tresolve(variableNames);\n\t\t});\n\t});\n};\n\n// Helper function to get the initial message based on the pair value\nconst getInitialMessage = (pair: string, module: ModuleInfo) => {\n\tconst messages = {\n\t\t'mligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'mligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a named module. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-file-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was not within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-file-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was not within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t'jsligo-module-main':\n\t\t\t`// When this file was created, the smart contract was defined with a main function that was within a namespace. As such, the examples below are written with that assumption in mind.\\n`\n\t\t\t+ `// NOTE: The \"storage\" type should be exported from the contract file (${module.sourceFile})`,\n\t\t'jsligo-module-entry':\n\t\t\t`// When this file was created, the smart contract was defined with an entrypoint using \\`@entry\\` that was within a namespace. As such, the examples below are written with that assumption in mind.`,\n\t\t// ... any other combinations\n\t} as Record<string, string>;\n\n\treturn messages[pair] || '// This file was created by Taqueria.';\n};\n\n// Helper function to get a common message\nconst getCommonMsg = (langType: Syntax, listType: ExprKind, moduleInfo: ModuleInfo) => {\n\tconst varKeyword = langType === 'mligo' ? 'let' : 'const';\n\tconst namespaceSelector = moduleInfo.type.startsWith('module') ? '[Namespace].' : '';\n\tconst commonMsgForStorage = `// IMPORTANT: We suggest always explicitly typing your storage values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} storage: int = 10\\` or \\`${varKeyword} storage: Contract.${namespaceSelector}storage = 10\\``;\n\n\tconst commonMsgForParameter = `// IMPORTANT: We suggest always explicitly typing your parameter values:\\n`\n\t\t+ `// E.g.: \\`${varKeyword} parameter: int = 10\\` or \\`${varKeyword} parameter: Contract.${namespaceSelector}parameter = 10\\``;\n\n\treturn listType === 'storage' ? commonMsgForStorage : commonMsgForParameter;\n};\n\n// Main function to get the content for storage or parameter\nconst getContent = (moduleInfo: ModuleInfo, listType: ExprKind) => {\n\tconst linkToContract = `#import \"${moduleInfo.sourceFile}\" \"Contract\"`;\n\tconst pair = `${moduleInfo.syntax}-${moduleInfo.type}`;\n\tconst initialMsg = getInitialMessage(pair, moduleInfo);\n\tconst commonMsg = getCommonMsg(moduleInfo.syntax, listType, moduleInfo);\n\n\treturn `${linkToContract}\\n\\n${initialMsg}\\n\\n${commonMsg}`;\n};\n\n// Usage for storage list\nconst initContentForStorage = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'storage');\n\n// Usage for parameter list\nconst initContentForParameter = (moduleInfo: ModuleInfo) => getContent(moduleInfo, 'parameter');\n\n// Inject commonObj to return some functions\nexport const inject = (commonObj: Common) => {\n\tconst { getLigoDockerImage } = commonObj;\n\n\tconst getListDeclarationsCmd = async (\n\t\tparsedArgs: UnionOpts,\n\t\tsourceFile: string,\n\t): Promise<string> => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\t\tif (!projectDir) throw new Error(`No project directory provided`);\n\t\tconst baseCmd = `${commonObj.baseDriverCmd(projectDir)} info list-declarations`;\n\t\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\t\tconst flags = '--display-format json';\n\t\tconst cmd = `${baseCmd} ${inputFile} ${flags}`;\n\t\treturn cmd;\n\t};\n\n\tconst listContractModules = async (\n\t\tparsedArgs: UnionOpts,\n\t\tsourceFile: string,\n\t): Promise<ModuleInfo[]> => {\n\t\ttry {\n\t\t\tawait getArch();\n\t\t\tconst cmd = await getListDeclarationsCmd(parsedArgs, sourceFile);\n\t\t\tconst { stderr: unformattedStderr, stdout: unformattedStdout } = await execCmd(cmd);\n\n\t\t\t// Workaround for https://gitlab.com/ligolang/ligo/-/issues/2189\n\t\t\tconst stdout = unformattedStdout.replace(/method not allowed/i, '');\n\t\t\tconst stderr = formatStdErr(unformattedStderr);\n\n\t\t\tif (stderr.length > 0) return Promise.reject(stderr);\n\n\t\t\treturn JSON.parse(stdout).declarations.reduce(\n\t\t\t\t(acc: ModuleInfo[], decl: string) => {\n\t\t\t\t\t// We need to process delcarations (decl) like so:\n\t\t\t\t\t// 1. If the decl is equal to the string \"main\", then the module type is \"file-main\" and the name of the module is the sourceFile.\n\t\t\t\t\t// 2. If the decl is equal to $main, then the module type is \"file-entry\" and the name fo the module is the sourceFile.\n\t\t\t\t\t// 3. If the decl ends with .main, then the module type is \"module-main\" and the name of the module is the decl without the .main suffix.\n\t\t\t\t\t// 4. If the decl ends with .$main, then the module type is \"module-entry\" and the name of the module is the decl without the .$main suffix.\n\t\t\t\t\t// Otherwise, this is not a declaration we care about.\n\t\t\t\t\tconst srcFile = removeExt(basename(sourceFile));\n\t\t\t\t\tconst syntax = extractExt(sourceFile).replace('.', '');\n\n\t\t\t\t\tif (decl === 'main') {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoduleName: srcFile,\n\t\t\t\t\t\t\t\tsourceName: sourceFile,\n\t\t\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\t\t\ttype: 'file-main',\n\t\t\t\t\t\t\t\tsyntax,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t} else if (decl === '$main') {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoduleName: srcFile,\n\t\t\t\t\t\t\t\tsourceName: sourceFile,\n\t\t\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\t\t\ttype: 'file-entry',\n\t\t\t\t\t\t\t\tsyntax,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t} else if (decl.endsWith('.main')) {\n\t\t\t\t\t\tconst moduleName = decl.replace(/\\.main$/, '');\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\t\t\ttype: 'module-main',\n\t\t\t\t\t\t\t\tsyntax,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t} else if (decl.endsWith('.$main')) {\n\t\t\t\t\t\tconst moduleName = decl.replace(/\\.\\$main$/, '');\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmoduleName,\n\t\t\t\t\t\t\t\tsourceName: `${sourceFile}/${moduleName}`,\n\t\t\t\t\t\t\t\tsourceFile,\n\t\t\t\t\t\t\t\ttype: 'module-entry',\n\t\t\t\t\t\t\t\tsyntax,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t[],\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tconst formattedErr = err instanceof Error ? formatLigoError(err) : err;\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn [];\n\t\t}\n\t};\n\n\tconst getCompileContractCmd = async (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t): Promise<string> => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\t\tif (!projectDir) throw new Error(`No project directory provided`);\n\t\tconst baseCmd = `${commonObj.baseDriverCmd(projectDir)} compile contract`;\n\t\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\t\tconst outputFile = `-o ${getOutputContractFilename(parsedArgs, module)}`;\n\t\tconst flags = isOutputFormatJSON(parsedArgs)\n\t\t\t? ' --michelson-format json '\n\t\t\t: '';\n\t\tconst moduleFlag = module.type.startsWith('file-')\n\t\t\t? ''\n\t\t\t: `-m ${module.moduleName}`;\n\t\tconst cmd = `${baseCmd} ${inputFile} ${outputFile} ${flags}${moduleFlag}`;\n\t\treturn cmd;\n\t};\n\n\tconst compileContract = async (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t): Promise<TableRow> => {\n\t\ttry {\n\t\t\tawait getArch();\n\t\t\tconst cmd = await getCompileContractCmd(parsedArgs, sourceFile, module);\n\t\t\tconst { stderr: unformattedStderr } = await execCmd(cmd);\n\t\t\tconst stderr = formatStdErr(unformattedStderr);\n\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\n\t\t\treturn {\n\t\t\t\tsource: module.sourceName,\n\t\t\t\tartifact: getOutputContractFilename(parsedArgs, module),\n\t\t\t};\n\t\t} catch (err) {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn {\n\t\t\t\tsource: module.sourceName,\n\t\t\t\tartifact: COMPILE_ERR_MSG,\n\t\t\t};\n\t\t}\n\t};\n\n\tconst getCompileExprCmd = (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t\texprKind: ExprKind,\n\t\texprName: string,\n\t): string => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\t\tif (!projectDir) throw new Error(`No project directory provided`);\n\t\tconst compilerType = isStorageKind(exprKind) ? 'storage' : 'parameter';\n\t\tconst baseCmd = `${commonObj.baseDriverCmd(projectDir)} compile ${compilerType}`;\n\t\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\t\tconst outputFile = `-o ${\n\t\t\tgetOutputExprFilename(\n\t\t\t\tparsedArgs,\n\t\t\t\tmodule,\n\t\t\t\texprKind,\n\t\t\t\texprName,\n\t\t\t)\n\t\t}`;\n\t\tconst flags = isOutputFormatJSON(parsedArgs)\n\t\t\t? ' --michelson-format json '\n\t\t\t: '';\n\n\t\t// Parameter and Storage list files are expected to import the smart contract file as the \"Contract\" module.\n\t\tconst moduleFlag = (() => {\n\t\t\tswitch (module.type) {\n\t\t\t\tcase 'file-main':\n\t\t\t\tcase 'file-entry':\n\t\t\t\t\treturn '-m Contract';\n\t\t\t\tdefault:\n\t\t\t\t\treturn `-m Contract.${module.moduleName}`;\n\t\t\t}\n\t\t})();\n\n\t\tconst cmd = `${baseCmd} ${inputFile} ${exprName} ${outputFile} ${flags} ${moduleFlag}`;\n\t\treturn cmd;\n\t};\n\n\tconst compileExpr = (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t\texprKind: ExprKind,\n\t) =>\n\t(exprName: string): Promise<TableRow> => {\n\t\treturn getArch()\n\t\t\t.then(() => getCompileExprCmd(parsedArgs, sourceFile, module, exprKind, exprName))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr: unformattedStderr }) => {\n\t\t\t\tconst stderr = formatStdErr(unformattedStderr);\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\tconst artifactName = getOutputExprFilename(\n\t\t\t\t\tparsedArgs,\n\t\t\t\t\tmodule,\n\t\t\t\t\texprKind,\n\t\t\t\t\texprName,\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: artifactName,\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\treturn {\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: `${exprName} in ${sourceFile} not compiled`,\n\t\t\t\t\terr,\n\t\t\t\t};\n\t\t\t});\n\t};\n\n\tconst compileExprs = async (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t\texprKind: ExprKind,\n\t): Promise<TableRow[]> => {\n\t\t// Get expressions from file\n\t\tlet exprs = [];\n\t\ttry {\n\t\t\texprs = await getExprNames(parsedArgs, sourceFile);\n\t\t} catch (err) {\n\t\t\temitExternalError(err, sourceFile);\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tsource: module.sourceName,\n\t\t\t\t\tartifact: `No ${isStorageKind(exprKind) ? 'storage' : 'parameter'} expressions compiled`,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\tconst results = await Promise.all(\n\t\t\texprs.map(async (exprName, index) => {\n\t\t\t\tconst compileResult = await compileExpr(\n\t\t\t\t\tparsedArgs,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tmodule,\n\t\t\t\t\texprKind === 'storage' && exprName === 'default_storage' ? 'default_storage' : exprKind,\n\t\t\t\t)(exprName);\n\t\t\t\treturn compileResult;\n\t\t\t}),\n\t\t);\n\n\t\t// Collect errors\n\t\tconst errors = results.reduce((acc, result) => {\n\t\t\tif (result.err) {\n\t\t\t\t// If its not an Error object, then just add it to the list\n\t\t\t\tif (!(result.err instanceof Error)) return [...acc, result.err];\n\n\t\t\t\t// Otherwise, get all ligo errors and ensure that the list is unique\n\t\t\t\tconst ligoErrs = (\n\t\t\t\t\tacc.filter(err => err instanceof Error) as Error[]\n\t\t\t\t).map(err => err.message);\n\n\t\t\t\tconst formattedError = formatLigoError(result.err);\n\n\t\t\t\treturn ligoErrs.includes(formattedError.message)\n\t\t\t\t\t? acc\n\t\t\t\t\t: [...acc, formattedError];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] as unknown[]);\n\n\t\t// Collect table rows\n\t\tconst retval = results.map(({ source, artifact }) => ({\n\t\t\tsource,\n\t\t\tartifact,\n\t\t}));\n\n\t\tif (errors.length) emitExternalError(errors, sourceFile);\n\n\t\treturn retval;\n\t};\n\n\tconst compileContractWithStorageAndParameter = async (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t\tmodule: ModuleInfo,\n\t): Promise<TableRow[]> => {\n\t\tconst contractCompileResult = await compileContract(\n\t\t\tparsedArgs,\n\t\t\tsourceFile,\n\t\t\tmodule,\n\t\t);\n\t\tif (contractCompileResult.artifact === COMPILE_ERR_MSG) return [contractCompileResult];\n\n\t\tconst storageListFile = `${module.moduleName}.storageList${\n\t\t\textractExt(\n\t\t\t\tsourceFile,\n\t\t\t)\n\t\t}`;\n\t\tconst storageListFilename = getInputFilenameAbsPath(\n\t\t\tparsedArgs,\n\t\t\tstorageListFile,\n\t\t);\n\t\tconst storageCompileResult = await access(storageListFilename)\n\t\t\t.then(() => compileExprs(parsedArgs, storageListFile, module, 'storage'))\n\t\t\t.catch(() => {\n\t\t\t\tsendWarn(\n\t\t\t\t\t`Note: storage file associated with \"${module.moduleName}\" 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\t);\n\t\t\t\treturn writeFile(\n\t\t\t\t\tstorageListFilename,\n\t\t\t\t\tinitContentForStorage(module),\n\t\t\t\t\t'utf8',\n\t\t\t\t);\n\t\t\t});\n\n\t\tconst parameterListFile = `${module.moduleName}.parameterList${\n\t\t\textractExt(\n\t\t\t\tsourceFile,\n\t\t\t)\n\t\t}`;\n\t\tconst parameterListFilename = getInputFilenameAbsPath(\n\t\t\tparsedArgs,\n\t\t\tparameterListFile,\n\t\t);\n\t\tconst parameterCompileResult = await access(parameterListFilename)\n\t\t\t.then(() => compileExprs(parsedArgs, parameterListFile, module, 'parameter'))\n\t\t\t.catch(() => {\n\t\t\t\tsendWarn(\n\t\t\t\t\t`Note: parameter file associated with \"${module.moduleName}\" 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\t);\n\t\t\t\treturn writeFile(\n\t\t\t\t\tparameterListFilename,\n\t\t\t\t\tinitContentForParameter(module),\n\t\t\t\t\t'utf8',\n\t\t\t\t);\n\t\t\t});\n\n\t\tconst storageArtifacts = storageCompileResult\n\t\t\t? storageCompileResult.map(res => res.artifact).join('\\n')\n\t\t\t: '';\n\t\tconst parameterArtifacts = parameterCompileResult\n\t\t\t? parameterCompileResult.map(res => res.artifact).join('\\n')\n\t\t\t: '';\n\n\t\tconst combinedArtifact = [\n\t\t\tcontractCompileResult.artifact,\n\t\t\tstorageArtifacts,\n\t\t\tparameterArtifacts,\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join('\\n');\n\n\t\tconst combinedRow: TableRow = {\n\t\t\tsource: module.sourceName,\n\t\t\tartifact: combinedArtifact,\n\t\t};\n\n\t\treturn [combinedRow];\n\t};\n\n\treturn {\n\t\tgetLigoDockerImage,\n\t\tgetListDeclarationsCmd,\n\t\tlistContractModules,\n\t\tgetCompileContractCmd,\n\t\tcompileContract,\n\t\tgetCompileExprCmd,\n\t\tcompileExpr,\n\t\tcompileExprs,\n\t\tcompileContractWithStorageAndParameter,\n\t};\n};\n\nexport const compile = async (\n\tcommonObj: Common,\n\tparsedArgs: Opts,\n): Promise<void> => {\n\tconst { listContractModules, compileContractWithStorageAndParameter } = inject(commonObj);\n\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!isLIGOFile(sourceFile)) {\n\t\tsendErr(`${sourceFile} is not a LIGO file`);\n\t\treturn;\n\t}\n\tif (isStorageListFile(sourceFile) || isParameterListFile(sourceFile)) {\n\t\tsendErr(\n\t\t\t`Storage and parameter list files are not meant to be compiled directly`,\n\t\t);\n\t\treturn;\n\t}\n\tif (isUnsupportedLigoSyntax(sourceFile)) {\n\t\tsendErr(\n\t\t\t`Unsupported LIGO syntax detected in ${sourceFile}. Note, we only support .jsligo and .mligo files.`,\n\t\t);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst modules = await listContractModules(parsedArgs, sourceFile);\n\t\tif (modules.length === 0) {\n\t\t\thttps:\n\t\t\t// gitlab.com/ligolang/ligo/-/issues/2189\n\t\t\treturn sendJsonRes([\n\t\t\t\t{\n\t\t\t\t\tsource: sourceFile,\n\t\t\t\t\tartifact:\n\t\t\t\t\t\t`No contract modules found in \"${sourceFile}\".\\nIf your contract is defined within a namespace, please ensure that it is exported from the contract file.\"`,\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tlet allCompileResults: TableRow[] = [];\n\t\tfor (const module of modules) {\n\t\t\t// If we're only to compile a particular module, then we'll skip any that don't match\n\t\t\tif (parsedArgs.module && parsedArgs.module !== module.moduleName) continue;\n\n\t\t\tconst compileResults = await compileContractWithStorageAndParameter(\n\t\t\t\tparsedArgs,\n\t\t\t\tsourceFile,\n\t\t\t\tmodule,\n\t\t\t);\n\t\t\tallCompileResults = allCompileResults.concat(compileResults);\n\t\t}\n\n\t\tsendJsonRes(allCompileResults, {\n\t\t\tfooter: `\\nCompiled ${allCompileResults.length} contract(s) in \"${sourceFile}\"`,\n\t\t});\n\t} catch (err) {\n\t\tsendErr(`Error processing \"${sourceFile}\": ${err}`);\n\t}\n};\n\nexport default compile;\n","import { sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport glob from 'fast-glob';\nimport { join } from 'path';\nimport { Common, CompileAllOpts, CompileAllOpts as Opts, CompileOpts } from './common';\nimport { inject, isParameterListFile, isStorageListFile, TableRow } from './compile';\n\nconst compileAll = async (commonObj: Common, parsedArgs: Opts): Promise<void> => {\n\tconst { listContractModules, compileContractWithStorageAndParameter } = inject(commonObj);\n\n\tlet compilePromises: Promise<TableRow[]>[] = [];\n\n\tconst contractFilenames = await glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{\n\t\t\tcwd: join(parsedArgs.config.projectDir, parsedArgs.config.contractsDir ?? 'contracts'),\n\t\t\tabsolute: false,\n\t\t},\n\t);\n\n\tfor (const filename of contractFilenames) {\n\t\tif (isStorageListFile(filename) || isParameterListFile(filename)) continue;\n\t\tconst moduleNames = await listContractModules(parsedArgs as unknown as CompileAllOpts, filename);\n\t\tfor (const moduleName of moduleNames) {\n\t\t\tcompilePromises.push(compileContractWithStorageAndParameter(parsedArgs as CompileOpts, filename, moduleName));\n\t\t}\n\t}\n\n\treturn Promise.all(compilePromises)\n\t\t.then(tables => tables.flat())\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendErr(err, false));\n};\n\nexport default compileAll;\n","import { sendAsyncErr, sendRes, spawnCmd } from '@taqueria/node-sdk';\nimport { Common, LigoOpts as Opts } from './common';\n\nconst getArbitraryLigoCmd = (\n\tcommonObj: Common,\n\tparsedArgs: Opts,\n\tuserArgs: string,\n): [string, Record<string, string>] => {\n\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\tif (!projectDir) throw `No project directory provided`;\n\n\tconst processedUserArgs = userArgs\n\t\t.split(' ')\n\t\t.map(arg => (arg.startsWith('\\\\-') ? arg.substring(1) : arg))\n\t\t.filter(arg => arg);\n\n\tconst cmd = `${commonObj.baseDriverCmd(projectDir)} ${processedUserArgs.join(' ')}`;\n\n\tconst envVars = { DOCKER_DEFAULT_PLATFORM: 'linux/amd64' };\n\treturn [cmd, envVars];\n};\n\nconst runArbitraryLigoCmd = (\n\tcommonObj: Common,\n\tparsedArgs: Opts,\n\tuserCmd: string,\n): Promise<string> => {\n\tlet [cmd, envVars] = getArbitraryLigoCmd(commonObj, parsedArgs, userCmd);\n\treturn spawnCmd(cmd, envVars)\n\t\t.then(code =>\n\t\t\tcode !== null && code === 0\n\t\t\t\t? `Command \"${cmd}\" ran successfully by LIGO`\n\t\t\t\t: `Command \"${cmd}\" failed. Please check your command`\n\t\t)\n\t\t.catch(err => sendAsyncErr(`An internal error has occurred: ${err.message}`));\n};\n\nconst ligo = (commonObj: Common, parsedArgs: Opts): Promise<void> => {\n\tconst args = parsedArgs.command;\n\treturn runArbitraryLigoCmd(commonObj, parsedArgs, args)\n\t\t.then(sendRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default ligo;\n","import { execCmd, getArch, sendAsyncErr, sendJsonRes, sendWarn } from '@taqueria/node-sdk';\nimport { Common, emitExternalError, formatStdErr, getInputFilenameRelPath, TestOpts as Opts } from './common';\n\ntype TableRow = { contract: string; testResults: string };\n\nconst inject = (commonObj: Common) => {\n\tconst { baseDriverCmd } = commonObj;\n\n\tconst getTestContractCmd = (parsedArgs: Opts, sourceFile: string): string => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? parsedArgs.projectDir;\n\t\tif (!projectDir) throw `No project directory provided`;\n\t\tconst baseCmd = `${baseDriverCmd(projectDir)} run test`;\n\t\tconst inputFile = getInputFilenameRelPath(parsedArgs, sourceFile);\n\t\tconst cmd = `${baseCmd} ${inputFile}`;\n\t\treturn cmd;\n\t};\n\n\tconst testContract = (\n\t\tparsedArgs: Opts,\n\t\tsourceFile: string,\n\t): Promise<TableRow> =>\n\t\tgetArch()\n\t\t\t.then(() => getTestContractCmd(parsedArgs, sourceFile))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stdout: unformattedStdout, stderr: unformattedStdErr }) => {\n\t\t\t\t// Workaround for https://gitlab.com/ligolang/ligo/-/issues/2189\n\t\t\t\tconst stdout = unformattedStdout.replace(/method not allowed\\n/gi, '');\n\n\t\t\t\tconst stderr = formatStdErr(unformattedStdErr);\n\t\t\t\tif (stderr.length > 0) sendWarn(stderr);\n\t\t\t\tconst result = '🎉 All tests passed 🎉';\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\ttestResults: stdout.length > 0 ? `${stdout}\\n${result}` : result,\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\ttestResults: 'Some tests failed :(',\n\t\t\t\t};\n\t\t\t});\n\n\treturn {\n\t\ttestContract,\n\t\tgetTestContractCmd,\n\t};\n};\n\nconst test = (commonObj: Common, parsedArgs: Opts): Promise<void> => {\n\tconst { testContract } = inject(commonObj);\n\n\tconst sourceFile = parsedArgs.sourceFile;\n\tif (!sourceFile) return sendAsyncErr(`No source file provided`);\n\treturn testContract(parsedArgs, sourceFile)\n\t\t.then(result => [result])\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default test;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAA8D;;;ACA9D,sBAA6B;AAE7B,sBAA0B;;;ACF1B;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAavB,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ADH/B,IAAM,kBAAkB,OACvB,cACA,QACA,s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,YACN,MAAM;AAAA,YACN,aAAa;AAAA,UACd,CAAC;AAAA,QACF;AAAA,QACA,SAAS,uBAAe,SAAS,SAAS;AAAA,MAC3C,CAAC;AAAA,IACF;AAAA,IACA,OAAO,aAAK,SAAS,aAAa,SAAS,mBAAmB,SAAS,gBAAgB;AAAA,IACvF,aAAa,QAAQ,SAAS;AAAA,EAC/B;AAEA,SAAO,wBAAO,OAAO,MAAM,SAAS,eAAe,SAAS,aAAa,MAAM,IAAI,QAAQ,SAAS,YAAY;AACjH;","names":["import_node_sdk","import_node_sdk","import_node_sdk","import_node_sdk","import_promises","import_path","module","import_node_sdk","import_path","glob","import_node_sdk","import_node_sdk","inject","baseDriverCmd"]}
|