@taqueria/plugin-ligo 0.0.0-pr-695-bec90e45 → 0.0.0-pr-740-e1500660

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/compile.ts CHANGED
@@ -1,86 +1,80 @@
1
- import { execCmd, getArch, sendAsyncErr, sendErr, sendJsonRes } from '@taqueria/node-sdk';
2
- import { Failure, LikeAPromise, PluginResponse, SanitizedArgs } from '@taqueria/node-sdk/types';
3
- import { basename, extname, join } from 'path';
4
- import glob = require('fast-glob');
1
+ import {execCmd, getArch, sendAsyncErr, sendJsonRes, sendErr} from '@taqueria/node-sdk'
2
+ import {SanitizedArgs, PluginResponse, Failure, LikeAPromise} from "@taqueria/node-sdk/types";
3
+ import {extname, basename, join} from 'path'
4
+ import glob = require('fast-glob')
5
5
 
6
- type Opts = SanitizedArgs & Record<string, unknown>;
6
+ type Opts = SanitizedArgs & Record<string, unknown>
7
7
 
8
- const getContractArtifactFilename = (opts: Opts) =>
9
- (sourceFile: string) => {
10
- const outFile = basename(sourceFile, extname(sourceFile));
11
- return join(opts.config.artifactsDir, `${outFile}.tz`);
12
- };
8
+ const getContractArtifactFilename = (opts: Opts) => (sourceFile: string) => {
9
+ const outFile = basename(sourceFile, extname(sourceFile))
10
+ return join(opts.config.artifactsDir, `${outFile}.tz`)
11
+ }
13
12
 
14
- const getInputFilename = (opts: Opts) =>
15
- (sourceFile: string) => {
16
- return join(opts.config.contractsDir, sourceFile);
17
- };
13
+ const getInputFilename = (opts: Opts) => (sourceFile: string) => {
14
+ return join(opts.config.contractsDir, sourceFile)
15
+ }
18
16
 
19
- const getCompileCommand = (opts: Opts) =>
20
- (sourceFile: string) => {
21
- const projectDir = process.env.PROJECT_DIR ?? opts.projectDir;
17
+ const getCompileCommand = (opts: Opts) => (sourceFile: string) => {
18
+ const projectDir = process.env.PROJECT_DIR ?? opts.projectDir
22
19
 
23
- if (!projectDir) throw `No project directory provided`;
20
+ if (!projectDir) throw `No project directory provided`
21
+
22
+ const inputFile = getInputFilename (opts) (sourceFile)
23
+ const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:0.41.0 compile contract ${inputFile}`
24
+ const entryPoint = opts.e ? `-e ${opts.e}` : ""
25
+ const syntax = opts["-s"] ? `s ${opts['s']} : ""` : ""
26
+ const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`
27
+ const cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`
28
+ return cmd
29
+ }
24
30
 
25
- const inputFile = getInputFilename(opts)(sourceFile);
26
- const baseCommand =
27
- `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:0.41.0 compile contract ${inputFile}`;
28
- const entryPoint = opts.e ? `-e ${opts.e}` : '';
29
- const syntax = opts['-s'] ? `s ${opts['s']} : ""` : '';
30
- const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;
31
- const cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`;
32
- return cmd;
33
- };
31
+ const compileContract = (opts: Opts) => (sourceFile: string): Promise<{contract: string, artifact: string}> =>
32
+ getArch()
33
+ .then(() => getCompileCommand (opts) (sourceFile))
34
+ .then(execCmd)
35
+ .then(({stderr}) => { // How should we output warnings?
36
+ if (stderr.length > 0) sendErr(stderr)
37
+ return {
38
+ contract: sourceFile,
39
+ artifact: getContractArtifactFilename (opts) (sourceFile)
40
+ }
41
+ })
42
+ .catch(err => {
43
+ sendErr(" ")
44
+ sendErr(err.message.split("\n").slice(1).join("\n"))
45
+ return Promise.resolve({
46
+ contract: sourceFile,
47
+ artifact: "Not compiled"
48
+ })
49
+ })
34
50
 
35
- const compileContract = (opts: Opts) =>
36
- (sourceFile: string): Promise<{ contract: string; artifact: string }> =>
37
- getArch()
38
- .then(() => getCompileCommand(opts)(sourceFile))
39
- .then(execCmd)
40
- .then(({ stderr }) => { // How should we output warnings?
41
- if (stderr.length > 0) sendErr(stderr);
42
- return {
43
- contract: sourceFile,
44
- artifact: getContractArtifactFilename(opts)(sourceFile),
45
- };
46
- })
47
- .catch(err => {
48
- sendErr(' ');
49
- sendErr(err.message.split('\n').slice(1).join('\n'));
50
- return Promise.resolve({
51
- contract: sourceFile,
52
- artifact: 'Not compiled',
53
- });
54
- });
55
-
56
- const compileAll = (parsedArgs: Opts): Promise<{ contract: string; artifact: string }[]> => {
57
- // TODO: Fetch list of files from SDK
58
- return glob(
59
- ['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],
60
- { cwd: parsedArgs.contractsDir, absolute: false },
61
- )
62
- .then(entries => entries.map(compileContract(parsedArgs)))
63
- .then(processes =>
64
- processes.length > 0
65
- ? processes
66
- : [{ contract: 'None found', artifact: 'N/A' }]
67
- )
68
- .then(promises => Promise.all(promises));
69
- };
51
+ const compileAll = (parsedArgs: Opts): Promise<{contract: string, artifact: string}[]> => {
52
+ // TODO: Fetch list of files from SDK
53
+ return glob(
54
+ ['**/*.ligo', '**/*.religo', '**/*.mligo', '**/*.jsligo'],
55
+ {cwd: parsedArgs.contractsDir, absolute: false}
56
+ )
57
+ .then(entries => entries.map(compileContract (parsedArgs)))
58
+ .then(processes => processes.length > 0
59
+ ? processes
60
+ : [{contract: "None found", artifact: "N/A"}]
61
+ )
62
+ .then(promises => Promise.all(promises))
63
+ }
70
64
 
71
65
  export const compile = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {
72
- const p = parsedArgs.sourceFile
73
- ? compileContract(parsedArgs)(parsedArgs.sourceFile as string)
74
- .then(result => [result])
75
- : compileAll(parsedArgs)
76
- .then(results => {
77
- if (results.length === 0) sendErr('No contracts found to compile.');
78
- return results;
79
- });
80
-
81
- return p
82
- .then(sendJsonRes)
83
- .catch(err => sendAsyncErr(err, false));
84
- };
66
+ const p = parsedArgs.sourceFile
67
+ ? compileContract (parsedArgs) (parsedArgs.sourceFile as string)
68
+ .then(result => [result])
69
+ : compileAll(parsedArgs)
70
+ .then(results => {
71
+ if (results.length === 0) sendErr("No contracts found to compile.")
72
+ return results
73
+ })
74
+
75
+ return p
76
+ .then(sendJsonRes)
77
+ .catch(err => sendAsyncErr(err, false))
78
+ }
85
79
 
86
- export default compile;
80
+ export default compile
package/index.js CHANGED
@@ -20,8 +20,8 @@ const $24b2f47d8f306cb3$var$getCompileCommand = (opts)=>(sourceFile)=>{
20
20
  if (!projectDir) throw `No project directory provided`;
21
21
  const inputFile = $24b2f47d8f306cb3$var$getInputFilename(opts)(sourceFile);
22
22
  const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project ligolang/ligo:0.41.0 compile contract ${inputFile}`;
23
- const entryPoint = opts.e ? `-e ${opts.e}` : '';
24
- const syntax = opts['-s'] ? `s ${opts['s']} : ""` : '';
23
+ const entryPoint = opts.e ? `-e ${opts.e}` : "";
24
+ const syntax = opts["-s"] ? `s ${opts['s']} : ""` : "";
25
25
  const outFile = `-o ${$24b2f47d8f306cb3$var$getContractArtifactFilename(opts)(sourceFile)}`;
26
26
  const cmd = `${baseCommand} ${entryPoint} ${syntax} ${outFile}`;
27
27
  return cmd;
@@ -35,11 +35,11 @@ const $24b2f47d8f306cb3$var$compileContract = (opts)=>(sourceFile)=>$kQNfl$taque
35
35
  artifact: $24b2f47d8f306cb3$var$getContractArtifactFilename(opts)(sourceFile)
36
36
  };
37
37
  }).catch((err)=>{
38
- $kQNfl$taquerianodesdk.sendErr(' ');
39
- $kQNfl$taquerianodesdk.sendErr(err.message.split('\n').slice(1).join('\n'));
38
+ $kQNfl$taquerianodesdk.sendErr(" ");
39
+ $kQNfl$taquerianodesdk.sendErr(err.message.split("\n").slice(1).join("\n"));
40
40
  return Promise.resolve({
41
41
  contract: sourceFile,
42
- artifact: 'Not compiled'
42
+ artifact: "Not compiled"
43
43
  });
44
44
  })
45
45
  ;
@@ -56,8 +56,8 @@ const $24b2f47d8f306cb3$var$compileAll = (parsedArgs)=>{
56
56
  }).then((entries)=>entries.map($24b2f47d8f306cb3$var$compileContract(parsedArgs))
57
57
  ).then((processes)=>processes.length > 0 ? processes : [
58
58
  {
59
- contract: 'None found',
60
- artifact: 'N/A'
59
+ contract: "None found",
60
+ artifact: "N/A"
61
61
  }
62
62
  ]
63
63
  ).then((promises)=>Promise.all(promises)
@@ -68,7 +68,7 @@ const $24b2f47d8f306cb3$export$ef7acd7185315e22 = (parsedArgs)=>{
68
68
  result
69
69
  ]
70
70
  ) : $24b2f47d8f306cb3$var$compileAll(parsedArgs).then((results)=>{
71
- if (results.length === 0) $kQNfl$taquerianodesdk.sendErr('No contracts found to compile.');
71
+ if (results.length === 0) $kQNfl$taquerianodesdk.sendErr("No contracts found to compile.");
72
72
  return results;
73
73
  });
74
74
  return p.then($kQNfl$taquerianodesdk.sendJsonRes).catch((err)=>$kQNfl$taquerianodesdk.sendAsyncErr(err, false)
@@ -78,55 +78,55 @@ var $24b2f47d8f306cb3$export$2e2bcd8739ae039 = $24b2f47d8f306cb3$export$ef7acd71
78
78
 
79
79
 
80
80
  $kQNfl$taquerianodesdk.Plugin.create((i18n)=>({
81
- schema: '1.0',
82
- version: '0.1',
83
- alias: 'ligo',
81
+ schema: "1.0",
82
+ version: "0.1",
83
+ alias: "ligo",
84
84
  tasks: [
85
85
  $kQNfl$taquerianodesdk.Task.create({
86
- task: 'compile',
87
- command: 'compile [sourceFile]',
86
+ task: "compile",
87
+ command: "compile [sourceFile]",
88
88
  aliases: [
89
- 'c',
90
- 'compile-ligo'
89
+ "c",
90
+ "compile-ligo"
91
91
  ],
92
- description: 'Compile a smart contract written in a Ligo syntax to Michelson code',
92
+ description: "Compile a smart contract written in a Ligo syntax to Michelson code",
93
93
  options: [
94
94
  $kQNfl$taquerianodesdk.Option.create({
95
- shortFlag: 'e',
96
- flag: 'entry-point',
97
- description: 'The entry point that will be compiled'
95
+ shortFlag: "e",
96
+ flag: "entry-point",
97
+ description: "The entry point that will be compiled"
98
98
  }),
99
99
  $kQNfl$taquerianodesdk.Option.create({
100
- shortFlag: 's',
101
- flag: 'syntax',
102
- description: 'The syntax used in the contract'
100
+ shortFlag: "s",
101
+ flag: "syntax",
102
+ description: "The syntax used in the contract"
103
103
  }),
104
104
  $kQNfl$taquerianodesdk.Option.create({
105
- shortFlag: 'i',
106
- flag: 'infer',
107
- description: 'Enable type inference'
108
- }),
105
+ shortFlag: "i",
106
+ flag: "infer",
107
+ description: "Enable type inference"
108
+ })
109
109
  ],
110
110
  handler: 'proxy',
111
111
  encoding: 'json'
112
- }),
112
+ })
113
113
  ],
114
114
  checkRuntimeDependencies: ()=>Promise.resolve({
115
- status: 'success',
115
+ status: "success",
116
116
  report: [
117
117
  {
118
- name: 'LIGO',
119
- path: 'ligo',
120
- version: '>=0.27.0',
121
- kind: 'required',
118
+ name: "LIGO",
119
+ path: "ligo",
120
+ version: ">=0.27.0",
121
+ kind: "required",
122
122
  met: true
123
- },
123
+ }
124
124
  ]
125
125
  })
126
126
  ,
127
127
  installRunTimeDependencies: ()=>Promise.resolve({
128
- status: 'success',
129
- output: 'LIGO was found in /usr/bin/ligo'
128
+ status: "success",
129
+ output: "LIGO was found in /usr/bin/ligo" // TODO this should use i18n
130
130
  })
131
131
  ,
132
132
  proxy: $24b2f47d8f306cb3$export$2e2bcd8739ae039
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;ACAA;;;AAOA,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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AE,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: 'entry-point',\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 { Failure, LikeAPromise, PluginResponse, SanitizedArgs } from '@taqueria/node-sdk/types';\nimport { basename, extname, join } from 'path';\nimport glob = require('fast-glob');\n\ntype Opts = SanitizedArgs & Record<string, unknown>;\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:0.41.0 compile contract ${inputFile}`;\n\t\tconst entryPoint = opts.e ? `-e ${opts.e}` : '';\n\t\tconst syntax = opts['-s'] ? `s ${opts['s']} : \"\"` : '';\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.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 = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\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;;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,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iCAAiC;qBACjD,CAAC;oBACF,6BAAM,CAAC,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;QAAA;QACF,0BAA0B,EAAE,IAAM,OAAO,CAAC,OAAO,CAAC;gBAC9C,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,iCAAiC,CAAC,4BAA4B;aACzE,CAAC;QAAA;QACF,KAAK,EAAE,wCAAO;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: \"entry-point\",\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 {SanitizedArgs, PluginResponse, Failure, LikeAPromise} from \"@taqueria/node-sdk/types\";\nimport {extname, basename, join} from 'path'\nimport glob = require('fast-glob')\n\ntype Opts = SanitizedArgs & Record<string, unknown>\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:0.41.0 compile contract ${inputFile}`\n const entryPoint = opts.e ? `-e ${opts.e}` : \"\"\n const syntax = opts[\"-s\"] ? `s ${opts['s']} : \"\"` : \"\"\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.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 = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\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":"../"}
package/index.ts CHANGED
@@ -1,48 +1,46 @@
1
- import { Option, Plugin, Task } from '@taqueria/node-sdk';
2
- import compile from './compile';
1
+ import {Plugin, Task, Option} from '@taqueria/node-sdk'
2
+ import compile from './compile'
3
3
 
4
4
  Plugin.create(i18n => ({
5
- schema: '1.0',
6
- version: '0.1',
7
- alias: 'ligo',
8
- tasks: [
9
- Task.create({
10
- task: 'compile',
11
- command: 'compile [sourceFile]',
12
- aliases: ['c', 'compile-ligo'],
13
- description: 'Compile a smart contract written in a Ligo syntax to Michelson code',
14
- options: [
15
- Option.create({
16
- shortFlag: 'e',
17
- flag: 'entry-point',
18
- description: 'The entry point that will be compiled',
19
- }),
20
- Option.create({
21
- shortFlag: 's',
22
- flag: 'syntax',
23
- description: 'The syntax used in the contract',
24
- }),
25
- Option.create({
26
- shortFlag: 'i',
27
- flag: 'infer',
28
- description: 'Enable type inference',
29
- }),
30
- ],
31
- handler: 'proxy',
32
- encoding: 'json',
33
- }),
34
- ],
35
- checkRuntimeDependencies: () =>
36
- Promise.resolve({
37
- status: 'success',
38
- report: [
39
- { name: 'LIGO', path: 'ligo', version: '>=0.27.0', kind: 'required', met: true },
40
- ],
41
- }),
42
- installRunTimeDependencies: () =>
43
- Promise.resolve({
44
- status: 'success',
45
- output: 'LIGO was found in /usr/bin/ligo', // TODO this should use i18n
46
- }),
47
- proxy: compile,
48
- }), process.argv);
5
+ schema: "1.0",
6
+ version: "0.1",
7
+ alias: "ligo",
8
+ tasks: [
9
+ Task.create({
10
+ task: "compile",
11
+ command: "compile [sourceFile]",
12
+ aliases: ["c", "compile-ligo"],
13
+ description: "Compile a smart contract written in a Ligo syntax to Michelson code",
14
+ options: [
15
+ Option.create({
16
+ shortFlag: "e",
17
+ flag: "entry-point",
18
+ description: "The entry point that will be compiled"
19
+ }),
20
+ Option.create({
21
+ shortFlag: "s",
22
+ flag: "syntax",
23
+ description: "The syntax used in the contract"
24
+ }),
25
+ Option.create({
26
+ shortFlag: "i",
27
+ flag: "infer",
28
+ description: "Enable type inference"
29
+ })
30
+ ],
31
+ handler: 'proxy',
32
+ encoding: 'json'
33
+ })
34
+ ],
35
+ checkRuntimeDependencies: () => Promise.resolve({
36
+ status: "success",
37
+ report: [
38
+ {name: "LIGO", path: "ligo", version: ">=0.27.0", kind: "required", met: true}
39
+ ]
40
+ }),
41
+ installRunTimeDependencies: () => Promise.resolve({
42
+ status: "success",
43
+ output: "LIGO was found in /usr/bin/ligo" // TODO this should use i18n
44
+ }),
45
+ proxy: compile
46
+ }), process.argv)
package/package.json CHANGED
@@ -1,51 +1,51 @@
1
1
  {
2
- "name": "@taqueria/plugin-ligo",
3
- "version": "0.0.0-pr-695-bec90e45",
4
- "description": "A taqueria plugin for compiling LIGO smart contracts",
5
- "targets": {
6
- "default": {
7
- "source": "./index.ts",
8
- "distDir": "./",
9
- "context": "node",
10
- "isLibrary": true
11
- }
12
- },
13
- "scripts": {
14
- "test": "echo \"Error: no test specified\" && exit 1",
15
- "build": "npx tsc -noEmit && npx parcel build --no-cache 2>&1",
16
- "pluginInfo": "npx ts-node index.ts --taqRun pluginInfo --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\",\"artifactsDir\": \"artifacts\"}' --projectDir ../test-project --configDir ./.taq",
17
- "compile": "npx ts-node index.ts --taqRun proxy --task compile --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\",\"artifactsDir\": \"artifacts\"}' --projectDir ../test-project --configDir ./.taq",
18
- "debugPluginInfo": "npx ts-node --inspect index.ts --taqRun pluginInfo --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\"}' --projectDir ../test-project --configDir ./.taq"
19
- },
20
- "keywords": [
21
- "taqueria",
22
- "tezos",
23
- "build",
24
- "ecad",
25
- "ecadlabs",
26
- "plugin",
27
- "ligo",
28
- "ligolang",
29
- "smart contract",
30
- "compile"
31
- ],
32
- "author": "ECAD Labs",
33
- "license": "Apache-2.0",
34
- "repository": {
35
- "type": "git",
36
- "url": "https://github.com/ecadlabs/taqueria.git",
37
- "directory": "taqueria-plugin-ligo"
38
- },
39
- "bugs": {
40
- "url": "https://github.com/ecadlabs/taqueria/issues"
41
- },
42
- "homepage": "https://github.com/ecadlabs/taqueria#readme",
43
- "dependencies": {
44
- "@taqueria/node-sdk": "^0.3.1",
45
- "fast-glob": "^3.2.7"
46
- },
47
- "devDependencies": {
48
- "parcel": "^2.4.0",
49
- "typescript": "^4.5.4"
50
- }
2
+ "name": "@taqueria/plugin-ligo",
3
+ "version": "0.0.0-pr-740-e1500660",
4
+ "description": "A taqueria plugin for compiling LIGO smart contracts",
5
+ "targets": {
6
+ "default": {
7
+ "source": "./index.ts",
8
+ "distDir": "./",
9
+ "context": "node",
10
+ "isLibrary": true
11
+ }
12
+ },
13
+ "scripts": {
14
+ "test": "echo \"Error: no test specified\" && exit 1",
15
+ "build": "npx tsc -noEmit && npx parcel build --no-cache 2>&1",
16
+ "pluginInfo": "npx ts-node index.ts --taqRun pluginInfo --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\",\"artifactsDir\": \"artifacts\"}' --projectDir ../test-project --configDir ./.taq",
17
+ "compile": "npx ts-node index.ts --taqRun proxy --task compile --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\",\"artifactsDir\": \"artifacts\"}' --projectDir ../test-project --configDir ./.taq",
18
+ "debugPluginInfo": "npx ts-node --inspect index.ts --taqRun pluginInfo --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\"}' --projectDir ../test-project --configDir ./.taq"
19
+ },
20
+ "keywords": [
21
+ "taqueria",
22
+ "tezos",
23
+ "build",
24
+ "ecad",
25
+ "ecadlabs",
26
+ "plugin",
27
+ "ligo",
28
+ "ligolang",
29
+ "smart contract",
30
+ "compile"
31
+ ],
32
+ "author": "ECAD Labs",
33
+ "license": "Apache-2.0",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/ecadlabs/taqueria.git",
37
+ "directory": "taqueria-plugin-ligo"
38
+ },
39
+ "bugs": {
40
+ "url": "https://github.com/ecadlabs/taqueria/issues"
41
+ },
42
+ "homepage": "https://github.com/ecadlabs/taqueria#readme",
43
+ "dependencies": {
44
+ "@taqueria/node-sdk": "^0.3.1",
45
+ "fast-glob": "^3.2.7"
46
+ },
47
+ "devDependencies": {
48
+ "parcel": "^2.4.0",
49
+ "typescript": "^4.5.4"
50
+ }
51
51
  }
package/tsconfig.json CHANGED
@@ -1,101 +1,101 @@
1
1
  {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
4
 
5
- /* Projects */
6
- // "incremental": true, /* Enable incremental compilation */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
5
+ /* Projects */
6
+ // "incremental": true, /* Enable incremental compilation */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
12
 
13
- /* Language and Environment */
14
- "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- // "jsx": "preserve", /* Specify what JSX code is generated. */
17
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
20
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
22
- // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
23
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
13
+ /* Language and Environment */
14
+ "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
22
+ // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
25
 
26
- /* Modules */
27
- "module": "CommonJS", /* Specify what module code is generated. */
28
- // "rootDir": "./", /* Specify the root folder within your source files. */
29
- // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
30
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
31
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
32
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33
- // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
34
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
35
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36
- // "resolveJsonModule": true, /* Enable importing .json files */
37
- // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
26
+ /* Modules */
27
+ "module": "CommonJS", /* Specify what module code is generated. */
28
+ // "rootDir": "./", /* Specify the root folder within your source files. */
29
+ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
30
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
31
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
32
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33
+ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
34
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
35
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36
+ // "resolveJsonModule": true, /* Enable importing .json files */
37
+ // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
38
38
 
39
- /* JavaScript Support */
40
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
41
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
42
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
39
+ /* JavaScript Support */
40
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
41
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
42
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
43
43
 
44
- /* Emit */
45
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
46
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
47
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
48
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
49
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
50
- // "outDir": "./", /* Specify an output folder for all emitted files. */
51
- // "removeComments": true, /* Disable emitting comments. */
52
- // "noEmit": true, /* Disable emitting files from a compilation. */
53
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
54
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
55
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
56
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
57
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
59
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
60
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
61
- // "newLine": "crlf", /* Set the newline character for emitting files. */
62
- // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
63
- // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
64
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
65
- // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
66
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
67
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
44
+ /* Emit */
45
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
46
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
47
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
48
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
49
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
50
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
51
+ // "removeComments": true, /* Disable emitting comments. */
52
+ // "noEmit": true, /* Disable emitting files from a compilation. */
53
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
54
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
55
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
56
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
57
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
59
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
60
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
61
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
62
+ // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
63
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
64
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
65
+ // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
66
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
67
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
68
68
 
69
- /* Interop Constraints */
70
- "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
71
- "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
72
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
73
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
74
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
69
+ /* Interop Constraints */
70
+ "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
71
+ "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
72
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
73
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
74
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
75
75
 
76
- /* Type Checking */
77
- "strict": true, /* Enable all strict type-checking options. */
78
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
79
- // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
80
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
81
- // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
82
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
83
- // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
84
- // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
85
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
86
- // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
87
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
88
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
89
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
90
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
91
- // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
92
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
93
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
94
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
95
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
76
+ /* Type Checking */
77
+ "strict": true, /* Enable all strict type-checking options. */
78
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
79
+ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
80
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
81
+ // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
82
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
83
+ // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
84
+ // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
85
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
86
+ // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
87
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
88
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
89
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
90
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
91
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
92
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
93
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
94
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
95
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
96
96
 
97
- /* Completeness */
98
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
99
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
100
- }
97
+ /* Completeness */
98
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
99
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
100
+ }
101
101
  }