@taqueria/plugin-ligo 0.0.0-pr-810-53ffecf2 → 0.0.0-pr-829-20439d01

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.
Files changed (3) hide show
  1. package/index.js +60 -73
  2. package/index.js.map +1 -1
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -7,131 +7,118 @@ 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
- const entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : '';
24
- const syntax = opts['syntax'] ? `-s ${opts['syntax']} : ""` : '';
21
+ const entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : "";
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
- const $24b2f47d8f306cb3$var$compileContract = (opts)=>(sourceFile)=>$kQNfl$taquerianodesdk.getArch().then(()=>$24b2f47d8f306cb3$var$getCompileCommand(opts)(sourceFile)
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
- artifact: 'Not compiled'
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
- '**/*.ligo',
50
- '**/*.religo',
51
- '**/*.mligo',
52
- '**/*.jsligo'
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
- contract: 'None found',
60
- artifact: 'N/A'
53
+ contract: "None found",
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
- ) : $24b2f47d8f306cb3$var$compileAll(parsedArgs).then((results)=>{
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)=>$kQNfl$taquerianodesdk.sendAsyncErr(err, false)
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)=>({
81
- schema: '1.0',
82
- version: '0.1',
83
- alias: 'ligo',
70
+ (0, $kQNfl$taquerianodesdk.Plugin).create((i18n)=>({
71
+ schema: "1.0",
72
+ version: "0.1",
73
+ alias: "ligo",
84
74
  tasks: [
85
- $kQNfl$taquerianodesdk.Task.create({
86
- task: 'compile',
87
- command: 'compile [sourceFile]',
75
+ (0, $kQNfl$taquerianodesdk.Task).create({
76
+ task: "compile",
77
+ command: "compile [sourceFile]",
88
78
  aliases: [
89
- 'c',
90
- 'compile-ligo'
79
+ "c",
80
+ "compile-ligo"
91
81
  ],
92
- description: 'Compile a smart contract written in a Ligo syntax to Michelson code',
82
+ description: "Compile a smart contract written in a Ligo syntax to Michelson code",
93
83
  options: [
94
- $kQNfl$taquerianodesdk.Option.create({
95
- shortFlag: 'e',
96
- flag: 'entrypoint',
97
- description: 'The entry point that will be compiled'
84
+ (0, $kQNfl$taquerianodesdk.Option).create({
85
+ shortFlag: "e",
86
+ flag: "entrypoint",
87
+ description: "The entry point that will be compiled"
98
88
  }),
99
- $kQNfl$taquerianodesdk.Option.create({
100
- shortFlag: 's',
101
- flag: 'syntax',
102
- description: 'The syntax used in the contract'
89
+ (0, $kQNfl$taquerianodesdk.Option).create({
90
+ shortFlag: "s",
91
+ flag: "syntax",
92
+ description: "The syntax used in the contract"
103
93
  }),
104
- $kQNfl$taquerianodesdk.Option.create({
105
- shortFlag: 'i',
106
- flag: 'infer',
107
- description: 'Enable type inference'
94
+ (0, $kQNfl$taquerianodesdk.Option).create({
95
+ shortFlag: "i",
96
+ flag: "infer",
97
+ description: "Enable type inference"
108
98
  }),
109
99
  ],
110
- handler: 'proxy',
111
- encoding: 'json'
100
+ handler: "proxy",
101
+ encoding: "json"
112
102
  }),
113
103
  ],
114
104
  checkRuntimeDependencies: ()=>Promise.resolve({
115
- status: 'success',
105
+ status: "success",
116
106
  report: [
117
107
  {
118
- name: 'LIGO',
119
- path: 'ligo',
120
- version: '>=0.27.0',
121
- kind: 'required',
108
+ name: "LIGO",
109
+ path: "ligo",
110
+ version: ">=0.27.0",
111
+ kind: "required",
122
112
  met: true
123
113
  },
124
114
  ]
125
- })
126
- ,
115
+ }),
127
116
  installRunTimeDependencies: ()=>Promise.resolve({
128
- status: 'success',
129
- output: 'LIGO was found in /usr/bin/ligo'
130
- })
131
- ,
132
- proxy: $24b2f47d8f306cb3$export$2e2bcd8739ae039
133
- })
134
- , process.argv);
117
+ status: "success",
118
+ output: "LIGO was found in /usr/bin/ligo"
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,GAC9C,CAAC,UAAkB,GAAK;QACvB,MAAM,OAAO,GAAG,oBAAQ,CAAC,UAAU,EAAE,mBAAO,CAAC,UAAU,CAAC,CAAC,AAAC;QAC1D,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KACvD;AAAC;AAEH,MAAM,sCAAgB,GAAG,CAAC,IAAU,GACnC,CAAC,UAAkB,GAAK;QACvB,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;KAClD;AAAC;AAEH,MAAM,uCAAiB,GAAG,CAAC,IAAU,GACpC,CAAC,UAAkB,GAAK;QACvB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,AAAC;QAE9D,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,6BAA6B,CAAC,CAAC;QAEvD,MAAM,SAAS,GAAG,sCAAgB,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,AAAC;QACrD,MAAM,WAAW,GAChB,CAAC,yDAAyD,EAAE,UAAU,CAAC,4DAA4D,EAAE,SAAS,CAAC,CAAC,AAAC;QAClJ,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,G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,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,MAAM;QACb,KAAK,EAAE;YACN,2BAAI,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,sBAAsB;gBAC/B,OAAO,EAAE;oBAAC,GAAG;oBAAE,cAAc;iBAAC;gBAC9B,WAAW,EAAE,qEAAqE;gBAClF,OAAO,EAAE;oBACR,6BAAM,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,YAAY;wBAClB,WAAW,EAAE,uCAAuC;qBACpD,CAAC;oBACF,6BAAM,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iCAAiC;qBAC9C,CAAC;oBACF,6BAAM,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,OAAO;wBACb,WAAW,EAAE,uBAAuB;qBACpC,CAAC;iBACF;gBACD,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;aAChB,CAAC;SACF;QACD,wBAAwB,EAAE,IACzB,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE;oBACP;wBAAE,IAAI,EAAE,MAAM;wBAAE,IAAI,EAAE,MAAM;wBAAE,OAAO,EAAE,UAAU;wBAAE,IAAI,EAAE,UAAU;wBAAE,GAAG,EAAE,IAAI;qBAAE;iBAChF;aACD,CAAC;QAAA;QACH,0BAA0B,EAAE,IAC3B,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,iCAAiC;aACzC,CAAC;QAAA;QACH,KAAK,EAAE,wCAAO;KACd,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/compile.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport compile from './compile';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile [sourceFile]',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription: 'Compile a smart contract written in a Ligo syntax to Michelson code',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'e',\n\t\t\t\t\tflag: 'entrypoint',\n\t\t\t\t\tdescription: 'The entry point that will be compiled',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'i',\n\t\t\t\t\tflag: 'infer',\n\t\t\t\t\tdescription: 'Enable type inference',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t],\n\tcheckRuntimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\treport: [\n\t\t\t\t{ name: 'LIGO', path: 'ligo', version: '>=0.27.0', kind: 'required', met: true },\n\t\t\t],\n\t\t}),\n\tinstallRunTimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\toutput: 'LIGO was found in /usr/bin/ligo', // TODO this should use i18n\n\t\t}),\n\tproxy: compile,\n}), process.argv);\n","import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport { LikeAPromise, PluginResponse, RequestArgs } from '@taqueria/node-sdk/types';\nimport { basename, extname, join } from 'path';\nimport glob = require('fast-glob');\n\ninterface Opts extends RequestArgs.t {\n\tentrypoint?: string;\n\tsyntax?: string;\n\tsourceFile?: string;\n}\n\nconst getContractArtifactFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst outFile = basename(sourceFile, extname(sourceFile));\n\t\treturn join(opts.config.artifactsDir, `${outFile}.tz`);\n\t};\n\nconst getInputFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\treturn join(opts.config.contractsDir, sourceFile);\n\t};\n\nconst getCompileCommand = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? opts.projectDir;\n\n\t\tif (!projectDir) throw `No project directory provided`;\n\n\t\tconst inputFile = getInputFilename(opts)(sourceFile);\n\t\tconst baseCommand =\n\t\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`;\n\t\tconst entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : '';\n\t\tconst syntax = opts['syntax'] ? `-s ${opts['syntax']} : \"\"` : '';\n\t\tconst outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;\n\t\tconst cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`;\n\t\treturn cmd;\n\t};\n\nconst compileContract = (opts: Opts) =>\n\t(sourceFile: string): Promise<{ contract: string; artifact: string }> =>\n\t\tgetArch()\n\t\t\t.then(() => getCompileCommand(opts)(sourceFile))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => { // How should we output warnings?\n\t\t\t\tif (stderr.length > 0) sendErr(stderr);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: getContractArtifactFilename(opts)(sourceFile),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tsendErr(' ');\n\t\t\t\tsendErr(err.message.split('\\n').slice(1).join('\\n'));\n\t\t\t\treturn Promise.resolve({\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: 'Not compiled',\n\t\t\t\t});\n\t\t\t});\n\nconst compileAll = (parsedArgs: Opts): Promise<{ contract: string; artifact: string }[]> => {\n\t// TODO: Fetch list of files from SDK\n\treturn glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{ cwd: parsedArgs.config.contractsDir, absolute: false },\n\t)\n\t\t.then(entries => entries.map(compileContract(parsedArgs)))\n\t\t.then(processes =>\n\t\t\tprocesses.length > 0\n\t\t\t\t? processes\n\t\t\t\t: [{ contract: 'None found', artifact: 'N/A' }]\n\t\t)\n\t\t.then(promises => Promise.all(promises));\n};\n\nexport const compile = (parsedArgs: Opts): Promise<PluginResponse> => {\n\tconst p = parsedArgs.sourceFile\n\t\t? compileContract(parsedArgs)(parsedArgs.sourceFile as string)\n\t\t\t.then(result => [result])\n\t\t: compileAll(parsedArgs)\n\t\t\t.then(results => {\n\t\t\t\tif (results.length === 0) sendErr('No contracts found to compile.');\n\t\t\t\treturn results;\n\t\t\t});\n\n\treturn p\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
1
+ {"mappings":";;;;AAAA;ACAA;;;AAWA,MAAM,iDAA2B,GAAG,CAAC,IAAU,GAC9C,CAAC,UAAkB,GAAK;QACvB,MAAM,OAAO,GAAG,CAAA,GAAA,oBAAQ,CAAA,CAAC,UAAU,EAAE,CAAA,GAAA,mBAAO,CAAA,CAAC,UAAU,CAAC,CAAC,AAAC;QAC1D,OAAO,CAAA,GAAA,gBAAI,CAAA,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KACvD,AAAC;AAEH,MAAM,sCAAgB,GAAG,CAAC,IAAU,GACnC,CAAC,UAAkB,GAAK;QACvB,OAAO,CAAA,GAAA,gBAAI,CAAA,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;KAClD,AAAC;AAEH,MAAM,uCAAiB,GAAG,C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ACb,WAAW,EAAE,uBAAuB;qBACpC,CAAC;iBACF;gBACD,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;aAChB,CAAC;SACF;QACD,wBAAwB,EAAE,IACzB,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE;oBACP;wBAAE,IAAI,EAAE,MAAM;wBAAE,IAAI,EAAE,MAAM;wBAAE,OAAO,EAAE,UAAU;wBAAE,IAAI,EAAE,UAAU;wBAAE,GAAG,EAAE,IAAI;qBAAE;iBAChF;aACD,CAAC;QACH,0BAA0B,EAAE,IAC3B,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,iCAAiC;aACzC,CAAC;QACH,KAAK,EAAE,CAAA,GAAA,wCAAO,CAAA;KACd,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-ligo/index.ts","taqueria-plugin-ligo/compile.ts"],"sourcesContent":["import { Option, Plugin, Task } from '@taqueria/node-sdk';\nimport compile from './compile';\n\nPlugin.create(i18n => ({\n\tschema: '1.0',\n\tversion: '0.1',\n\talias: 'ligo',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile [sourceFile]',\n\t\t\taliases: ['c', 'compile-ligo'],\n\t\t\tdescription: 'Compile a smart contract written in a Ligo syntax to Michelson code',\n\t\t\toptions: [\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'e',\n\t\t\t\t\tflag: 'entrypoint',\n\t\t\t\t\tdescription: 'The entry point that will be compiled',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 's',\n\t\t\t\t\tflag: 'syntax',\n\t\t\t\t\tdescription: 'The syntax used in the contract',\n\t\t\t\t}),\n\t\t\t\tOption.create({\n\t\t\t\t\tshortFlag: 'i',\n\t\t\t\t\tflag: 'infer',\n\t\t\t\t\tdescription: 'Enable type inference',\n\t\t\t\t}),\n\t\t\t],\n\t\t\thandler: 'proxy',\n\t\t\tencoding: 'json',\n\t\t}),\n\t],\n\tcheckRuntimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\treport: [\n\t\t\t\t{ name: 'LIGO', path: 'ligo', version: '>=0.27.0', kind: 'required', met: true },\n\t\t\t],\n\t\t}),\n\tinstallRunTimeDependencies: () =>\n\t\tPromise.resolve({\n\t\t\tstatus: 'success',\n\t\t\toutput: 'LIGO was found in /usr/bin/ligo', // TODO this should use i18n\n\t\t}),\n\tproxy: compile,\n}), process.argv);\n","import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport { LikeAPromise, PluginResponse, RequestArgs } from '@taqueria/node-sdk/types';\nimport { basename, extname, join } from 'path';\nimport glob = require('fast-glob');\n\ninterface Opts extends RequestArgs.t {\n\tentrypoint?: string;\n\tsyntax?: string;\n\tsourceFile?: string;\n}\n\nconst getContractArtifactFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst outFile = basename(sourceFile, extname(sourceFile));\n\t\treturn join(opts.config.artifactsDir, `${outFile}.tz`);\n\t};\n\nconst getInputFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\treturn join(opts.config.contractsDir, sourceFile);\n\t};\n\nconst getCompileCommand = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst projectDir = process.env.PROJECT_DIR ?? opts.projectDir;\n\n\t\tif (!projectDir) throw `No project directory provided`;\n\n\t\tconst inputFile = getInputFilename(opts)(sourceFile);\n\t\tconst baseCommand =\n\t\t\t`DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project ligolang/ligo:next compile contract ${inputFile}`;\n\t\tconst entryPoint = opts.entrypoint ? `-e ${opts.entrypoint}` : '';\n\t\tconst syntax = opts['syntax'] ? `-s ${opts['syntax']} : \"\"` : '';\n\t\tconst outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;\n\t\tconst cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`;\n\t\treturn cmd;\n\t};\n\nconst compileContract = (opts: Opts) =>\n\t(sourceFile: string): Promise<{ contract: string; artifact: string }> =>\n\t\tgetArch()\n\t\t\t.then(() => getCompileCommand(opts)(sourceFile))\n\t\t\t.then(execCmd)\n\t\t\t.then(({ stderr }) => { // How should we output warnings?\n\t\t\t\tif (stderr.length > 0) sendErr(stderr);\n\t\t\t\treturn {\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: getContractArtifactFilename(opts)(sourceFile),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tsendErr(' ');\n\t\t\t\tsendErr(err.message.split('\\n').slice(1).join('\\n'));\n\t\t\t\treturn Promise.resolve({\n\t\t\t\t\tcontract: sourceFile,\n\t\t\t\t\tartifact: 'Not compiled',\n\t\t\t\t});\n\t\t\t});\n\nconst compileAll = (parsedArgs: Opts): Promise<{ contract: string; artifact: string }[]> => {\n\t// TODO: Fetch list of files from SDK\n\treturn glob(\n\t\t['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],\n\t\t{ cwd: parsedArgs.config.contractsDir, absolute: false },\n\t)\n\t\t.then(entries => entries.map(compileContract(parsedArgs)))\n\t\t.then(processes =>\n\t\t\tprocesses.length > 0\n\t\t\t\t? processes\n\t\t\t\t: [{ contract: 'None found', artifact: 'N/A' }]\n\t\t)\n\t\t.then(promises => Promise.all(promises));\n};\n\nexport const compile = (parsedArgs: Opts): Promise<PluginResponse> => {\n\tconst p = parsedArgs.sourceFile\n\t\t? compileContract(parsedArgs)(parsedArgs.sourceFile as string)\n\t\t\t.then(result => [result])\n\t\t: compileAll(parsedArgs)\n\t\t\t.then(results => {\n\t\t\t\tif (results.length === 0) sendErr('No contracts found to compile.');\n\t\t\t\treturn results;\n\t\t\t});\n\n\treturn p\n\t\t.then(sendJsonRes)\n\t\t.catch(err => sendAsyncErr(err, false));\n};\n\nexport default compile;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-ligo",
3
- "version": "0.0.0-pr-810-53ffecf2",
3
+ "version": "0.0.0-pr-829-20439d01",
4
4
  "description": "A taqueria plugin for compiling LIGO smart contracts",
5
5
  "targets": {
6
6
  "default": {
@@ -45,7 +45,7 @@
45
45
  "fast-glob": "^3.2.11"
46
46
  },
47
47
  "devDependencies": {
48
- "parcel": "^2.5.0",
48
+ "parcel": "^2.6.0",
49
49
  "typescript": "^4.7.2"
50
50
  }
51
51
  }