@taqueria/plugin-ligo 0.0.0-pr-779-eaf2ca6a → 0.0.0-pr-776-41624e20
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/index.js +32 -45
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -7,82 +7,72 @@ var $kQNfl$fastglob = require("fast-glob");
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
const $24b2f47d8f306cb3$var$getContractArtifactFilename = (opts)=>(sourceFile)=>{
|
|
10
|
-
const outFile = $kQNfl$path.basename(sourceFile, $kQNfl$path.extname(sourceFile));
|
|
11
|
-
return $kQNfl$path.join(opts.config.artifactsDir, `${outFile}.tz`);
|
|
12
|
-
}
|
|
13
|
-
;
|
|
10
|
+
const outFile = (0, $kQNfl$path.basename)(sourceFile, (0, $kQNfl$path.extname)(sourceFile));
|
|
11
|
+
return (0, $kQNfl$path.join)(opts.config.artifactsDir, `${outFile}.tz`);
|
|
12
|
+
};
|
|
14
13
|
const $24b2f47d8f306cb3$var$getInputFilename = (opts)=>(sourceFile)=>{
|
|
15
|
-
return $kQNfl$path.join(opts.config.contractsDir, sourceFile);
|
|
16
|
-
}
|
|
17
|
-
;
|
|
14
|
+
return (0, $kQNfl$path.join)(opts.config.contractsDir, sourceFile);
|
|
15
|
+
};
|
|
18
16
|
const $24b2f47d8f306cb3$var$getCompileCommand = (opts)=>(sourceFile)=>{
|
|
19
17
|
const projectDir = process.env.PROJECT_DIR ?? opts.projectDir;
|
|
20
18
|
if (!projectDir) throw `No project directory provided`;
|
|
21
19
|
const inputFile = $24b2f47d8f306cb3$var$getInputFilename(opts)(sourceFile);
|
|
22
20
|
const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`;
|
|
23
21
|
const entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : "";
|
|
24
|
-
const syntax = opts["syntax"] ? `-s ${opts[
|
|
22
|
+
const syntax = opts["syntax"] ? `-s ${opts["syntax"]} : ""` : "";
|
|
25
23
|
const outFile = `-o ${$24b2f47d8f306cb3$var$getContractArtifactFilename(opts)(sourceFile)}`;
|
|
26
24
|
const cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`;
|
|
27
25
|
return cmd;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
).then($kQNfl$taquerianodesdk.execCmd).then(({ stderr: stderr })=>{
|
|
32
|
-
if (stderr.length > 0) $kQNfl$taquerianodesdk.sendErr(stderr);
|
|
26
|
+
};
|
|
27
|
+
const $24b2f47d8f306cb3$var$compileContract = (opts)=>(sourceFile)=>(0, $kQNfl$taquerianodesdk.getArch)().then(()=>$24b2f47d8f306cb3$var$getCompileCommand(opts)(sourceFile)).then((0, $kQNfl$taquerianodesdk.execCmd)).then(({ stderr: stderr })=>{
|
|
28
|
+
if (stderr.length > 0) (0, $kQNfl$taquerianodesdk.sendErr)(stderr);
|
|
33
29
|
return {
|
|
34
30
|
contract: sourceFile,
|
|
35
31
|
artifact: $24b2f47d8f306cb3$var$getContractArtifactFilename(opts)(sourceFile)
|
|
36
32
|
};
|
|
37
33
|
}).catch((err)=>{
|
|
38
|
-
$kQNfl$taquerianodesdk.sendErr(" ");
|
|
39
|
-
$kQNfl$taquerianodesdk.sendErr(err.message.split("\n").slice(1).join("\n"));
|
|
34
|
+
(0, $kQNfl$taquerianodesdk.sendErr)(" ");
|
|
35
|
+
(0, $kQNfl$taquerianodesdk.sendErr)(err.message.split("\n").slice(1).join("\n"));
|
|
40
36
|
return Promise.resolve({
|
|
41
37
|
contract: sourceFile,
|
|
42
38
|
artifact: "Not compiled"
|
|
43
39
|
});
|
|
44
|
-
})
|
|
45
|
-
;
|
|
40
|
+
});
|
|
46
41
|
const $24b2f47d8f306cb3$var$compileAll = (parsedArgs)=>{
|
|
47
42
|
// TODO: Fetch list of files from SDK
|
|
48
43
|
return $kQNfl$fastglob([
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
"**/*.ligo",
|
|
45
|
+
"**/*.religo",
|
|
46
|
+
"**/*.mligo",
|
|
47
|
+
"**/*.jsligo"
|
|
53
48
|
], {
|
|
54
49
|
cwd: parsedArgs.config.contractsDir,
|
|
55
50
|
absolute: false
|
|
56
|
-
}).then((entries)=>entries.map($24b2f47d8f306cb3$var$compileContract(parsedArgs))
|
|
57
|
-
).then((processes)=>processes.length > 0 ? processes : [
|
|
51
|
+
}).then((entries)=>entries.map($24b2f47d8f306cb3$var$compileContract(parsedArgs))).then((processes)=>processes.length > 0 ? processes : [
|
|
58
52
|
{
|
|
59
53
|
contract: "None found",
|
|
60
54
|
artifact: "N/A"
|
|
61
55
|
}
|
|
62
|
-
]
|
|
63
|
-
).then((promises)=>Promise.all(promises)
|
|
64
|
-
);
|
|
56
|
+
]).then((promises)=>Promise.all(promises));
|
|
65
57
|
};
|
|
66
58
|
const $24b2f47d8f306cb3$export$ef7acd7185315e22 = (parsedArgs)=>{
|
|
67
59
|
const p = parsedArgs.sourceFile ? $24b2f47d8f306cb3$var$compileContract(parsedArgs)(parsedArgs.sourceFile).then((result)=>[
|
|
68
60
|
result
|
|
69
|
-
]
|
|
70
|
-
|
|
71
|
-
if (results.length === 0) $kQNfl$taquerianodesdk.sendErr("No contracts found to compile.");
|
|
61
|
+
]) : $24b2f47d8f306cb3$var$compileAll(parsedArgs).then((results)=>{
|
|
62
|
+
if (results.length === 0) (0, $kQNfl$taquerianodesdk.sendErr)("No contracts found to compile.");
|
|
72
63
|
return results;
|
|
73
64
|
});
|
|
74
|
-
return p.then($kQNfl$taquerianodesdk.sendJsonRes).catch((err)
|
|
75
|
-
);
|
|
65
|
+
return p.then((0, $kQNfl$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $kQNfl$taquerianodesdk.sendAsyncErr)(err, false));
|
|
76
66
|
};
|
|
77
67
|
var $24b2f47d8f306cb3$export$2e2bcd8739ae039 = $24b2f47d8f306cb3$export$ef7acd7185315e22;
|
|
78
68
|
|
|
79
69
|
|
|
80
|
-
$kQNfl$taquerianodesdk.Plugin.create((i18n)=>({
|
|
70
|
+
(0, $kQNfl$taquerianodesdk.Plugin).create((i18n)=>({
|
|
81
71
|
schema: "1.0",
|
|
82
72
|
version: "0.1",
|
|
83
73
|
alias: "ligo",
|
|
84
74
|
tasks: [
|
|
85
|
-
$kQNfl$taquerianodesdk.Task.create({
|
|
75
|
+
(0, $kQNfl$taquerianodesdk.Task).create({
|
|
86
76
|
task: "compile",
|
|
87
77
|
command: "compile [sourceFile]",
|
|
88
78
|
aliases: [
|
|
@@ -91,24 +81,24 @@ $kQNfl$taquerianodesdk.Plugin.create((i18n)=>({
|
|
|
91
81
|
],
|
|
92
82
|
description: "Compile a smart contract written in a Ligo syntax to Michelson code",
|
|
93
83
|
options: [
|
|
94
|
-
$kQNfl$taquerianodesdk.Option.create({
|
|
84
|
+
(0, $kQNfl$taquerianodesdk.Option).create({
|
|
95
85
|
shortFlag: "e",
|
|
96
86
|
flag: "entrypoint",
|
|
97
87
|
description: "The entry point that will be compiled"
|
|
98
88
|
}),
|
|
99
|
-
$kQNfl$taquerianodesdk.Option.create({
|
|
89
|
+
(0, $kQNfl$taquerianodesdk.Option).create({
|
|
100
90
|
shortFlag: "s",
|
|
101
91
|
flag: "syntax",
|
|
102
92
|
description: "The syntax used in the contract"
|
|
103
93
|
}),
|
|
104
|
-
$kQNfl$taquerianodesdk.Option.create({
|
|
94
|
+
(0, $kQNfl$taquerianodesdk.Option).create({
|
|
105
95
|
shortFlag: "i",
|
|
106
96
|
flag: "infer",
|
|
107
97
|
description: "Enable type inference"
|
|
108
98
|
})
|
|
109
99
|
],
|
|
110
|
-
handler:
|
|
111
|
-
encoding:
|
|
100
|
+
handler: "proxy",
|
|
101
|
+
encoding: "json"
|
|
112
102
|
})
|
|
113
103
|
],
|
|
114
104
|
checkRuntimeDependencies: ()=>Promise.resolve({
|
|
@@ -122,16 +112,13 @@ $kQNfl$taquerianodesdk.Plugin.create((i18n)=>({
|
|
|
122
112
|
met: true
|
|
123
113
|
}
|
|
124
114
|
]
|
|
125
|
-
})
|
|
126
|
-
,
|
|
115
|
+
}),
|
|
127
116
|
installRunTimeDependencies: ()=>Promise.resolve({
|
|
128
117
|
status: "success",
|
|
129
118
|
output: "LIGO was found in /usr/bin/ligo" // TODO this should use i18n
|
|
130
|
-
})
|
|
131
|
-
,
|
|
132
|
-
|
|
133
|
-
})
|
|
134
|
-
, process.argv);
|
|
119
|
+
}),
|
|
120
|
+
proxy: (0, $24b2f47d8f306cb3$export$2e2bcd8739ae039)
|
|
121
|
+
}), process.argv);
|
|
135
122
|
|
|
136
123
|
|
|
137
124
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;ACAA;;;AAWA,MAAM,iDAA2B,GAAG,CAAC,IAAU,GAAK,CAAC,UAAkB,GAAK;QACxE,MAAM,OAAO,GAAG,oBAAQ,CAAC,UAAU,EAAE,mBAAO,CAAC,UAAU,CAAC,CAAC;QACzD,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;KACzD;
|
|
1
|
+
{"mappings":";;;;AAAA;ACAA;;;AAWA,MAAM,iDAA2B,GAAG,CAAC,IAAU,GAAK,CAAC,UAAkB,GAAK;QACxE,MAAM,OAAO,GAAG,CAAA,GAAA,oBAAQ,CAAA,CAAC,UAAU,EAAE,CAAA,GAAA,mBAAO,CAAA,CAAC,UAAU,CAAC,CAAC;QACzD,OAAO,CAAA,GAAA,gBAAI,CAAA,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;KACzD;AAED,MAAM,sCAAgB,GAAG,CAAC,IAAU,G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MAAM,CAAC;wBACV,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,OAAO;wBACb,WAAW,EAAE,uBAAuB;qBACvC,CAAC;iBACL;gBACD,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;aACnB,CAAC;SACL;QACD,wBAAwB,EAAE,IAAM,OAAO,CAAC,OAAO,CAAC;gBAC5C,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE;oBACJ;wBAAC,IAAI,EAAE,MAAM;wBAAE,IAAI,EAAE,MAAM;wBAAE,OAAO,EAAE,UAAU;wBAAE,IAAI,EAAE,UAAU;wBAAE,GAAG,EAAE,IAAI;qBAAC;iBACjF;aACJ,CAAC;QACF,0BAA0B,EAAE,IAAM,OAAO,CAAC,OAAO,CAAC;gBAC9C,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,iCAAiC,CAAC,4BAA4B;aACzE,CAAC;QACF,KAAK,EAAE,CAAA,GAAA,wCAAO,CAAA;KACjB,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/compile.ts"],"sourcesContent":["import {Plugin, Task, Option} from '@taqueria/node-sdk'\nimport compile from './compile'\n\nPlugin.create(i18n => ({\n schema: \"1.0\",\n version: \"0.1\",\n alias: \"ligo\",\n tasks: [\n Task.create({\n task: \"compile\",\n command: \"compile [sourceFile]\",\n aliases: [\"c\", \"compile-ligo\"],\n description: \"Compile a smart contract written in a Ligo syntax to Michelson code\",\n options: [\n Option.create({\n shortFlag: \"e\",\n flag: \"entrypoint\",\n description: \"The entry point that will be compiled\"\n }),\n Option.create({\n shortFlag: \"s\",\n flag: \"syntax\",\n description: \"The syntax used in the contract\"\n }),\n Option.create({\n shortFlag: \"i\",\n flag: \"infer\",\n description: \"Enable type inference\"\n })\n ],\n handler: 'proxy',\n encoding: 'json'\n })\n ],\n checkRuntimeDependencies: () => Promise.resolve({\n status: \"success\",\n report: [\n {name: \"LIGO\", path: \"ligo\", version: \">=0.27.0\", kind: \"required\", met: true}\n ]\n }),\n installRunTimeDependencies: () => Promise.resolve({\n status: \"success\",\n output: \"LIGO was found in /usr/bin/ligo\" // TODO this should use i18n\n }),\n proxy: compile\n}), process.argv)","import {execCmd, getArch, sendAsyncErr, sendJsonRes, sendErr} from '@taqueria/node-sdk'\nimport {RequestArgs, PluginResponse, LikeAPromise} from \"@taqueria/node-sdk/types\";\nimport {extname, basename, join} from 'path'\nimport glob = require('fast-glob')\n\ninterface Opts extends RequestArgs.t {\n entrypoint?: string\n syntax?: string\n sourceFile?: string\n}\n\nconst getContractArtifactFilename = (opts: Opts) => (sourceFile: string) => {\n const outFile = basename(sourceFile, extname(sourceFile))\n return join(opts.config.artifactsDir, `${outFile}.tz`)\n}\n\nconst getInputFilename = (opts: Opts) => (sourceFile: string) => {\n return join(opts.config.contractsDir, sourceFile)\n}\n\nconst getCompileCommand = (opts: Opts) => (sourceFile: string) => {\n const projectDir = process.env.PROJECT_DIR ?? opts.projectDir\n\n if (!projectDir) throw `No project directory provided`\n \n const inputFile = getInputFilename (opts) (sourceFile)\n const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`\n const entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : \"\"\n const syntax = opts[\"syntax\"] ? `-s ${opts['syntax']} : \"\"` : \"\"\n const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`\n const cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`\n return cmd\n}\n\nconst compileContract = (opts: Opts) => (sourceFile: string): Promise<{contract: string, artifact: string}> =>\n getArch()\n .then(() => getCompileCommand (opts) (sourceFile))\n .then(execCmd)\n .then(({stderr}) => { // How should we output warnings?\n if (stderr.length > 0) sendErr(stderr)\n return {\n contract: sourceFile,\n artifact: getContractArtifactFilename (opts) (sourceFile)\n }\n })\n .catch(err => {\n sendErr(\" \")\n sendErr(err.message.split(\"\\n\").slice(1).join(\"\\n\"))\n return Promise.resolve({\n contract: sourceFile,\n artifact: \"Not compiled\"\n })\n })\n\nconst compileAll = (parsedArgs: Opts): Promise<{contract: string, artifact: string}[]> => {\n // TODO: Fetch list of files from SDK\n return glob(\n ['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n {cwd: parsedArgs.config.contractsDir, absolute: false}\n )\n .then(entries => entries.map(compileContract (parsedArgs)))\n .then(processes => processes.length > 0\n ? processes\n : [{contract: \"None found\", artifact: \"N/A\"}]\n )\n .then(promises => Promise.all(promises))\n}\n\nexport const compile = (parsedArgs: Opts): Promise<PluginResponse> => {\n const p = parsedArgs.sourceFile\n ? compileContract (parsedArgs) (parsedArgs.sourceFile as string)\n .then(result => [result])\n : compileAll(parsedArgs)\n .then(results => {\n if (results.length === 0) sendErr(\"No contracts found to compile.\")\n return results\n })\n \n return p\n .then(sendJsonRes)\n .catch(err => sendAsyncErr(err, false))\n}\n\nexport default compile"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
|