@clarigen/cli 3.1.0 → 3.1.1
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/dist/index.cjs +65 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -146
- package/dist/index.d.ts +12 -146
- package/dist/index.js +63 -59
- package/dist/index.js.map +1 -1
- package/dist/run-cli.cjs +63 -59
- package/dist/run-cli.cjs.map +1 -1
- package/dist/run-cli.js +63 -59
- package/dist/run-cli.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClarityAbi, ClarityAbiFunction, ClarityAbiMap, ClarityAbiVariable, ClarityAbiArg, ClarityAbiType } from '@clarigen/core';
|
|
2
|
-
import
|
|
2
|
+
import * as arktype_out_variants_object from 'arktype/out/variants/object';
|
|
3
3
|
import { Simnet } from '@hirosystems/clarinet-sdk';
|
|
4
4
|
import { inspect, InspectOptions } from 'util';
|
|
5
5
|
|
|
@@ -23,45 +23,7 @@ interface SessionWithVariables extends Session {
|
|
|
23
23
|
variables: string[];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare const
|
|
27
|
-
project: z.ZodObject<{
|
|
28
|
-
requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29
|
-
contract_id: z.ZodString;
|
|
30
|
-
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
contract_id: string;
|
|
32
|
-
}, {
|
|
33
|
-
contract_id: string;
|
|
34
|
-
}>, "many">>;
|
|
35
|
-
cache_location: z.ZodOptional<z.ZodObject<{
|
|
36
|
-
path: z.ZodString;
|
|
37
|
-
}, "strip", z.ZodTypeAny, {
|
|
38
|
-
path: string;
|
|
39
|
-
}, {
|
|
40
|
-
path: string;
|
|
41
|
-
}>>;
|
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
|
43
|
-
requirements?: {
|
|
44
|
-
contract_id: string;
|
|
45
|
-
}[] | undefined;
|
|
46
|
-
cache_location?: {
|
|
47
|
-
path: string;
|
|
48
|
-
} | undefined;
|
|
49
|
-
}, {
|
|
50
|
-
requirements?: {
|
|
51
|
-
contract_id: string;
|
|
52
|
-
}[] | undefined;
|
|
53
|
-
cache_location?: {
|
|
54
|
-
path: string;
|
|
55
|
-
} | undefined;
|
|
56
|
-
}>;
|
|
57
|
-
contracts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
58
|
-
path: z.ZodString;
|
|
59
|
-
}, "strip", z.ZodTypeAny, {
|
|
60
|
-
path: string;
|
|
61
|
-
}, {
|
|
62
|
-
path: string;
|
|
63
|
-
}>>>;
|
|
64
|
-
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
declare const ClarinetConfig: arktype_out_variants_object.ObjectType<{
|
|
65
27
|
project: {
|
|
66
28
|
requirements?: {
|
|
67
29
|
contract_id: string;
|
|
@@ -70,23 +32,13 @@ declare const ClarinetConfigSchema: z.ZodObject<{
|
|
|
70
32
|
path: string;
|
|
71
33
|
} | undefined;
|
|
72
34
|
};
|
|
73
|
-
contracts?:
|
|
74
|
-
|
|
75
|
-
}> | undefined;
|
|
76
|
-
}, {
|
|
77
|
-
project: {
|
|
78
|
-
requirements?: {
|
|
79
|
-
contract_id: string;
|
|
80
|
-
}[] | undefined;
|
|
81
|
-
cache_location?: {
|
|
35
|
+
contracts?: {
|
|
36
|
+
[x: string]: {
|
|
82
37
|
path: string;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}> | undefined;
|
|
88
|
-
}>;
|
|
89
|
-
type ClarinetConfig = z.infer<typeof ClarinetConfigSchema>;
|
|
38
|
+
};
|
|
39
|
+
} | undefined;
|
|
40
|
+
}, {}>;
|
|
41
|
+
type ClarinetConfig = typeof ClarinetConfig.infer;
|
|
90
42
|
declare function getClarinetConfig(path: string): Promise<ClarinetConfig>;
|
|
91
43
|
|
|
92
44
|
declare const CONFIG_FILE: "Clarigen.toml";
|
|
@@ -95,93 +47,7 @@ declare enum OutputType {
|
|
|
95
47
|
ESM_OLD = "esm",
|
|
96
48
|
Docs = "docs"
|
|
97
49
|
}
|
|
98
|
-
declare const
|
|
99
|
-
clarinet: z.ZodString;
|
|
100
|
-
types: z.ZodOptional<z.ZodObject<{
|
|
101
|
-
output: z.ZodOptional<z.ZodString>;
|
|
102
|
-
outputs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
103
|
-
include_accounts: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
-
after: z.ZodOptional<z.ZodString>;
|
|
105
|
-
include_boot_contracts: z.ZodOptional<z.ZodBoolean>;
|
|
106
|
-
watch_folders: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
107
|
-
}, "strip", z.ZodTypeAny, {
|
|
108
|
-
output?: string | undefined;
|
|
109
|
-
outputs?: string[] | undefined;
|
|
110
|
-
include_accounts?: boolean | undefined;
|
|
111
|
-
after?: string | undefined;
|
|
112
|
-
include_boot_contracts?: boolean | undefined;
|
|
113
|
-
watch_folders?: string[] | undefined;
|
|
114
|
-
}, {
|
|
115
|
-
output?: string | undefined;
|
|
116
|
-
outputs?: string[] | undefined;
|
|
117
|
-
include_accounts?: boolean | undefined;
|
|
118
|
-
after?: string | undefined;
|
|
119
|
-
include_boot_contracts?: boolean | undefined;
|
|
120
|
-
watch_folders?: string[] | undefined;
|
|
121
|
-
}>>;
|
|
122
|
-
esm: z.ZodOptional<z.ZodObject<{
|
|
123
|
-
output: z.ZodOptional<z.ZodString>;
|
|
124
|
-
outputs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
125
|
-
include_accounts: z.ZodOptional<z.ZodBoolean>;
|
|
126
|
-
after: z.ZodOptional<z.ZodString>;
|
|
127
|
-
include_boot_contracts: z.ZodOptional<z.ZodBoolean>;
|
|
128
|
-
watch_folders: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
129
|
-
}, "strip", z.ZodTypeAny, {
|
|
130
|
-
output?: string | undefined;
|
|
131
|
-
outputs?: string[] | undefined;
|
|
132
|
-
include_accounts?: boolean | undefined;
|
|
133
|
-
after?: string | undefined;
|
|
134
|
-
include_boot_contracts?: boolean | undefined;
|
|
135
|
-
watch_folders?: string[] | undefined;
|
|
136
|
-
}, {
|
|
137
|
-
output?: string | undefined;
|
|
138
|
-
outputs?: string[] | undefined;
|
|
139
|
-
include_accounts?: boolean | undefined;
|
|
140
|
-
after?: string | undefined;
|
|
141
|
-
include_boot_contracts?: boolean | undefined;
|
|
142
|
-
watch_folders?: string[] | undefined;
|
|
143
|
-
}>>;
|
|
144
|
-
docs: z.ZodOptional<z.ZodObject<{
|
|
145
|
-
output: z.ZodOptional<z.ZodString>;
|
|
146
|
-
outputs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
147
|
-
exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
148
|
-
after: z.ZodOptional<z.ZodString>;
|
|
149
|
-
}, "strip", z.ZodTypeAny, {
|
|
150
|
-
output?: string | undefined;
|
|
151
|
-
outputs?: string[] | undefined;
|
|
152
|
-
exclude?: string[] | undefined;
|
|
153
|
-
after?: string | undefined;
|
|
154
|
-
}, {
|
|
155
|
-
output?: string | undefined;
|
|
156
|
-
outputs?: string[] | undefined;
|
|
157
|
-
exclude?: string[] | undefined;
|
|
158
|
-
after?: string | undefined;
|
|
159
|
-
}>>;
|
|
160
|
-
}, "strip", z.ZodTypeAny, {
|
|
161
|
-
clarinet: string;
|
|
162
|
-
types?: {
|
|
163
|
-
output?: string | undefined;
|
|
164
|
-
outputs?: string[] | undefined;
|
|
165
|
-
include_accounts?: boolean | undefined;
|
|
166
|
-
after?: string | undefined;
|
|
167
|
-
include_boot_contracts?: boolean | undefined;
|
|
168
|
-
watch_folders?: string[] | undefined;
|
|
169
|
-
} | undefined;
|
|
170
|
-
esm?: {
|
|
171
|
-
output?: string | undefined;
|
|
172
|
-
outputs?: string[] | undefined;
|
|
173
|
-
include_accounts?: boolean | undefined;
|
|
174
|
-
after?: string | undefined;
|
|
175
|
-
include_boot_contracts?: boolean | undefined;
|
|
176
|
-
watch_folders?: string[] | undefined;
|
|
177
|
-
} | undefined;
|
|
178
|
-
docs?: {
|
|
179
|
-
output?: string | undefined;
|
|
180
|
-
outputs?: string[] | undefined;
|
|
181
|
-
exclude?: string[] | undefined;
|
|
182
|
-
after?: string | undefined;
|
|
183
|
-
} | undefined;
|
|
184
|
-
}, {
|
|
50
|
+
declare const ConfigFile: arktype_out_variants_object.ObjectType<{
|
|
185
51
|
clarinet: string;
|
|
186
52
|
types?: {
|
|
187
53
|
output?: string | undefined;
|
|
@@ -205,8 +71,8 @@ declare const ConfigFileSchema: z.ZodObject<{
|
|
|
205
71
|
exclude?: string[] | undefined;
|
|
206
72
|
after?: string | undefined;
|
|
207
73
|
} | undefined;
|
|
208
|
-
}>;
|
|
209
|
-
type ConfigFile =
|
|
74
|
+
}, {}>;
|
|
75
|
+
type ConfigFile = typeof ConfigFile.infer;
|
|
210
76
|
declare const defaultConfigFile: ConfigFile;
|
|
211
77
|
declare class Config {
|
|
212
78
|
configFile: ConfigFile;
|
|
@@ -453,4 +319,4 @@ declare function sortContracts<T extends {
|
|
|
453
319
|
contract_id: string;
|
|
454
320
|
}>(contracts: T[]): T[];
|
|
455
321
|
|
|
456
|
-
export { type Batch, CONFIG_FILE, type ClaridocContract, type ClaridocFunction, type ClaridocItem, type ClaridocMap, type ClaridocParam, type ClaridocVariable,
|
|
322
|
+
export { type Batch, CONFIG_FILE, type ClaridocContract, type ClaridocFunction, type ClaridocItem, type ClaridocMap, type ClaridocParam, type ClaridocVariable, ClarinetConfig, type Comments, Config, ConfigFile, type ContractDeployments, type ContractTransaction, DEPLOYMENT_NETWORKS, type DeploymentNetwork, type DeploymentPlan, type DevnetDeploymentPlan, type EpochType, FN_TYPES, type FullContractDeployments, type MainnetDeploymentPlan, OutputType, type Session, type SessionAccount, type SessionContract, type SessionWithVariables, type SimnetAccountDeployer, type SimnetDeploymentPlan, TYPE_IMPORTS, type TestnetDeploymentPlan, type Transaction, VAR_TYPES, abiArgType, abiFunctionType, afterDocs, afterESM, collectContractDeployments, collectDeploymentFiles, configFilePath, createContractDocInfo, cwdRelative, defaultConfigFile, encodeVariableName, encodeVariables, fileExists, flatBatch, generateBaseFile, generateContractMeta, generateDocs, generateESMFile, generateMarkdown, generateReadme, getArgName, getClarinetConfig, getConfig, getContractTxs, getDeploymentContract, getDeploymentTxPath, getDeployments, getFnName, getIdentifier, getVariablesV2, isComment, isContractTx, jsTypeFromAbiType, mapVariables, markdownFunction, parseComments, parseDeployment, saveConfig, serialize, sortContracts, traceParens, writeFile };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClarityAbi, ClarityAbiFunction, ClarityAbiMap, ClarityAbiVariable, ClarityAbiArg, ClarityAbiType } from '@clarigen/core';
|
|
2
|
-
import
|
|
2
|
+
import * as arktype_out_variants_object from 'arktype/out/variants/object';
|
|
3
3
|
import { Simnet } from '@hirosystems/clarinet-sdk';
|
|
4
4
|
import { inspect, InspectOptions } from 'util';
|
|
5
5
|
|
|
@@ -23,45 +23,7 @@ interface SessionWithVariables extends Session {
|
|
|
23
23
|
variables: string[];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
declare const
|
|
27
|
-
project: z.ZodObject<{
|
|
28
|
-
requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29
|
-
contract_id: z.ZodString;
|
|
30
|
-
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
contract_id: string;
|
|
32
|
-
}, {
|
|
33
|
-
contract_id: string;
|
|
34
|
-
}>, "many">>;
|
|
35
|
-
cache_location: z.ZodOptional<z.ZodObject<{
|
|
36
|
-
path: z.ZodString;
|
|
37
|
-
}, "strip", z.ZodTypeAny, {
|
|
38
|
-
path: string;
|
|
39
|
-
}, {
|
|
40
|
-
path: string;
|
|
41
|
-
}>>;
|
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
|
43
|
-
requirements?: {
|
|
44
|
-
contract_id: string;
|
|
45
|
-
}[] | undefined;
|
|
46
|
-
cache_location?: {
|
|
47
|
-
path: string;
|
|
48
|
-
} | undefined;
|
|
49
|
-
}, {
|
|
50
|
-
requirements?: {
|
|
51
|
-
contract_id: string;
|
|
52
|
-
}[] | undefined;
|
|
53
|
-
cache_location?: {
|
|
54
|
-
path: string;
|
|
55
|
-
} | undefined;
|
|
56
|
-
}>;
|
|
57
|
-
contracts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
58
|
-
path: z.ZodString;
|
|
59
|
-
}, "strip", z.ZodTypeAny, {
|
|
60
|
-
path: string;
|
|
61
|
-
}, {
|
|
62
|
-
path: string;
|
|
63
|
-
}>>>;
|
|
64
|
-
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
declare const ClarinetConfig: arktype_out_variants_object.ObjectType<{
|
|
65
27
|
project: {
|
|
66
28
|
requirements?: {
|
|
67
29
|
contract_id: string;
|
|
@@ -70,23 +32,13 @@ declare const ClarinetConfigSchema: z.ZodObject<{
|
|
|
70
32
|
path: string;
|
|
71
33
|
} | undefined;
|
|
72
34
|
};
|
|
73
|
-
contracts?:
|
|
74
|
-
|
|
75
|
-
}> | undefined;
|
|
76
|
-
}, {
|
|
77
|
-
project: {
|
|
78
|
-
requirements?: {
|
|
79
|
-
contract_id: string;
|
|
80
|
-
}[] | undefined;
|
|
81
|
-
cache_location?: {
|
|
35
|
+
contracts?: {
|
|
36
|
+
[x: string]: {
|
|
82
37
|
path: string;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}> | undefined;
|
|
88
|
-
}>;
|
|
89
|
-
type ClarinetConfig = z.infer<typeof ClarinetConfigSchema>;
|
|
38
|
+
};
|
|
39
|
+
} | undefined;
|
|
40
|
+
}, {}>;
|
|
41
|
+
type ClarinetConfig = typeof ClarinetConfig.infer;
|
|
90
42
|
declare function getClarinetConfig(path: string): Promise<ClarinetConfig>;
|
|
91
43
|
|
|
92
44
|
declare const CONFIG_FILE: "Clarigen.toml";
|
|
@@ -95,93 +47,7 @@ declare enum OutputType {
|
|
|
95
47
|
ESM_OLD = "esm",
|
|
96
48
|
Docs = "docs"
|
|
97
49
|
}
|
|
98
|
-
declare const
|
|
99
|
-
clarinet: z.ZodString;
|
|
100
|
-
types: z.ZodOptional<z.ZodObject<{
|
|
101
|
-
output: z.ZodOptional<z.ZodString>;
|
|
102
|
-
outputs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
103
|
-
include_accounts: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
-
after: z.ZodOptional<z.ZodString>;
|
|
105
|
-
include_boot_contracts: z.ZodOptional<z.ZodBoolean>;
|
|
106
|
-
watch_folders: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
107
|
-
}, "strip", z.ZodTypeAny, {
|
|
108
|
-
output?: string | undefined;
|
|
109
|
-
outputs?: string[] | undefined;
|
|
110
|
-
include_accounts?: boolean | undefined;
|
|
111
|
-
after?: string | undefined;
|
|
112
|
-
include_boot_contracts?: boolean | undefined;
|
|
113
|
-
watch_folders?: string[] | undefined;
|
|
114
|
-
}, {
|
|
115
|
-
output?: string | undefined;
|
|
116
|
-
outputs?: string[] | undefined;
|
|
117
|
-
include_accounts?: boolean | undefined;
|
|
118
|
-
after?: string | undefined;
|
|
119
|
-
include_boot_contracts?: boolean | undefined;
|
|
120
|
-
watch_folders?: string[] | undefined;
|
|
121
|
-
}>>;
|
|
122
|
-
esm: z.ZodOptional<z.ZodObject<{
|
|
123
|
-
output: z.ZodOptional<z.ZodString>;
|
|
124
|
-
outputs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
125
|
-
include_accounts: z.ZodOptional<z.ZodBoolean>;
|
|
126
|
-
after: z.ZodOptional<z.ZodString>;
|
|
127
|
-
include_boot_contracts: z.ZodOptional<z.ZodBoolean>;
|
|
128
|
-
watch_folders: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
129
|
-
}, "strip", z.ZodTypeAny, {
|
|
130
|
-
output?: string | undefined;
|
|
131
|
-
outputs?: string[] | undefined;
|
|
132
|
-
include_accounts?: boolean | undefined;
|
|
133
|
-
after?: string | undefined;
|
|
134
|
-
include_boot_contracts?: boolean | undefined;
|
|
135
|
-
watch_folders?: string[] | undefined;
|
|
136
|
-
}, {
|
|
137
|
-
output?: string | undefined;
|
|
138
|
-
outputs?: string[] | undefined;
|
|
139
|
-
include_accounts?: boolean | undefined;
|
|
140
|
-
after?: string | undefined;
|
|
141
|
-
include_boot_contracts?: boolean | undefined;
|
|
142
|
-
watch_folders?: string[] | undefined;
|
|
143
|
-
}>>;
|
|
144
|
-
docs: z.ZodOptional<z.ZodObject<{
|
|
145
|
-
output: z.ZodOptional<z.ZodString>;
|
|
146
|
-
outputs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
147
|
-
exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
148
|
-
after: z.ZodOptional<z.ZodString>;
|
|
149
|
-
}, "strip", z.ZodTypeAny, {
|
|
150
|
-
output?: string | undefined;
|
|
151
|
-
outputs?: string[] | undefined;
|
|
152
|
-
exclude?: string[] | undefined;
|
|
153
|
-
after?: string | undefined;
|
|
154
|
-
}, {
|
|
155
|
-
output?: string | undefined;
|
|
156
|
-
outputs?: string[] | undefined;
|
|
157
|
-
exclude?: string[] | undefined;
|
|
158
|
-
after?: string | undefined;
|
|
159
|
-
}>>;
|
|
160
|
-
}, "strip", z.ZodTypeAny, {
|
|
161
|
-
clarinet: string;
|
|
162
|
-
types?: {
|
|
163
|
-
output?: string | undefined;
|
|
164
|
-
outputs?: string[] | undefined;
|
|
165
|
-
include_accounts?: boolean | undefined;
|
|
166
|
-
after?: string | undefined;
|
|
167
|
-
include_boot_contracts?: boolean | undefined;
|
|
168
|
-
watch_folders?: string[] | undefined;
|
|
169
|
-
} | undefined;
|
|
170
|
-
esm?: {
|
|
171
|
-
output?: string | undefined;
|
|
172
|
-
outputs?: string[] | undefined;
|
|
173
|
-
include_accounts?: boolean | undefined;
|
|
174
|
-
after?: string | undefined;
|
|
175
|
-
include_boot_contracts?: boolean | undefined;
|
|
176
|
-
watch_folders?: string[] | undefined;
|
|
177
|
-
} | undefined;
|
|
178
|
-
docs?: {
|
|
179
|
-
output?: string | undefined;
|
|
180
|
-
outputs?: string[] | undefined;
|
|
181
|
-
exclude?: string[] | undefined;
|
|
182
|
-
after?: string | undefined;
|
|
183
|
-
} | undefined;
|
|
184
|
-
}, {
|
|
50
|
+
declare const ConfigFile: arktype_out_variants_object.ObjectType<{
|
|
185
51
|
clarinet: string;
|
|
186
52
|
types?: {
|
|
187
53
|
output?: string | undefined;
|
|
@@ -205,8 +71,8 @@ declare const ConfigFileSchema: z.ZodObject<{
|
|
|
205
71
|
exclude?: string[] | undefined;
|
|
206
72
|
after?: string | undefined;
|
|
207
73
|
} | undefined;
|
|
208
|
-
}>;
|
|
209
|
-
type ConfigFile =
|
|
74
|
+
}, {}>;
|
|
75
|
+
type ConfigFile = typeof ConfigFile.infer;
|
|
210
76
|
declare const defaultConfigFile: ConfigFile;
|
|
211
77
|
declare class Config {
|
|
212
78
|
configFile: ConfigFile;
|
|
@@ -453,4 +319,4 @@ declare function sortContracts<T extends {
|
|
|
453
319
|
contract_id: string;
|
|
454
320
|
}>(contracts: T[]): T[];
|
|
455
321
|
|
|
456
|
-
export { type Batch, CONFIG_FILE, type ClaridocContract, type ClaridocFunction, type ClaridocItem, type ClaridocMap, type ClaridocParam, type ClaridocVariable,
|
|
322
|
+
export { type Batch, CONFIG_FILE, type ClaridocContract, type ClaridocFunction, type ClaridocItem, type ClaridocMap, type ClaridocParam, type ClaridocVariable, ClarinetConfig, type Comments, Config, ConfigFile, type ContractDeployments, type ContractTransaction, DEPLOYMENT_NETWORKS, type DeploymentNetwork, type DeploymentPlan, type DevnetDeploymentPlan, type EpochType, FN_TYPES, type FullContractDeployments, type MainnetDeploymentPlan, OutputType, type Session, type SessionAccount, type SessionContract, type SessionWithVariables, type SimnetAccountDeployer, type SimnetDeploymentPlan, TYPE_IMPORTS, type TestnetDeploymentPlan, type Transaction, VAR_TYPES, abiArgType, abiFunctionType, afterDocs, afterESM, collectContractDeployments, collectDeploymentFiles, configFilePath, createContractDocInfo, cwdRelative, defaultConfigFile, encodeVariableName, encodeVariables, fileExists, flatBatch, generateBaseFile, generateContractMeta, generateDocs, generateESMFile, generateMarkdown, generateReadme, getArgName, getClarinetConfig, getConfig, getContractTxs, getDeploymentContract, getDeploymentTxPath, getDeployments, getFnName, getIdentifier, getVariablesV2, isComment, isContractTx, jsTypeFromAbiType, mapVariables, markdownFunction, parseComments, parseDeployment, saveConfig, serialize, sortContracts, traceParens, writeFile };
|
package/dist/index.js
CHANGED
|
@@ -92,8 +92,8 @@ function clarityNameMatcher(line) {
|
|
|
92
92
|
return /[\w|\-|\?|\!]+/.exec(line);
|
|
93
93
|
}
|
|
94
94
|
function findItemNameFromLine(line) {
|
|
95
|
-
const fnType = FN_TYPES.find((
|
|
96
|
-
return line.startsWith(`(define-${
|
|
95
|
+
const fnType = FN_TYPES.find((type3) => {
|
|
96
|
+
return line.startsWith(`(define-${type3}`);
|
|
97
97
|
});
|
|
98
98
|
if (fnType) {
|
|
99
99
|
const prefix = `(define-${fnType} (`;
|
|
@@ -106,13 +106,13 @@ function findItemNameFromLine(line) {
|
|
|
106
106
|
}
|
|
107
107
|
return match[0];
|
|
108
108
|
}
|
|
109
|
-
for (const
|
|
110
|
-
const prefix = `(define-${
|
|
109
|
+
for (const type3 of VAR_TYPES) {
|
|
110
|
+
const prefix = `(define-${type3} `;
|
|
111
111
|
if (!line.startsWith(prefix)) continue;
|
|
112
112
|
const startString = line.slice(prefix.length);
|
|
113
113
|
const match = clarityNameMatcher(startString);
|
|
114
114
|
if (!match) {
|
|
115
|
-
console.debug(`[claridocs]: Unable to determine ${
|
|
115
|
+
console.debug(`[claridocs]: Unable to determine ${type3} name from line:
|
|
116
116
|
\`${line}\``);
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
@@ -134,8 +134,8 @@ function isComment(line) {
|
|
|
134
134
|
return line.startsWith(";;");
|
|
135
135
|
}
|
|
136
136
|
function getFnName(line) {
|
|
137
|
-
const fnType = FN_TYPES.find((
|
|
138
|
-
return line.startsWith(`(define-${
|
|
137
|
+
const fnType = FN_TYPES.find((type3) => {
|
|
138
|
+
return line.startsWith(`(define-${type3}`);
|
|
139
139
|
});
|
|
140
140
|
if (typeof fnType === "undefined") return;
|
|
141
141
|
const prefix = `(define-${fnType} (`;
|
|
@@ -436,29 +436,37 @@ function generateReadme(session, excluded) {
|
|
|
436
436
|
contractLines.push(line);
|
|
437
437
|
});
|
|
438
438
|
const fileContents = `# Contracts
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
|
|
440
|
+
${contractLines.join("\n")}
|
|
441
441
|
`;
|
|
442
442
|
return fileContents;
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
// src/config.ts
|
|
446
|
-
import {
|
|
446
|
+
import { type as type2 } from "arktype";
|
|
447
447
|
|
|
448
448
|
// src/clarinet-config.ts
|
|
449
|
-
import {
|
|
449
|
+
import { type } from "arktype";
|
|
450
450
|
import { readFile } from "fs/promises";
|
|
451
451
|
import { parse } from "@iarna/toml";
|
|
452
|
-
var
|
|
453
|
-
project:
|
|
454
|
-
requirements:
|
|
455
|
-
|
|
452
|
+
var ClarinetConfig = type({
|
|
453
|
+
project: type({
|
|
454
|
+
requirements: type({
|
|
455
|
+
contract_id: type("string").describe("Contract ID")
|
|
456
|
+
}).array().describe("Project requirements").optional(),
|
|
457
|
+
cache_location: type({
|
|
458
|
+
path: type("string").describe("Cache location path")
|
|
459
|
+
}).optional()
|
|
456
460
|
}),
|
|
457
|
-
contracts:
|
|
461
|
+
contracts: type({
|
|
462
|
+
"[string]": type({
|
|
463
|
+
path: type("string").describe("Contract path")
|
|
464
|
+
})
|
|
465
|
+
}).optional()
|
|
458
466
|
});
|
|
459
467
|
async function getClarinetConfig(path) {
|
|
460
468
|
const file = await readFile(path, "utf-8");
|
|
461
|
-
const config =
|
|
469
|
+
const config = ClarinetConfig.assert(parse(file));
|
|
462
470
|
return config;
|
|
463
471
|
}
|
|
464
472
|
|
|
@@ -473,23 +481,23 @@ var OutputType = /* @__PURE__ */ ((OutputType2) => {
|
|
|
473
481
|
OutputType2["Docs"] = "docs";
|
|
474
482
|
return OutputType2;
|
|
475
483
|
})(OutputType || {});
|
|
476
|
-
var typesSchema =
|
|
477
|
-
output:
|
|
478
|
-
outputs:
|
|
479
|
-
include_accounts:
|
|
480
|
-
after:
|
|
481
|
-
include_boot_contracts:
|
|
482
|
-
watch_folders:
|
|
484
|
+
var typesSchema = type2({
|
|
485
|
+
"output?": type2("string").describe("Path to the output file"),
|
|
486
|
+
"outputs?": type2("string[]").describe("Paths to the output files"),
|
|
487
|
+
"include_accounts?": type2("boolean").describe("Include accounts in the output"),
|
|
488
|
+
"after?": type2("string").describe("Script to run after the output is generated"),
|
|
489
|
+
"include_boot_contracts?": type2("boolean").describe("Include boot contracts in the output"),
|
|
490
|
+
"watch_folders?": type2("string[]").describe("Folders to watch for changes")
|
|
483
491
|
}).optional();
|
|
484
|
-
var
|
|
485
|
-
clarinet:
|
|
492
|
+
var ConfigFile = type2({
|
|
493
|
+
clarinet: type2("string").describe("Path to the Clarinet config file"),
|
|
486
494
|
["types" /* ESM */]: typesSchema,
|
|
487
495
|
["esm" /* ESM_OLD */]: typesSchema,
|
|
488
|
-
["docs" /* Docs */]:
|
|
489
|
-
output:
|
|
490
|
-
outputs:
|
|
491
|
-
exclude:
|
|
492
|
-
after:
|
|
496
|
+
["docs" /* Docs */]: type2({
|
|
497
|
+
"output?": type2("string").describe("Path to docs output folder. Defaults to ./docs"),
|
|
498
|
+
"outputs?": type2("string[]").describe("Paths to docs output folders"),
|
|
499
|
+
"exclude?": type2("string[]").describe("Contracts to exclude from docs generation"),
|
|
500
|
+
"after?": type2("string").describe("Script to run after docs are generated")
|
|
493
501
|
}).optional()
|
|
494
502
|
});
|
|
495
503
|
var defaultConfigFile = {
|
|
@@ -513,36 +521,36 @@ var Config = class {
|
|
|
513
521
|
const clarinet = await getClarinetConfig(resolve2(cwd ?? "", config.clarinet));
|
|
514
522
|
return new this(config, clarinet, cwd);
|
|
515
523
|
}
|
|
516
|
-
getOutputs(
|
|
524
|
+
getOutputs(type3) {
|
|
517
525
|
var _a, _b;
|
|
518
|
-
const singlePath = (_a = this.configFile[
|
|
519
|
-
const multiPath = ((_b = this.configFile[
|
|
526
|
+
const singlePath = (_a = this.configFile[type3]) == null ? void 0 : _a.output;
|
|
527
|
+
const multiPath = ((_b = this.configFile[type3]) == null ? void 0 : _b.outputs) || [];
|
|
520
528
|
if (singlePath !== void 0) return [singlePath];
|
|
521
529
|
return multiPath;
|
|
522
530
|
}
|
|
523
|
-
outputResolve(
|
|
524
|
-
const outputs = this.getOutputs(
|
|
525
|
-
if (!this.supports(
|
|
531
|
+
outputResolve(type3, filePath) {
|
|
532
|
+
const outputs = this.getOutputs(type3);
|
|
533
|
+
if (!this.supports(type3)) return null;
|
|
526
534
|
return outputs.map((path) => {
|
|
527
535
|
return resolve2(this.cwd, path, filePath || "");
|
|
528
536
|
});
|
|
529
537
|
}
|
|
530
|
-
async writeOutput(
|
|
531
|
-
const paths = this.outputResolve(
|
|
538
|
+
async writeOutput(type3, contents, filePath) {
|
|
539
|
+
const paths = this.outputResolve(type3, filePath);
|
|
532
540
|
if (paths === null) return null;
|
|
533
541
|
await Promise.all(
|
|
534
542
|
paths.map(async (path) => {
|
|
535
543
|
await writeFile(path, contents);
|
|
536
|
-
log.debug(`Generated ${
|
|
544
|
+
log.debug(`Generated ${type3} file at ${relative2(this.cwd, path)}`);
|
|
537
545
|
})
|
|
538
546
|
);
|
|
539
547
|
return paths;
|
|
540
548
|
}
|
|
541
|
-
supports(
|
|
542
|
-
return this.getOutputs(
|
|
549
|
+
supports(type3) {
|
|
550
|
+
return this.getOutputs(type3).length > 0;
|
|
543
551
|
}
|
|
544
|
-
type(
|
|
545
|
-
return this.configFile[
|
|
552
|
+
type(type3) {
|
|
553
|
+
return this.configFile[type3];
|
|
546
554
|
}
|
|
547
555
|
get esm() {
|
|
548
556
|
return this.configFile["types" /* ESM */];
|
|
@@ -572,16 +580,12 @@ async function getConfig(cwd) {
|
|
|
572
580
|
if (await fileExists(path)) {
|
|
573
581
|
const toml = await readFile2(path, "utf-8");
|
|
574
582
|
const parsedToml = parse2(toml);
|
|
575
|
-
const
|
|
576
|
-
if (
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
logger.error("Error parsing Clarigen.toml:");
|
|
580
|
-
parseResult.error.errors.forEach((e) => {
|
|
581
|
-
logger.error(`${e.path.join(".")}: ${e.message}`);
|
|
582
|
-
});
|
|
583
|
-
throw new Error("Error parsing Clarigen.toml");
|
|
583
|
+
const parsed = ConfigFile(parsedToml);
|
|
584
|
+
if (parsed instanceof type2.errors) {
|
|
585
|
+
logger.error(`Error parsing Clarigen config: ${parsed.summary}`);
|
|
586
|
+
throw new Error(`Error parsing Clarigen config: ${parsed.summary}`);
|
|
584
587
|
}
|
|
588
|
+
sessionConfig = parsed;
|
|
585
589
|
} else {
|
|
586
590
|
sessionConfig = defaultConfigFile;
|
|
587
591
|
}
|
|
@@ -697,9 +701,9 @@ var jsTypeFromAbiType = (val, isArgument = false) => {
|
|
|
697
701
|
return `${innerType} | null`;
|
|
698
702
|
} else if (isClarityAbiTuple(val)) {
|
|
699
703
|
const tupleDefs = [];
|
|
700
|
-
val.tuple.forEach(({ name, type }) => {
|
|
704
|
+
val.tuple.forEach(({ name, type: type3 }) => {
|
|
701
705
|
const camelName = toCamelCase2(name);
|
|
702
|
-
const innerType = jsTypeFromAbiType(
|
|
706
|
+
const innerType = jsTypeFromAbiType(type3, isArgument);
|
|
703
707
|
tupleDefs.push(`"${camelName}": ${innerType};`);
|
|
704
708
|
});
|
|
705
709
|
return `{
|
|
@@ -899,9 +903,9 @@ export const simnet = {
|
|
|
899
903
|
function encodeVariables(variables) {
|
|
900
904
|
return variables.map((v) => {
|
|
901
905
|
let varLine = `${encodeVariableName(v.name)}: `;
|
|
902
|
-
const
|
|
906
|
+
const type3 = jsTypeFromAbiType(v.type);
|
|
903
907
|
const varJSON = serialize(v);
|
|
904
|
-
varLine += `${varJSON} as TypedAbiVariable<${
|
|
908
|
+
varLine += `${varJSON} as TypedAbiVariable<${type3}>`;
|
|
905
909
|
return varLine;
|
|
906
910
|
});
|
|
907
911
|
}
|
|
@@ -1219,9 +1223,9 @@ async function afterESM(config) {
|
|
|
1219
1223
|
}
|
|
1220
1224
|
export {
|
|
1221
1225
|
CONFIG_FILE,
|
|
1222
|
-
|
|
1226
|
+
ClarinetConfig,
|
|
1223
1227
|
Config,
|
|
1224
|
-
|
|
1228
|
+
ConfigFile,
|
|
1225
1229
|
DEPLOYMENT_NETWORKS,
|
|
1226
1230
|
FN_TYPES,
|
|
1227
1231
|
OutputType,
|