@taqueria/plugin-archetype 0.3.0 → 0.4.0-rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,30 +1,55 @@
1
- # Taqueria Archetype Plugin
1
+ # Archetype Plugin
2
2
 
3
3
  This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK and distributed via NPM
4
4
 
5
- The Archetype plugin exposes a compile task in Taqueria which can target one, or all the Archetype contracts in the contracts folder and compile them to Michelson code output to the artifacts folder
6
-
7
- ## Tasks
8
-
9
- The Archetype plugin provides the following tasks to Taqueria:
10
- - `compile`
5
+ The Archetype plugin provides a task to compile Archetype smart contracts (`.arl`) to Michelson `.tz` files
11
6
 
12
7
  ## Requirements
13
8
 
14
- - Taqueria v0.0.6 or later
15
9
  - Node.js v16 or later
10
+ - Docker v0.8.2 or later
16
11
 
17
12
  ## Installation
18
13
 
19
- The Archetype plugin is distributed as an NPM package that can be installed and uninstalled on a project from the Taqueria CLI
20
-
21
14
  To install the Archetype plugin on a Taqueria project, navigate to the project folder and run:
22
15
  ```shell
23
16
  taq install @taqueria/plugin-archetype
24
17
  ```
25
18
 
19
+ > ### :page_with_curl: Note
20
+ > At this time, all Taqueria projects must also be initialized as node projects by running `npm init -y` from the root of your project directory
21
+
22
+ ## Configuration
23
+
24
+ No additional configuration is available
25
+
26
+ ## Usage
27
+
28
+ The Archetype plugin exposes a `compile` task in Taqueria which can target one, or all the Archetype contracts in the `contracts` folder and compile them to Michelson `.tz` files output to the `artifacts` folder
29
+
30
+ ### Running the Compile Task
31
+
32
+ The Archetype plugin's `taq compile` task can be run with or without arguments. The basic syntax for the task is `taq compile <file-name>`
33
+
34
+ Running the `compile` task with no options will result in all source Archetype smart contracts in the `contracts` folder being compiled to Michelson files in the `artifacts` folder. If you speficy an optional filename, only Archetype contracts matching the specified filename in the `contracts` folder will be compiled
35
+
36
+ > ### :warning: CAUTION
37
+ > The `compile` task can be implemented by more than one compiler plugin installed on a project (Archetype, LIGO, SmartPY). If this is the case, you must use the `--plugin Archetype` flag to specify a particular compiler. For example `taq compile --plugin archetype`
38
+
39
+ ### Options
40
+
41
+ There are no additional options available for this plugin
42
+
26
43
  ## Plugin Architecture
27
44
 
28
- This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK and distributed via NPM
45
+ This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK
46
+
47
+ Docker is used under the hood to provide a self contained environment for Archetype to prevent the need for it to be installed on the user's local machine
48
+
49
+ The plugin provides a single task `compile`, used for compiling Archetype smart contracts to Michelson:
29
50
 
30
- For detailed usage and configuration information, view the Archetype plugin documentation on the Taqueria website [here](https://taqueria.io/docs/plugins/plugin-archetype)
51
+ | attribute | value |
52
+ |------------|:-----------------------------:|
53
+ | task | 'compile' |
54
+ | command | 'compile [sourceFile] |
55
+ | aliases | ['c', 'compile-archetype'] |
package/_readme.eta ADDED
@@ -0,0 +1,59 @@
1
+ <% if (it.output == "github") { %>
2
+ # Archetype Plugin
3
+ <% } %>
4
+
5
+ This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK and distributed via NPM
6
+
7
+ The Archetype plugin provides a task to compile Archetype smart contracts (`.arl`) to Michelson `.tz` files
8
+
9
+ ## Requirements
10
+
11
+ - Node.js v16 or later
12
+ - Docker v0.8.2 or later
13
+
14
+ ## Installation
15
+
16
+ To install the Archetype plugin on a Taqueria project, navigate to the project folder and run:
17
+ ```shell
18
+ taq install @taqueria/plugin-archetype
19
+ ```
20
+
21
+ <%~ it.noteOpenAdmonition %>
22
+ At this time, all Taqueria projects must also be initialized as node projects by running `npm init -y` from the root of your project directory
23
+ <%~ it.closeAdmonition %>
24
+
25
+ ## Configuration
26
+
27
+ No additional configuration is available
28
+
29
+ ## Usage
30
+
31
+ The Archetype plugin exposes a `compile` task in Taqueria which can target one, or all the Archetype contracts in the `contracts` folder and compile them to Michelson `.tz` files output to the `artifacts` folder
32
+
33
+ ### Running the Compile Task
34
+
35
+ The Archetype plugin's `taq compile` task can be run with or without arguments. The basic syntax for the task is `taq compile <file-name>`
36
+
37
+ Running the `compile` task with no options will result in all source Archetype smart contracts in the `contracts` folder being compiled to Michelson files in the `artifacts` folder. If you speficy an optional filename, only Archetype contracts matching the specified filename in the `contracts` folder will be compiled
38
+
39
+ <%~ it.cautionOpenAdmonition %>
40
+ The `compile` task can be implemented by more than one compiler plugin installed on a project (Archetype, LIGO, SmartPY). If this is the case, you must use the `--plugin Archetype` flag to specify a particular compiler. For example `taq compile --plugin archetype`
41
+ <%~ it.closeAdmonition %>
42
+
43
+ ### Options
44
+
45
+ There are no additional options available for this plugin
46
+
47
+ ## Plugin Architecture
48
+
49
+ This is a plugin developed for Taqueria built on NodeJS using the Taqueria Node SDK
50
+
51
+ Docker is used under the hood to provide a self contained environment for Archetype to prevent the need for it to be installed on the user's local machine
52
+
53
+ The plugin provides a single task `compile`, used for compiling Archetype smart contracts to Michelson:
54
+
55
+ | attribute | value |
56
+ |------------|:-----------------------------:|
57
+ | task | 'compile' |
58
+ | command | 'compile [sourceFile] |
59
+ | aliases | ['c', 'compile-archetype'] |
package/compile.ts CHANGED
@@ -1,77 +1,84 @@
1
- import {execCmd, sendErr, sendJsonRes, sendAsyncErr} from "@taqueria/node-sdk"
2
- import { Failure, LikeAPromise, ParsedArgs, PluginResponse, SanitizedArgs } from "@taqueria/node-sdk/types";
3
- import glob from 'fast-glob'
4
- import { extname, join, basename } from 'path'
5
- import { readFile } from 'fs/promises'
1
+ import { execCmd, sendAsyncErr, sendErr, sendJsonRes } from '@taqueria/node-sdk';
2
+ import { LikeAPromise, PluginResponse, RequestArgs, TaqError } from '@taqueria/node-sdk/types';
3
+ import glob from 'fast-glob';
4
+ import { readFile } from 'fs/promises';
5
+ import { basename, extname, join } from 'path';
6
6
 
7
- type Opts = SanitizedArgs & {sourceFile: string}
8
-
9
- const getInputFilename = (opts: Opts) => (sourceFile: string) => {
10
- const inputFile = basename(sourceFile, extname(sourceFile))
11
- return join(opts.config.contractsDir, `${inputFile}.arl`)
7
+ interface Opts extends RequestArgs.t {
8
+ sourceFile?: string;
12
9
  }
13
10
 
14
- const getContractArtifactFilename = (opts: Opts) => (sourceFile: string) => {
15
- const outFile = basename(sourceFile, extname(sourceFile))
16
- return join(opts.config.artifactsDir, `${outFile}.tz`)
17
- }
11
+ const getInputFilename = (opts: Opts) =>
12
+ (sourceFile: string) => {
13
+ const inputFile = basename(sourceFile, extname(sourceFile));
14
+ return join(opts.config.contractsDir, `${inputFile}.arl`);
15
+ };
18
16
 
19
- const getCompileCommand = (opts: Opts) => (sourceFile: string) => {
20
- const { projectDir } = opts
21
- const inputFile = getInputFilename(opts)(sourceFile)
22
- const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project completium/archetype:1.2.12 ${inputFile}`
23
- const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`
24
- const cmd = `${baseCommand} ${outFile}`
25
- return cmd
26
- }
17
+ const getContractArtifactFilename = (opts: Opts) =>
18
+ (sourceFile: string) => {
19
+ const outFile = basename(sourceFile, extname(sourceFile));
20
+ return join(opts.config.artifactsDir, `${outFile}.tz`);
21
+ };
27
22
 
28
- const compileContract = (opts: Opts) => (sourceFile: string): Promise<{ contract: string, artifact: string }> =>
29
- // const sourceAbspath = join(opts.contractsDir, sourceFile)
30
- execCmd(getCompileCommand(opts)(sourceFile))
31
- .then(({stderr}) => { // How should we output warnings?
32
- if (stderr.length > 0) sendErr(stderr)
33
- return {
34
- contract: sourceFile,
35
- artifact: getContractArtifactFilename(opts) (sourceFile)
36
- }
37
- })
38
- .catch(err => {
39
- sendErr(" ")
40
- sendErr(err.message.split("\n").slice(1).join("\n"))
41
- return Promise.resolve({
42
- contract: sourceFile,
43
- artifact: "Not compiled"
44
- })
45
- })
23
+ const getCompileCommand = (opts: Opts) =>
24
+ (sourceFile: string) => {
25
+ const { projectDir } = opts;
26
+ const inputFile = getInputFilename(opts)(sourceFile);
27
+ const baseCommand =
28
+ `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \"${projectDir}\":/project -w /project completium/archetype:1.2.12 ${inputFile}`;
29
+ const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;
30
+ const cmd = `${baseCommand} ${outFile}`;
31
+ return cmd;
32
+ };
46
33
 
47
- const compileAll = (opts: Opts): Promise<{ contract: string, artifact: string }[]> => {
48
- // TODO: Fetch list of files from SDK
49
- return glob(
50
- ['**/*.arl'],
51
- { cwd: opts.contractsDir, absolute: false }
52
- )
53
- .then(entries => entries.map(compileContract(opts)))
54
- .then(processes => processes.length > 0
55
- ? processes
56
- : [{contract: "None found", artifact: "N/A"}]
57
- )
58
- .then(promises => Promise.all(promises))
59
- }
34
+ const compileContract = (opts: Opts) =>
35
+ (sourceFile: string): Promise<{ contract: string; artifact: string }> =>
36
+ // const sourceAbspath = join(opts.contractsDir, sourceFile)
37
+ execCmd(getCompileCommand(opts)(sourceFile))
38
+ .then(({ stderr }) => { // How should we output warnings?
39
+ if (stderr.length > 0) sendErr(stderr);
40
+ return {
41
+ contract: sourceFile,
42
+ artifact: getContractArtifactFilename(opts)(sourceFile),
43
+ };
44
+ })
45
+ .catch(err => {
46
+ sendErr(' ');
47
+ sendErr(err.message.split('\n').slice(1).join('\n'));
48
+ return Promise.resolve({
49
+ contract: sourceFile,
50
+ artifact: 'Not compiled',
51
+ });
52
+ });
60
53
 
61
- const compile = <T>(parsedArgs: SanitizedArgs): LikeAPromise<PluginResponse, Failure<T>> => {
62
- const params = parsedArgs as Opts
63
- const p = parsedArgs.sourceFile
64
- ? compileContract(params) (params.sourceFile)
65
- .then(result => [result])
66
- : compileAll(params)
67
- .then(results => {
68
- if (results.length === 0) sendErr("No contracts found to compile.")
69
- return results
70
- })
71
-
72
- return p
73
- .then(sendJsonRes)
74
- .catch(err => sendAsyncErr(err, false))
75
- }
54
+ const compileAll = (opts: Opts): Promise<{ contract: string; artifact: string }[]> => {
55
+ // TODO: Fetch list of files from SDK
56
+ return glob(
57
+ ['**/*.arl'],
58
+ { cwd: opts.config.contractsDir, absolute: false },
59
+ )
60
+ .then(entries => entries.map(compileContract(opts)))
61
+ .then(processes =>
62
+ processes.length > 0
63
+ ? processes
64
+ : [{ contract: 'None found', artifact: 'N/A' }]
65
+ )
66
+ .then(promises => Promise.all(promises));
67
+ };
68
+
69
+ const compile = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, TaqError.t> => {
70
+ const p = parsedArgs.sourceFile
71
+ ? compileContract(parsedArgs)(parsedArgs.sourceFile)
72
+ .then(result => [result])
73
+ : compileAll(parsedArgs)
74
+ .then(results => {
75
+ if (results.length === 0) sendErr('No contracts found to compile.');
76
+ return results;
77
+ });
78
+
79
+ return p
80
+ .then(sendJsonRes)
81
+ .catch(err => sendAsyncErr(err, false));
82
+ };
76
83
 
77
- export default compile
84
+ export default compile;
package/index.js CHANGED
@@ -10,15 +10,13 @@ function $parcel$interopDefault(a) {
10
10
 
11
11
 
12
12
  const $bb055a91efa18df7$var$getInputFilename = (opts)=>(sourceFile)=>{
13
- const inputFile = $dTHpf$path.basename(sourceFile, $dTHpf$path.extname(sourceFile));
14
- return $dTHpf$path.join(opts.config.contractsDir, `${inputFile}.arl`);
15
- }
16
- ;
13
+ const inputFile = (0, $dTHpf$path.basename)(sourceFile, (0, $dTHpf$path.extname)(sourceFile));
14
+ return (0, $dTHpf$path.join)(opts.config.contractsDir, `${inputFile}.arl`);
15
+ };
17
16
  const $bb055a91efa18df7$var$getContractArtifactFilename = (opts)=>(sourceFile)=>{
18
- const outFile = $dTHpf$path.basename(sourceFile, $dTHpf$path.extname(sourceFile));
19
- return $dTHpf$path.join(opts.config.artifactsDir, `${outFile}.tz`);
20
- }
21
- ;
17
+ const outFile = (0, $dTHpf$path.basename)(sourceFile, (0, $dTHpf$path.extname)(sourceFile));
18
+ return (0, $dTHpf$path.join)(opts.config.artifactsDir, `${outFile}.tz`);
19
+ };
22
20
  const $bb055a91efa18df7$var$getCompileCommand = (opts)=>(sourceFile)=>{
23
21
  const { projectDir: projectDir } = opts;
24
22
  const inputFile = $bb055a91efa18df7$var$getInputFilename(opts)(sourceFile);
@@ -26,62 +24,54 @@ const $bb055a91efa18df7$var$getCompileCommand = (opts)=>(sourceFile)=>{
26
24
  const outFile = `-o ${$bb055a91efa18df7$var$getContractArtifactFilename(opts)(sourceFile)}`;
27
25
  const cmd = `${baseCommand} ${outFile}`;
28
26
  return cmd;
29
- }
30
- ;
27
+ };
31
28
  const $bb055a91efa18df7$var$compileContract = (opts)=>(sourceFile)=>// const sourceAbspath = join(opts.contractsDir, sourceFile)
32
- $dTHpf$taquerianodesdk.execCmd($bb055a91efa18df7$var$getCompileCommand(opts)(sourceFile)).then(({ stderr: stderr })=>{
33
- if (stderr.length > 0) $dTHpf$taquerianodesdk.sendErr(stderr);
29
+ (0, $dTHpf$taquerianodesdk.execCmd)($bb055a91efa18df7$var$getCompileCommand(opts)(sourceFile)).then(({ stderr: stderr })=>{
30
+ if (stderr.length > 0) (0, $dTHpf$taquerianodesdk.sendErr)(stderr);
34
31
  return {
35
32
  contract: sourceFile,
36
33
  artifact: $bb055a91efa18df7$var$getContractArtifactFilename(opts)(sourceFile)
37
34
  };
38
35
  }).catch((err)=>{
39
- $dTHpf$taquerianodesdk.sendErr(" ");
40
- $dTHpf$taquerianodesdk.sendErr(err.message.split("\n").slice(1).join("\n"));
36
+ (0, $dTHpf$taquerianodesdk.sendErr)(" ");
37
+ (0, $dTHpf$taquerianodesdk.sendErr)(err.message.split("\n").slice(1).join("\n"));
41
38
  return Promise.resolve({
42
39
  contract: sourceFile,
43
40
  artifact: "Not compiled"
44
41
  });
45
- })
46
- ;
42
+ });
47
43
  const $bb055a91efa18df7$var$compileAll = (opts)=>{
48
44
  // TODO: Fetch list of files from SDK
49
- return ($parcel$interopDefault($dTHpf$fastglob))([
50
- '**/*.arl'
45
+ return (0, ($parcel$interopDefault($dTHpf$fastglob)))([
46
+ "**/*.arl"
51
47
  ], {
52
- cwd: opts.contractsDir,
48
+ cwd: opts.config.contractsDir,
53
49
  absolute: false
54
- }).then((entries)=>entries.map($bb055a91efa18df7$var$compileContract(opts))
55
- ).then((processes)=>processes.length > 0 ? processes : [
50
+ }).then((entries)=>entries.map($bb055a91efa18df7$var$compileContract(opts))).then((processes)=>processes.length > 0 ? processes : [
56
51
  {
57
52
  contract: "None found",
58
53
  artifact: "N/A"
59
54
  }
60
- ]
61
- ).then((promises)=>Promise.all(promises)
62
- );
55
+ ]).then((promises)=>Promise.all(promises));
63
56
  };
64
57
  const $bb055a91efa18df7$var$compile = (parsedArgs)=>{
65
- const params = parsedArgs;
66
- const p = parsedArgs.sourceFile ? $bb055a91efa18df7$var$compileContract(params)(params.sourceFile).then((result)=>[
58
+ const p = parsedArgs.sourceFile ? $bb055a91efa18df7$var$compileContract(parsedArgs)(parsedArgs.sourceFile).then((result)=>[
67
59
  result
68
- ]
69
- ) : $bb055a91efa18df7$var$compileAll(params).then((results)=>{
70
- if (results.length === 0) $dTHpf$taquerianodesdk.sendErr("No contracts found to compile.");
60
+ ]) : $bb055a91efa18df7$var$compileAll(parsedArgs).then((results)=>{
61
+ if (results.length === 0) (0, $dTHpf$taquerianodesdk.sendErr)("No contracts found to compile.");
71
62
  return results;
72
63
  });
73
- return p.then($dTHpf$taquerianodesdk.sendJsonRes).catch((err)=>$dTHpf$taquerianodesdk.sendAsyncErr(err, false)
74
- );
64
+ return p.then((0, $dTHpf$taquerianodesdk.sendJsonRes)).catch((err)=>(0, $dTHpf$taquerianodesdk.sendAsyncErr)(err, false));
75
65
  };
76
66
  var $bb055a91efa18df7$export$2e2bcd8739ae039 = $bb055a91efa18df7$var$compile;
77
67
 
78
68
 
79
- $dTHpf$taquerianodesdk.Plugin.create((i18n)=>({
69
+ (0, $dTHpf$taquerianodesdk.Plugin).create((i18n)=>({
80
70
  schema: "1.0",
81
71
  version: "0.1",
82
72
  alias: "archetype",
83
73
  tasks: [
84
- $dTHpf$taquerianodesdk.Task.create({
74
+ (0, $dTHpf$taquerianodesdk.Task).create({
85
75
  task: "compile",
86
76
  command: "compile [sourceFile]",
87
77
  aliases: [
@@ -92,7 +82,7 @@ $dTHpf$taquerianodesdk.Plugin.create((i18n)=>({
92
82
  options: [],
93
83
  handler: "proxy",
94
84
  encoding: "json"
95
- })
85
+ }),
96
86
  ],
97
87
  checkRuntimeDependencies: ()=>Promise.resolve({
98
88
  status: "success",
@@ -103,18 +93,15 @@ $dTHpf$taquerianodesdk.Plugin.create((i18n)=>({
103
93
  version: ">=1.2.12",
104
94
  kind: "required",
105
95
  met: true
106
- }
96
+ },
107
97
  ]
108
- })
109
- ,
98
+ }),
110
99
  installRunTimeDependencies: ()=>Promise.resolve({
111
100
  status: "success",
112
- output: "Archetype was found in /usr/bin/archetype" // TODO this should use i18n
113
- })
114
- ,
115
- proxy: $bb055a91efa18df7$export$2e2bcd8739ae039
116
- })
117
- , process.argv);
101
+ output: "Archetype was found in /usr/bin/archetype"
102
+ }),
103
+ proxy: (0, $bb055a91efa18df7$export$2e2bcd8739ae039)
104
+ }), process.argv);
118
105
 
119
106
 
120
107
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;ACAA;;;AAQA,MAAM,sCAAgB,GAAG,CAAC,IAAU,GAAK,CAAC,UAAkB,GAAK;QAC/D,MAAM,SAAS,GAAG,oBAAQ,CAAC,UAAU,EAAE,mBAAO,CAAC,UAAU,CAAC,CAAC;QAC3D,OAAO,gBAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;KAC1D;AAAA;AAED,MAAM,iDAA2B,GAAG,CAAC,IAAU,GAAK,CAAC,UAAkB,GAAK;QAC1E,MAAM,OAAO,GAAG,oBAAQ,CAAC,UAAU,EAAE,mBAAO,CAAC,UAAU,CAAC,CAAC;QACzD,OAAO,gBAAI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AAP,6BAAO;;;ADzEtB,6BAAM,CAAC,MAAM,CAAC,CAAA,IAAI,GAAK,CAAA;QACnB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE;YACH,2BAAI,CAAC,MAAM,CAAC;gBACR,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,sBAAsB;gBAC/B,OAAO,EAAE;oBAAC,GAAG;oBAAE,mBAAmB;iBAAC;gBACnC,WAAW,EAAE,0EAA0E;gBACvF,OAAO,EAAE,EAAE;gBACX,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,WAAW;wBAAE,IAAI,EAAE,WAAW;wBAAE,OAAO,EAAE,UAAU;wBAAE,IAAI,EAAE,UAAU;wBAAE,GAAG,EAAE,IAAI;qBAAC;iBAC3F;aACJ,CAAC;QAAA;QACF,0BAA0B,EAAE,IAAM,OAAO,CAAC,OAAO,CAAC;gBAC9C,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,2CAA2C,CAAC,4BAA4B;aACnF,CAAC;QAAA;QACF,KAAK,EAAE,wCAAO;KACjB,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC","sources":["taqueria-plugin-archetype/index.ts","taqueria-plugin-archetype/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: \"archetype\",\n tasks: [\n Task.create({\n task: \"compile\",\n command: \"compile [sourceFile]\",\n aliases: [\"c\", \"compile-archetype\"],\n description: \"Compile a smart contract written in a Archetype syntax to Michelson code\",\n options: [],\n handler: \"proxy\",\n encoding: \"json\"\n })\n ],\n checkRuntimeDependencies: () => Promise.resolve({\n status: \"success\",\n report: [\n {name: \"Archetype\", path: \"archetype\", version: \">=1.2.12\", kind: \"required\", met: true}\n ]\n }),\n installRunTimeDependencies: () => Promise.resolve({\n status: \"success\",\n output: \"Archetype was found in /usr/bin/archetype\" // TODO this should use i18n\n }),\n proxy: compile\n}), process.argv)","import {execCmd, sendErr, sendJsonRes, sendAsyncErr} from \"@taqueria/node-sdk\"\nimport { Failure, LikeAPromise, ParsedArgs, PluginResponse, SanitizedArgs } from \"@taqueria/node-sdk/types\";\nimport glob from 'fast-glob'\nimport { extname, join, basename } from 'path'\nimport { readFile } from 'fs/promises'\n\ntype Opts = SanitizedArgs & {sourceFile: string}\n\nconst getInputFilename = (opts: Opts) => (sourceFile: string) => {\n const inputFile = basename(sourceFile, extname(sourceFile))\n return join(opts.config.contractsDir, `${inputFile}.arl`)\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 getCompileCommand = (opts: Opts) => (sourceFile: string) => {\n const { projectDir } = opts\n const inputFile = getInputFilename(opts)(sourceFile)\n const baseCommand = `DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -v \\\"${projectDir}\\\":/project -w /project completium/archetype:1.2.12 ${inputFile}`\n const outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`\n const cmd = `${baseCommand} ${outFile}`\n return cmd\n}\n\nconst compileContract = (opts: Opts) => (sourceFile: string): Promise<{ contract: string, artifact: string }> =>\n // const sourceAbspath = join(opts.contractsDir, sourceFile)\n execCmd(getCompileCommand(opts)(sourceFile))\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 = (opts: Opts): Promise<{ contract: string, artifact: string }[]> => {\n // TODO: Fetch list of files from SDK\n return glob(\n ['**/*.arl'],\n { cwd: opts.contractsDir, absolute: false }\n )\n .then(entries => entries.map(compileContract(opts)))\n .then(processes => processes.length > 0\n ? processes\n : [{contract: \"None found\", artifact: \"N/A\"}]\n )\n .then(promises => Promise.all(promises))\n}\n\nconst compile = <T>(parsedArgs: SanitizedArgs): LikeAPromise<PluginResponse, Failure<T>> => {\n const params = parsedArgs as Opts\n const p = parsedArgs.sourceFile\n ? compileContract(params) (params.sourceFile)\n .then(result => [result])\n : compileAll(params)\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":"../"}
1
+ {"mappings":";;;;;;;AAAA;ACAA;;;AAUA,MAAM,sCAAgB,GAAG,CAAC,IAAU,GACnC,CAAC,UAAkB,GAAK;QACvB,MAAM,SAAS,GAAG,CAAA,GAAA,oBAAQ,CAAA,CAAC,UAAU,EAAE,CAAA,GAAA,mBAAO,CAAA,CAAC,UAAU,CAAC,CAAC,AAAC;QAC5D,OAAO,CAAA,GAAA,gBAAI,CAAA,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;KAC1D,AAAC;AAEH,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,G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A,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;CACzC,AAAC;IAEF,wCAAuB,GAAR,6BAAO;;;ADhFtB,CAAA,GAAA,6BAAM,CAAA,CAAC,MAAM,CAAC,CAAA,IAAI,GAAK,CAAA;QACtB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE;YACN,CAAA,GAAA,2BAAI,CAAA,CAAC,MAAM,CAAC;gBACX,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,sBAAsB;gBAC/B,OAAO,EAAE;oBAAC,GAAG;oBAAE,mBAAmB;iBAAC;gBACnC,WAAW,EAAE,0EAA0E;gBACvF,OAAO,EAAE,EAAE;gBACX,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,WAAW;wBAAE,IAAI,EAAE,WAAW;wBAAE,OAAO,EAAE,UAAU;wBAAE,IAAI,EAAE,UAAU;wBAAE,GAAG,EAAE,IAAI;qBAAE;iBAC1F;aACD,CAAC;QACH,0BAA0B,EAAE,IAC3B,OAAO,CAAC,OAAO,CAAC;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,2CAA2C;aACnD,CAAC;QACH,KAAK,EAAE,CAAA,GAAA,wCAAO,CAAA;KACd,CAAA,AAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC","sources":["taqueria-plugin-archetype/index.ts","taqueria-plugin-archetype/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: 'archetype',\n\ttasks: [\n\t\tTask.create({\n\t\t\ttask: 'compile',\n\t\t\tcommand: 'compile [sourceFile]',\n\t\t\taliases: ['c', 'compile-archetype'],\n\t\t\tdescription: 'Compile a smart contract written in a Archetype syntax to Michelson code',\n\t\t\toptions: [],\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: 'Archetype', path: 'archetype', version: '>=1.2.12', 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: 'Archetype was found in /usr/bin/archetype', // TODO this should use i18n\n\t\t}),\n\tproxy: compile,\n}), process.argv);\n","import { execCmd, sendAsyncErr, sendErr, sendJsonRes } from '@taqueria/node-sdk';\nimport { LikeAPromise, PluginResponse, RequestArgs, TaqError } from '@taqueria/node-sdk/types';\nimport glob from 'fast-glob';\nimport { readFile } from 'fs/promises';\nimport { basename, extname, join } from 'path';\n\ninterface Opts extends RequestArgs.t {\n\tsourceFile?: string;\n}\n\nconst getInputFilename = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst inputFile = basename(sourceFile, extname(sourceFile));\n\t\treturn join(opts.config.contractsDir, `${inputFile}.arl`);\n\t};\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 getCompileCommand = (opts: Opts) =>\n\t(sourceFile: string) => {\n\t\tconst { projectDir } = opts;\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 completium/archetype:1.2.12 ${inputFile}`;\n\t\tconst outFile = `-o ${getContractArtifactFilename(opts)(sourceFile)}`;\n\t\tconst cmd = `${baseCommand} ${outFile}`;\n\t\treturn cmd;\n\t};\n\nconst compileContract = (opts: Opts) =>\n\t(sourceFile: string): Promise<{ contract: string; artifact: string }> =>\n\t\t// const sourceAbspath = join(opts.contractsDir, sourceFile)\n\t\texecCmd(getCompileCommand(opts)(sourceFile))\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 = (opts: Opts): Promise<{ contract: string; artifact: string }[]> => {\n\t// TODO: Fetch list of files from SDK\n\treturn glob(\n\t\t['**/*.arl'],\n\t\t{ cwd: opts.config.contractsDir, absolute: false },\n\t)\n\t\t.then(entries => entries.map(compileContract(opts)))\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\nconst compile = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, TaqError.t> => {\n\tconst p = parsedArgs.sourceFile\n\t\t? compileContract(parsedArgs)(parsedArgs.sourceFile)\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/index.ts CHANGED
@@ -1,30 +1,32 @@
1
- import {Plugin, Task, Option} from '@taqueria/node-sdk'
2
- import compile from './compile'
1
+ import { Option, Plugin, Task } 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: "archetype",
8
- tasks: [
9
- Task.create({
10
- task: "compile",
11
- command: "compile [sourceFile]",
12
- aliases: ["c", "compile-archetype"],
13
- description: "Compile a smart contract written in a Archetype syntax to Michelson code",
14
- options: [],
15
- handler: "proxy",
16
- encoding: "json"
17
- })
18
- ],
19
- checkRuntimeDependencies: () => Promise.resolve({
20
- status: "success",
21
- report: [
22
- {name: "Archetype", path: "archetype", version: ">=1.2.12", kind: "required", met: true}
23
- ]
24
- }),
25
- installRunTimeDependencies: () => Promise.resolve({
26
- status: "success",
27
- output: "Archetype was found in /usr/bin/archetype" // TODO this should use i18n
28
- }),
29
- proxy: compile
30
- }), process.argv)
5
+ schema: '1.0',
6
+ version: '0.1',
7
+ alias: 'archetype',
8
+ tasks: [
9
+ Task.create({
10
+ task: 'compile',
11
+ command: 'compile [sourceFile]',
12
+ aliases: ['c', 'compile-archetype'],
13
+ description: 'Compile a smart contract written in a Archetype syntax to Michelson code',
14
+ options: [],
15
+ handler: 'proxy',
16
+ encoding: 'json',
17
+ }),
18
+ ],
19
+ checkRuntimeDependencies: () =>
20
+ Promise.resolve({
21
+ status: 'success',
22
+ report: [
23
+ { name: 'Archetype', path: 'archetype', version: '>=1.2.12', kind: 'required', met: true },
24
+ ],
25
+ }),
26
+ installRunTimeDependencies: () =>
27
+ Promise.resolve({
28
+ status: 'success',
29
+ output: 'Archetype was found in /usr/bin/archetype', // TODO this should use i18n
30
+ }),
31
+ proxy: compile,
32
+ }), process.argv);
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
1
  {
2
- "name": "@taqueria/plugin-archetype",
3
- "version": "0.3.0",
4
- "description": "A taqueria plugin for compiling Archetype 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 parcel build --no-cache 2>&1",
16
- "pluginInfo": "npx ts-node index.ts --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}",
17
- "compile": "node index.js --taqRun proxy --task compile --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\",\"artifactsDir\": \"artifacts\"}' --projectDir ../test-project --configDir ./.taq",
18
- "debugPluginInfo": "node --inspect index.js --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
- "archetype",
28
- "smart contract",
29
- "compile"
30
- ],
31
- "author": "ECAD Labs",
32
- "license": "Apache-2.0",
33
- "repository": {
34
- "type": "git",
35
- "url": "https://github.com/ecadlabs/taqueria.git",
36
- "directory": "taqueria-plugin-archetype"
37
- },
38
- "bugs": {
39
- "url": "https://github.com/ecadlabs/taqueria/issues"
40
- },
41
- "homepage": "https://github.com/ecadlabs/taqueria#readme",
42
- "dependencies": {
43
- "@taqueria/node-sdk": "^0.3.0",
44
- "fast-glob": "^3.2.7"
45
- },
46
- "devDependencies": {
47
- "parcel": "^2.4.0",
48
- "typescript": "4.5.4"
49
- }
2
+ "name": "@taqueria/plugin-archetype",
3
+ "version": "0.4.0-rc2",
4
+ "description": "A taqueria plugin for compiling Archetype 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\"}",
17
+ "compile": "node index.js --taqRun proxy --task compile --i18n '{\"foo\":\"bar\"}' --config '{\"contractsDir\":\"contracts\",\"testsDir\": \"tests\",\"artifactsDir\": \"artifacts\"}' --projectDir ../test-project --configDir ./.taq",
18
+ "debugPluginInfo": "node --inspect index.js --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
+ "archetype",
28
+ "smart contract",
29
+ "compile"
30
+ ],
31
+ "author": "ECAD Labs",
32
+ "license": "Apache-2.0",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/ecadlabs/taqueria.git",
36
+ "directory": "taqueria-plugin-archetype"
37
+ },
38
+ "bugs": {
39
+ "url": "https://github.com/ecadlabs/taqueria/issues"
40
+ },
41
+ "homepage": "https://github.com/ecadlabs/taqueria#readme",
42
+ "dependencies": {
43
+ "@taqueria/node-sdk": "^0.4.0",
44
+ "fast-glob": "^3.2.11"
45
+ },
46
+ "devDependencies": {
47
+ "parcel": "^2.6.0",
48
+ "typescript": "^4.7.2"
49
+ }
50
50
  }
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": "ES6", /* 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
  }