@clarigen/cli 4.0.0 → 4.0.2-alpha.0
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/esm-CO92uOgU.mjs +917 -0
- package/dist/esm-CO92uOgU.mjs.map +1 -0
- package/dist/esm-CRbGFHSR.cjs +1226 -0
- package/dist/esm-CRbGFHSR.cjs.map +1 -0
- package/dist/index.cjs +47 -1365
- package/dist/index.d.cts +173 -243
- package/dist/index.d.mts +252 -0
- package/dist/index.mjs +3 -0
- package/dist/run-cli.cjs +259 -1528
- package/dist/run-cli.cjs.map +1 -1
- package/dist/run-cli.d.cts +1 -1
- package/dist/run-cli.d.mts +1 -0
- package/dist/run-cli.mjs +321 -0
- package/dist/run-cli.mjs.map +1 -0
- package/package.json +18 -7
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -322
- package/dist/index.js +0 -1291
- package/dist/index.js.map +0 -1
- package/dist/run-cli.d.ts +0 -1
- package/dist/run-cli.js +0 -1585
- package/dist/run-cli.js.map +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ClarityAbi, ClarityAbiArg, ClarityAbiFunction, ClarityAbiMap, ClarityAbiType, ClarityAbiVariable, DeploymentPlan } from "@clarigen/core";
|
|
3
|
+
import { InspectOptions } from "util";
|
|
4
|
+
import { Simnet } from "@stacks/clarinet-sdk";
|
|
5
|
+
import * as arktype_internal_variants_object_ts0 from "arktype/internal/variants/object.ts";
|
|
6
|
+
|
|
7
|
+
//#region src/session.d.ts
|
|
8
|
+
interface SessionContract {
|
|
9
|
+
contract_id: string;
|
|
10
|
+
contract_interface: ClarityAbi;
|
|
11
|
+
source: string;
|
|
12
|
+
}
|
|
13
|
+
type EpochType = ClarityAbi;
|
|
14
|
+
type SessionAccount = {
|
|
15
|
+
address: string;
|
|
16
|
+
balance: string;
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
interface Session {
|
|
20
|
+
session_id: number;
|
|
21
|
+
accounts: SessionAccount[];
|
|
22
|
+
contracts: SessionContract[];
|
|
23
|
+
}
|
|
24
|
+
interface SessionWithVariables extends Session {
|
|
25
|
+
variables: string[];
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/clarinet-config.d.ts
|
|
29
|
+
declare const ClarinetConfig: arktype_internal_variants_object_ts0.ObjectType<{
|
|
30
|
+
project: {
|
|
31
|
+
requirements?: {
|
|
32
|
+
contract_id: string;
|
|
33
|
+
}[] | undefined;
|
|
34
|
+
cache_location?: {
|
|
35
|
+
path: string;
|
|
36
|
+
} | undefined;
|
|
37
|
+
};
|
|
38
|
+
contracts?: {
|
|
39
|
+
[x: string]: {
|
|
40
|
+
path: string;
|
|
41
|
+
};
|
|
42
|
+
} | undefined;
|
|
43
|
+
}, {}>;
|
|
44
|
+
type ClarinetConfig = typeof ClarinetConfig.infer;
|
|
45
|
+
declare function getClarinetConfig(path: string): Promise<ClarinetConfig>;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/config.d.ts
|
|
48
|
+
declare const CONFIG_FILE: "Clarigen.toml";
|
|
49
|
+
declare enum OutputType {
|
|
50
|
+
ESM = "types",
|
|
51
|
+
ESM_OLD = "esm",
|
|
52
|
+
Docs = "docs",
|
|
53
|
+
}
|
|
54
|
+
declare const ConfigFile: arktype_internal_variants_object_ts0.ObjectType<{
|
|
55
|
+
clarinet: string;
|
|
56
|
+
types?: {
|
|
57
|
+
output?: string | undefined;
|
|
58
|
+
outputs?: string[] | undefined;
|
|
59
|
+
include_accounts?: boolean | undefined;
|
|
60
|
+
after?: string | undefined;
|
|
61
|
+
include_boot_contracts?: boolean | undefined;
|
|
62
|
+
watch_folders?: string[] | undefined;
|
|
63
|
+
} | undefined;
|
|
64
|
+
esm?: {
|
|
65
|
+
output?: string | undefined;
|
|
66
|
+
outputs?: string[] | undefined;
|
|
67
|
+
include_accounts?: boolean | undefined;
|
|
68
|
+
after?: string | undefined;
|
|
69
|
+
include_boot_contracts?: boolean | undefined;
|
|
70
|
+
watch_folders?: string[] | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
docs?: {
|
|
73
|
+
output?: string | undefined;
|
|
74
|
+
outputs?: string[] | undefined;
|
|
75
|
+
exclude?: string[] | undefined;
|
|
76
|
+
after?: string | undefined;
|
|
77
|
+
} | undefined;
|
|
78
|
+
}, {}>;
|
|
79
|
+
type ConfigFile = typeof ConfigFile.infer;
|
|
80
|
+
declare const defaultConfigFile: ConfigFile;
|
|
81
|
+
declare class Config {
|
|
82
|
+
configFile: ConfigFile;
|
|
83
|
+
clarinet: ClarinetConfig;
|
|
84
|
+
cwd: string;
|
|
85
|
+
constructor(config: ConfigFile, clarinet: ClarinetConfig, cwd?: string);
|
|
86
|
+
static load(cwd?: string): Promise<Config>;
|
|
87
|
+
getOutputs(type: OutputType): string[];
|
|
88
|
+
outputResolve(type: OutputType, filePath?: string): string[] | null;
|
|
89
|
+
writeOutput(type: OutputType, contents: string, filePath?: string): Promise<string[] | null>;
|
|
90
|
+
supports(type: OutputType): boolean;
|
|
91
|
+
type(type: OutputType): {
|
|
92
|
+
output?: string | undefined;
|
|
93
|
+
outputs?: string[] | undefined;
|
|
94
|
+
include_accounts?: boolean | undefined;
|
|
95
|
+
after?: string | undefined;
|
|
96
|
+
include_boot_contracts?: boolean | undefined;
|
|
97
|
+
watch_folders?: string[] | undefined;
|
|
98
|
+
} | {
|
|
99
|
+
output?: string | undefined;
|
|
100
|
+
outputs?: string[] | undefined;
|
|
101
|
+
exclude?: string[] | undefined;
|
|
102
|
+
after?: string | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
get esm(): {
|
|
105
|
+
output?: string | undefined;
|
|
106
|
+
outputs?: string[] | undefined;
|
|
107
|
+
include_accounts?: boolean | undefined;
|
|
108
|
+
after?: string | undefined;
|
|
109
|
+
include_boot_contracts?: boolean | undefined;
|
|
110
|
+
watch_folders?: string[] | undefined;
|
|
111
|
+
} | undefined;
|
|
112
|
+
get docs(): {
|
|
113
|
+
output?: string | undefined;
|
|
114
|
+
outputs?: string[] | undefined;
|
|
115
|
+
exclude?: string[] | undefined;
|
|
116
|
+
after?: string | undefined;
|
|
117
|
+
} | undefined;
|
|
118
|
+
clarinetFile(): string;
|
|
119
|
+
joinFromClarinet(filePath: string): string;
|
|
120
|
+
}
|
|
121
|
+
declare function configFilePath(cwd?: string): string;
|
|
122
|
+
declare function saveConfig(config: ConfigFile): Promise<void>;
|
|
123
|
+
declare function getConfig(cwd?: string): Promise<ConfigFile>;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/docs/index.d.ts
|
|
126
|
+
declare const FN_TYPES: readonly ["read-only", "public", "private"];
|
|
127
|
+
declare const VAR_TYPES: readonly ["map", "data-var", "constant"];
|
|
128
|
+
type ClarityAbiItem = ClarityAbiFunction | ClarityAbiMap | ClarityAbiVariable;
|
|
129
|
+
type ClaridocItemType<T extends ClarityAbiItem> = {
|
|
130
|
+
abi: T;
|
|
131
|
+
comments: Comments;
|
|
132
|
+
startLine: number;
|
|
133
|
+
source: string[];
|
|
134
|
+
};
|
|
135
|
+
type ClaridocFunction = ClaridocItemType<ClarityAbiFunction>;
|
|
136
|
+
type ClaridocMap = ClaridocItemType<ClarityAbiMap>;
|
|
137
|
+
type ClaridocVariable = ClaridocItemType<ClarityAbiVariable>;
|
|
138
|
+
interface ClaridocItem {
|
|
139
|
+
abi: ClarityAbiItem;
|
|
140
|
+
comments: Comments;
|
|
141
|
+
startLine: number;
|
|
142
|
+
source: string[];
|
|
143
|
+
}
|
|
144
|
+
interface Comments {
|
|
145
|
+
params: Record<string, ClaridocParam>;
|
|
146
|
+
text: string[];
|
|
147
|
+
}
|
|
148
|
+
interface ClaridocContract {
|
|
149
|
+
functions: ClaridocFunction[];
|
|
150
|
+
maps: ClaridocMap[];
|
|
151
|
+
variables: ClaridocVariable[];
|
|
152
|
+
comments: string[];
|
|
153
|
+
}
|
|
154
|
+
interface ClaridocParam {
|
|
155
|
+
abi: ClarityAbiArg;
|
|
156
|
+
comments: string[];
|
|
157
|
+
}
|
|
158
|
+
declare function createContractDocInfo({
|
|
159
|
+
contractSrc,
|
|
160
|
+
abi
|
|
161
|
+
}: {
|
|
162
|
+
contractSrc: string;
|
|
163
|
+
abi: ClarityAbi;
|
|
164
|
+
}): ClaridocContract;
|
|
165
|
+
declare function isComment(line: string): boolean;
|
|
166
|
+
declare function getFnName(line: string): string | undefined;
|
|
167
|
+
declare function traceParens(line: string, count: number): number;
|
|
168
|
+
declare function parseComments(comments: string[], abi: ClarityAbiItem): Comments;
|
|
169
|
+
declare function afterDocs(config: Config): Promise<void>;
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/docs/markdown.d.ts
|
|
172
|
+
declare function generateMarkdown({
|
|
173
|
+
contract,
|
|
174
|
+
contractFile,
|
|
175
|
+
withToc
|
|
176
|
+
}: {
|
|
177
|
+
contract: SessionContract;
|
|
178
|
+
contractFile?: string;
|
|
179
|
+
withToc?: boolean;
|
|
180
|
+
}): string;
|
|
181
|
+
declare function markdownFunction(fn: ClaridocFunction, contractFile?: string): string;
|
|
182
|
+
declare function generateReadme(session: Session, excluded: Record<string, boolean>): string;
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/files/docs.d.ts
|
|
185
|
+
declare function generateDocs({
|
|
186
|
+
session,
|
|
187
|
+
config
|
|
188
|
+
}: {
|
|
189
|
+
session: SessionWithVariables;
|
|
190
|
+
config: Config;
|
|
191
|
+
}): Promise<void>;
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/files/variables.d.ts
|
|
194
|
+
declare function getVariablesV2(contract: SessionContract, simnet: Simnet, verbose?: boolean): any;
|
|
195
|
+
declare function mapVariables(session: Session, simnet: Simnet): string[];
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/files/base.d.ts
|
|
198
|
+
declare function generateContractMeta(contract: SessionContract, constants: string): string;
|
|
199
|
+
declare const TYPE_IMPORTS = "import type { TypedAbiArg, TypedAbiFunction, TypedAbiMap, TypedAbiVariable, Response } from '@clarigen/core';";
|
|
200
|
+
declare function generateBaseFile(session: SessionWithVariables): string;
|
|
201
|
+
declare function encodeVariables(variables: ClarityAbiVariable[]): string[];
|
|
202
|
+
declare global {
|
|
203
|
+
interface Uint8Array {
|
|
204
|
+
[inspect.custom](depth: number, options: InspectOptions): string;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
declare function serialize(obj: any): string;
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/files/esm.d.ts
|
|
210
|
+
declare function parseDeployment(path: string): Promise<Plan>;
|
|
211
|
+
declare const DEPLOYMENT_NETWORKS: readonly ["devnet", "simnet", "testnet", "mainnet"];
|
|
212
|
+
type DeploymentNetwork = (typeof DEPLOYMENT_NETWORKS)[number];
|
|
213
|
+
type Plan = DeploymentPlan | undefined;
|
|
214
|
+
type DeploymentsMap = { [key in DeploymentNetwork]: Plan };
|
|
215
|
+
declare function getDeployments(config: Config): Promise<DeploymentsMap>;
|
|
216
|
+
declare function generateESMFile({
|
|
217
|
+
baseFile,
|
|
218
|
+
session,
|
|
219
|
+
config
|
|
220
|
+
}: {
|
|
221
|
+
baseFile: string;
|
|
222
|
+
session: Session;
|
|
223
|
+
config: Config;
|
|
224
|
+
}): Promise<string>;
|
|
225
|
+
type ContractDeployments = { [key in DeploymentNetwork]: string | null };
|
|
226
|
+
type FullContractDeployments = {
|
|
227
|
+
[contractName: string]: ContractDeployments;
|
|
228
|
+
};
|
|
229
|
+
declare function collectContractDeployments(session: Session, deployments: DeploymentsMap, config: Config): FullContractDeployments;
|
|
230
|
+
declare function collectDeploymentFiles(deployments: DeploymentsMap, clarinetFolder: string, cwd: string): {
|
|
231
|
+
identifier: string;
|
|
232
|
+
file: string;
|
|
233
|
+
}[];
|
|
234
|
+
declare function afterESM(config: Config): Promise<void>;
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/declaration.d.ts
|
|
237
|
+
declare const jsTypeFromAbiType: (val: ClarityAbiType, isArgument?: boolean) => string;
|
|
238
|
+
declare function abiArgType(arg: ClarityAbiArg): string;
|
|
239
|
+
declare function abiFunctionType(abiFunction: ClarityAbiFunction): string;
|
|
240
|
+
declare function getArgName(name: string): string;
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/utils.d.ts
|
|
243
|
+
declare function encodeVariableName(name: string): string;
|
|
244
|
+
declare function fileExists(filename: string): Promise<boolean>;
|
|
245
|
+
declare function writeFile(path: string, contents: string): Promise<string>;
|
|
246
|
+
declare function cwdRelative(path: string): string;
|
|
247
|
+
declare function sortContracts<T extends {
|
|
248
|
+
contract_id: string;
|
|
249
|
+
}>(contracts: T[]): T[];
|
|
250
|
+
//#endregion
|
|
251
|
+
export { CONFIG_FILE, ClaridocContract, ClaridocFunction, ClaridocItem, ClaridocMap, ClaridocParam, ClaridocVariable, ClarinetConfig, Comments, Config, ConfigFile, ContractDeployments, DEPLOYMENT_NETWORKS, DeploymentNetwork, EpochType, FN_TYPES, FullContractDeployments, OutputType, Session, SessionAccount, SessionContract, SessionWithVariables, TYPE_IMPORTS, VAR_TYPES, abiArgType, abiFunctionType, afterDocs, afterESM, collectContractDeployments, collectDeploymentFiles, configFilePath, createContractDocInfo, cwdRelative, defaultConfigFile, encodeVariableName, encodeVariables, fileExists, generateBaseFile, generateContractMeta, generateDocs, generateESMFile, generateMarkdown, generateReadme, getArgName, getClarinetConfig, getConfig, getDeployments, getFnName, getVariablesV2, isComment, jsTypeFromAbiType, mapVariables, markdownFunction, parseComments, parseDeployment, saveConfig, serialize, sortContracts, traceParens, writeFile };
|
|
252
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { A as generateMarkdown, B as afterDocs, C as OutputType, D as saveConfig, E as getConfig, F as fileExists, G as traceParens, H as getFnName, I as sortContracts, L as writeFile, M as markdownFunction, N as cwdRelative, O as ClarinetConfig, P as encodeVariableName, R as FN_TYPES, S as ConfigFile, T as defaultConfigFile, U as isComment, V as createContractDocInfo, W as parseComments, _ as getArgName, a as generateESMFile, b as CONFIG_FILE, c as getVariablesV2, d as encodeVariables, f as generateBaseFile, g as abiFunctionType, h as abiArgType, i as collectDeploymentFiles, j as generateReadme, k as getClarinetConfig, l as mapVariables, m as serialize, n as afterESM, o as getDeployments, p as generateContractMeta, r as collectContractDeployments, s as parseDeployment, t as DEPLOYMENT_NETWORKS, u as TYPE_IMPORTS, v as jsTypeFromAbiType, w as configFilePath, x as Config, y as generateDocs, z as VAR_TYPES } from "./esm-CO92uOgU.mjs";
|
|
2
|
+
|
|
3
|
+
export { CONFIG_FILE, ClarinetConfig, Config, ConfigFile, DEPLOYMENT_NETWORKS, FN_TYPES, OutputType, TYPE_IMPORTS, VAR_TYPES, abiArgType, abiFunctionType, afterDocs, afterESM, collectContractDeployments, collectDeploymentFiles, configFilePath, createContractDocInfo, cwdRelative, defaultConfigFile, encodeVariableName, encodeVariables, fileExists, generateBaseFile, generateContractMeta, generateDocs, generateESMFile, generateMarkdown, generateReadme, getArgName, getClarinetConfig, getConfig, getDeployments, getFnName, getVariablesV2, isComment, jsTypeFromAbiType, mapVariables, markdownFunction, parseComments, parseDeployment, saveConfig, serialize, sortContracts, traceParens, writeFile };
|