@clarigen/cli 2.1.1 → 2.1.3

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 CHANGED
@@ -1,38 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
6
  var __getProtoOf = Object.getPrototypeOf;
9
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __objRest = (source, exclude) => {
25
- var target = {};
26
- for (var prop in source)
27
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
- target[prop] = source[prop];
29
- if (source != null && __getOwnPropSymbols)
30
- for (var prop of __getOwnPropSymbols(source)) {
31
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
- target[prop] = source[prop];
33
- }
34
- return target;
35
- };
36
8
  var __export = (target, all) => {
37
9
  for (var name in all)
38
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -45,7 +17,14 @@ var __copyProps = (to, from, except, desc) => {
45
17
  }
46
18
  return to;
47
19
  };
48
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
49
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
50
29
 
51
30
  // src/index.ts
@@ -112,12 +91,14 @@ var import_core2 = require("@clarigen/core");
112
91
  var import_pino = require("pino");
113
92
  var import_pino_pretty = __toESM(require("pino-pretty"), 1);
114
93
  var colorizedClarigen = `\x1B[33m[Clarigen]\x1B[0m`;
115
- var logger = (0, import_pino.pino)((0, import_pino_pretty.default)({
116
- colorize: true,
117
- ignore: "pid,hostname,time",
118
- messageFormat: `${colorizedClarigen} {msg}`,
119
- minimumLevel: "debug"
120
- }));
94
+ var logger = (0, import_pino.pino)(
95
+ (0, import_pino_pretty.default)({
96
+ colorize: true,
97
+ ignore: "pid,hostname,time",
98
+ messageFormat: `${colorizedClarigen} {msg}`,
99
+ minimumLevel: "debug"
100
+ })
101
+ );
121
102
  logger.level = "info";
122
103
  var log = logger;
123
104
 
@@ -213,8 +194,7 @@ function findItemNameFromLine(line) {
213
194
  }
214
195
  for (const type of VAR_TYPES) {
215
196
  const prefix = `(define-${type} `;
216
- if (!line.startsWith(prefix))
217
- continue;
197
+ if (!line.startsWith(prefix)) continue;
218
198
  const startString = line.slice(prefix.length);
219
199
  const match = clarityNameMatcher(startString);
220
200
  if (!match) {
@@ -230,11 +210,9 @@ function findAbiItemByName(abi, name) {
230
210
  const fn = abi.functions.find((fn2) => {
231
211
  return fn2.name === name;
232
212
  });
233
- if (fn)
234
- return fn;
213
+ if (fn) return fn;
235
214
  const map = abi.maps.find((m) => m.name === name);
236
- if (map)
237
- return map;
215
+ if (map) return map;
238
216
  const v = abi.variables.find((v2) => v2.name === name);
239
217
  return v;
240
218
  }
@@ -245,8 +223,7 @@ function getFnName(line) {
245
223
  const fnType = FN_TYPES.find((type) => {
246
224
  return line.startsWith(`(define-${type}`);
247
225
  });
248
- if (typeof fnType === "undefined")
249
- return;
226
+ if (typeof fnType === "undefined") return;
250
227
  const prefix = `(define-${fnType} (`;
251
228
  const startString = line.slice(prefix.length);
252
229
  const match = clarityNameMatcher(startString);
@@ -260,10 +237,8 @@ function getFnName(line) {
260
237
  function traceParens(line, count) {
261
238
  let newCount = count;
262
239
  line.split("").forEach((char) => {
263
- if (char === "(")
264
- newCount++;
265
- if (char === ")")
266
- newCount--;
240
+ if (char === "(") newCount++;
241
+ if (char === ")") newCount--;
267
242
  });
268
243
  return newCount;
269
244
  }
@@ -284,8 +259,7 @@ function parseComments(comments, abi) {
284
259
  }
285
260
  return;
286
261
  }
287
- if (!("args" in abi))
288
- return;
262
+ if (!("args" in abi)) return;
289
263
  const [_full, name, _separator, rest] = paramMatches;
290
264
  const arg = abi.args.find((arg2) => arg2.name === name);
291
265
  if (!arg) {
@@ -313,8 +287,7 @@ function parseComments(comments, abi) {
313
287
  async function afterDocs(config) {
314
288
  var _a;
315
289
  const command = (_a = config.docs) == null ? void 0 : _a.after;
316
- if (!command)
317
- return;
290
+ if (!command) return;
318
291
  logger.debug(`Running after docs command: ${command}`);
319
292
  const parts = command.split(" ");
320
293
  const [cmd, ...args] = parts;
@@ -342,8 +315,7 @@ var import_core = require("@clarigen/core");
342
315
  var import_promises = require("fs/promises");
343
316
  var import_path = require("path");
344
317
  function encodeVariableName(name) {
345
- if (/^[A-Z\-_]*$/.test(name))
346
- return name.replaceAll("-", "_");
318
+ if (/^[A-Z\-_]*$/.test(name)) return name.replaceAll("-", "_");
347
319
  return (0, import_core.toCamelCase)(name);
348
320
  }
349
321
  async function fileExists(filename) {
@@ -438,7 +410,9 @@ ${fn.source.join("\n")}
438
410
  \`\`\`
439
411
  </details>
440
412
  `;
441
- const sig = `(define-${fn.abi.access.replace("_", "-")} (${fn.abi.name} (${paramSigs.join(" ")}) ${returnType})`;
413
+ const sig = `(define-${fn.abi.access.replace("_", "-")} (${fn.abi.name} (${paramSigs.join(
414
+ " "
415
+ )}) ${returnType})`;
442
416
  return `### ${fn.abi.name}
443
417
 
444
418
  ${link}
@@ -452,8 +426,7 @@ ${source}
452
426
  ${params}`;
453
427
  }
454
428
  function mdParams(fn) {
455
- if (fn.abi.args.length === 0)
456
- return "";
429
+ if (fn.abi.args.length === 0) return "";
457
430
  const hasDescription = Object.values(fn.comments.params).some((p) => p.comments.length > 0);
458
431
  const params = Object.values(fn.comments.params).map((p) => markdownParam(p, hasDescription));
459
432
  return `**Parameters:**
@@ -465,8 +438,7 @@ ${params.join("\n")}`;
465
438
  function markdownParam(param, withDescription) {
466
439
  const typeString = (0, import_core2.getTypeString)(param.abi.type);
467
440
  const base = `| ${param.abi.name} | ${typeString} |`;
468
- if (!withDescription)
469
- return base;
441
+ if (!withDescription) return base;
470
442
  return `${base} ${param.comments.join(" ")} |`;
471
443
  }
472
444
  function markdownMap(map, contractFile) {
@@ -544,8 +516,7 @@ function generateReadme(session, excluded) {
544
516
  const contractLines = [];
545
517
  sortContracts(session.contracts).forEach((contract) => {
546
518
  const name = (0, import_core2.getContractName)(contract.contract_id, false);
547
- if (excluded[name])
548
- return;
519
+ if (excluded[name]) return;
549
520
  const fileName = `${name}.md`;
550
521
  const line = `- [\`${name}\`](${fileName})`;
551
522
  contractLines.push(line);
@@ -593,7 +564,8 @@ var typesSchema = import_zod2.z.object({
593
564
  outputs: import_zod2.z.array(import_zod2.z.string()).optional(),
594
565
  include_accounts: import_zod2.z.boolean().optional(),
595
566
  after: import_zod2.z.string().optional(),
596
- include_boot_contracts: import_zod2.z.boolean().optional()
567
+ include_boot_contracts: import_zod2.z.boolean().optional(),
568
+ watch_folders: import_zod2.z.array(import_zod2.z.string()).optional()
597
569
  }).optional();
598
570
  var ConfigFileSchema = import_zod2.z.object({
599
571
  clarinet: import_zod2.z.string(),
@@ -631,26 +603,25 @@ var Config = class {
631
603
  var _a, _b;
632
604
  const singlePath = (_a = this.configFile[type]) == null ? void 0 : _a.output;
633
605
  const multiPath = ((_b = this.configFile[type]) == null ? void 0 : _b.outputs) || [];
634
- if (singlePath !== void 0)
635
- return [singlePath];
606
+ if (singlePath !== void 0) return [singlePath];
636
607
  return multiPath;
637
608
  }
638
609
  outputResolve(type, filePath) {
639
610
  const outputs = this.getOutputs(type);
640
- if (!this.supports(type))
641
- return null;
611
+ if (!this.supports(type)) return null;
642
612
  return outputs.map((path) => {
643
613
  return (0, import_path3.resolve)(this.cwd, path, filePath || "");
644
614
  });
645
615
  }
646
616
  async writeOutput(type, contents, filePath) {
647
617
  const paths = this.outputResolve(type, filePath);
648
- if (paths === null)
649
- return null;
650
- await Promise.all(paths.map(async (path) => {
651
- await writeFile(path, contents);
652
- log.debug(`Generated ${type} file at ${(0, import_path3.relative)(this.cwd, path)}`);
653
- }));
618
+ if (paths === null) return null;
619
+ await Promise.all(
620
+ paths.map(async (path) => {
621
+ await writeFile(path, contents);
622
+ log.debug(`Generated ${type} file at ${(0, import_path3.relative)(this.cwd, path)}`);
623
+ })
624
+ );
654
625
  return paths;
655
626
  }
656
627
  supports(type) {
@@ -677,13 +648,12 @@ function configFilePath(cwd) {
677
648
  return (0, import_path3.resolve)(cwd ?? process.cwd(), CONFIG_FILE);
678
649
  }
679
650
  async function saveConfig(config) {
680
- const configToml = (0, import_toml2.stringify)(__spreadValues({}, config));
651
+ const configToml = (0, import_toml2.stringify)({ ...config });
681
652
  await writeFile(configFilePath(), configToml);
682
653
  }
683
654
  var sessionConfig;
684
655
  async function getConfig(cwd) {
685
- if (typeof sessionConfig !== "undefined")
686
- return sessionConfig;
656
+ if (typeof sessionConfig !== "undefined") return sessionConfig;
687
657
  const path = configFilePath(cwd);
688
658
  if (await fileExists(path)) {
689
659
  const toml = await (0, import_promises3.readFile)(path, "utf-8");
@@ -721,42 +691,47 @@ async function generateDocs({
721
691
  if (docsPathExt) {
722
692
  log.warn(`Docs output path ('${docsBase}') looks like a file - it needs to be a directory.`);
723
693
  }
724
- const excluded = Object.fromEntries((docs.exclude || []).map((e) => {
725
- return [e, true];
726
- }));
694
+ const excluded = Object.fromEntries(
695
+ (docs.exclude || []).map((e) => {
696
+ return [e, true];
697
+ })
698
+ );
727
699
  log.debug(`Generating docs at path \`${docsBase}\``);
728
700
  const docsBaseFolder = config.outputResolve("docs" /* Docs */, "./")[0];
729
- const paths = await Promise.all(session.contracts.map(async (contract) => {
730
- var _a, _b;
731
- const name = (0, import_core3.getContractName)(contract.contract_id, false);
732
- if (excluded[name])
733
- return null;
734
- const docFile = `${name}.md`;
735
- const contractPathDef = (_b = (_a = config.clarinet.contracts) == null ? void 0 : _a[name]) == null ? void 0 : _b.path;
736
- let contractFile;
737
- if (contractPathDef) {
738
- const contractPathFull = config.joinFromClarinet(contractPathDef);
739
- contractFile = (0, import_path4.relative)(docsBaseFolder, contractPathFull);
740
- } else {
741
- log.debug(`Couldn't find contract file from Clarinet.toml for contract ${name}`);
742
- }
743
- const md = generateMarkdown({ contract, contractFile });
744
- const path = await config.writeOutput("docs" /* Docs */, md, docFile);
745
- return path[0];
746
- }));
701
+ const paths = await Promise.all(
702
+ session.contracts.map(async (contract) => {
703
+ var _a, _b;
704
+ const name = (0, import_core3.getContractName)(contract.contract_id, false);
705
+ if (excluded[name]) return null;
706
+ const docFile = `${name}.md`;
707
+ const contractPathDef = (_b = (_a = config.clarinet.contracts) == null ? void 0 : _a[name]) == null ? void 0 : _b.path;
708
+ let contractFile;
709
+ if (contractPathDef) {
710
+ const contractPathFull = config.joinFromClarinet(contractPathDef);
711
+ contractFile = (0, import_path4.relative)(docsBaseFolder, contractPathFull);
712
+ } else {
713
+ log.debug(`Couldn't find contract file from Clarinet.toml for contract ${name}`);
714
+ }
715
+ const md = generateMarkdown({ contract, contractFile });
716
+ const path = await config.writeOutput("docs" /* Docs */, md, docFile);
717
+ return path[0];
718
+ })
719
+ );
747
720
  const readme = generateReadme(session, excluded);
748
721
  paths.push((await config.writeOutput("docs" /* Docs */, readme, "README.md"))[0]);
749
722
  await afterDocs(config);
750
723
  }
751
724
  function warnNoDocs() {
752
- log.warn(`
725
+ log.warn(
726
+ `
753
727
  Clarigen config file doesn't include an output directory for docs.
754
728
 
755
729
  To generate docs, specify 'docs.output' in your config file:
756
730
 
757
731
  [docs]
758
732
  output = "docs/"
759
- `.trimEnd());
733
+ `.trimEnd()
734
+ );
760
735
  }
761
736
 
762
737
  // src/files/variables.ts
@@ -768,12 +743,10 @@ var import_core5 = require("@clarigen/core");
768
743
  var jsTypeFromAbiType = (val, isArgument = false) => {
769
744
  if ((0, import_core4.isClarityAbiPrimitive)(val)) {
770
745
  if (val === "uint128") {
771
- if (isArgument)
772
- return "number | bigint";
746
+ if (isArgument) return "number | bigint";
773
747
  return "bigint";
774
748
  } else if (val === "int128") {
775
- if (isArgument)
776
- return "number | bigint";
749
+ if (isArgument) return "number | bigint";
777
750
  return "bigint";
778
751
  } else if (val === "bool") {
779
752
  return "boolean";
@@ -841,7 +814,50 @@ function _hash(...words) {
841
814
  }
842
815
  return h;
843
816
  }
844
- var RESERVED = _hash("break", "do", "in", "typeof", "case", "else", "instanceof", "var", "catch", "export", "new", "void", "class", "extends", "return", "while", "const", "finally", "super", "with", "continue", "for", "switch", "yield", "debugger", "function", "this", "default", "if", "throw", "delete", "import", "try", "enum", "await", "null", "true", "false");
817
+ var RESERVED = _hash(
818
+ // Keywords, ES6 11.6.2.1, http://www.ecma-international.org/ecma-262/6.0/index.html#sec-keywords
819
+ "break",
820
+ "do",
821
+ "in",
822
+ "typeof",
823
+ "case",
824
+ "else",
825
+ "instanceof",
826
+ "var",
827
+ "catch",
828
+ "export",
829
+ "new",
830
+ "void",
831
+ "class",
832
+ "extends",
833
+ "return",
834
+ "while",
835
+ "const",
836
+ "finally",
837
+ "super",
838
+ "with",
839
+ "continue",
840
+ "for",
841
+ "switch",
842
+ "yield",
843
+ "debugger",
844
+ "function",
845
+ "this",
846
+ "default",
847
+ "if",
848
+ "throw",
849
+ "delete",
850
+ "import",
851
+ "try",
852
+ // Future Reserved Words, ES6 11.6.2.2
853
+ // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-future-reserved-words
854
+ "enum",
855
+ "await",
856
+ // NullLiteral & BooleanLiteral
857
+ "null",
858
+ "true",
859
+ "false"
860
+ );
845
861
 
846
862
  // src/files/base.ts
847
863
  var import_core7 = require("@clarigen/core");
@@ -849,10 +865,12 @@ var import_core7 = require("@clarigen/core");
849
865
  // src/files/accounts.ts
850
866
  function generateAccountsCode(accounts) {
851
867
  const sortedAccounts = sortAccounts(accounts);
852
- const namedAccounts = Object.fromEntries(sortedAccounts.map((a) => {
853
- const _a = a, { name } = _a, rest = __objRest(_a, ["name"]);
854
- return [name, rest];
855
- }));
868
+ const namedAccounts = Object.fromEntries(
869
+ sortedAccounts.map((a) => {
870
+ const { name, ...rest } = a;
871
+ return [name, rest];
872
+ })
873
+ );
856
874
  return JSON.stringify(namedAccounts);
857
875
  }
858
876
  function sortAccounts(accounts) {
@@ -868,10 +886,12 @@ function sortAccounts(accounts) {
868
886
  // src/files/identifiers.ts
869
887
  var import_core6 = require("@clarigen/core");
870
888
  function generateIdentifiers(session) {
871
- const identifiers = Object.fromEntries(sortContracts(session.contracts).map((c) => {
872
- const contractName = (0, import_core6.getContractName)(c.contract_id);
873
- return [contractName, c.contract_id];
874
- }));
889
+ const identifiers = Object.fromEntries(
890
+ sortContracts(session.contracts).map((c) => {
891
+ const contractName = (0, import_core6.getContractName)(c.contract_id);
892
+ return [contractName, c.contract_id];
893
+ })
894
+ );
875
895
  return identifiers;
876
896
  }
877
897
  function generateIdentifiersCode(session) {
@@ -884,7 +904,7 @@ var import_util = require("util");
884
904
  function generateContractMeta(contract, constants) {
885
905
  const abi = contract.contract_interface;
886
906
  const functionLines = [];
887
- const _a = abi, { functions, maps, variables, non_fungible_tokens } = _a, rest = __objRest(_a, ["functions", "maps", "variables", "non_fungible_tokens"]);
907
+ const { functions, maps, variables, non_fungible_tokens, ...rest } = abi;
888
908
  functions.forEach((func) => {
889
909
  let functionLine = `${(0, import_core7.toCamelCase)(func.name)}: `;
890
910
  const funcDef = JSON.stringify(func);
@@ -919,7 +939,8 @@ function generateContractMeta(contract, constants) {
919
939
  }
920
940
  var TYPE_IMPORTS = `import type { TypedAbiArg, TypedAbiFunction, TypedAbiMap, TypedAbiVariable, Response } from '@clarigen/core';`;
921
941
  function generateBaseFile(session) {
922
- const combined = session.contracts.map((c, i) => __spreadProps(__spreadValues({}, c), {
942
+ const combined = session.contracts.map((c, i) => ({
943
+ ...c,
923
944
  constants: session.variables[i]
924
945
  }));
925
946
  const contractDefs = sortContracts(combined).map((contract) => {
@@ -962,14 +983,20 @@ Uint8Array.prototype[import_util.inspect.custom] = function(depth, options) {
962
983
  };
963
984
  function serialize(obj) {
964
985
  return (0, import_util.inspect)(obj, {
986
+ // showHidden: false,
987
+ // depth: 100,
988
+ // colors: false,
965
989
  showHidden: false,
990
+ // iterableLimit: 100000,
966
991
  compact: false,
992
+ // trailingComma: true,
967
993
  depth: 100,
968
994
  colors: false,
969
995
  maxArrayLength: Infinity,
970
996
  maxStringLength: Infinity,
971
997
  breakLength: Infinity,
972
998
  numericSeparator: true
999
+ // strAbbreviateSize: 100000,
973
1000
  });
974
1001
  }
975
1002
  function serializeLines(key, lines) {
@@ -989,7 +1016,9 @@ function getVariablesV2(contract, simnet, verbose) {
989
1016
  const fakeId = `${(0, import_core8.getContractName)(contract.contract_id)}-vars`;
990
1017
  logger.debug(`Deploying ${contract.contract_id} for variables.`);
991
1018
  if (!contract.source) {
992
- logger.debug(`Contract ${(0, import_core8.getContractName)(contract.contract_id)} has no source. Skipping variables.`);
1019
+ logger.debug(
1020
+ `Contract ${(0, import_core8.getContractName)(contract.contract_id)} has no source. Skipping variables.`
1021
+ );
993
1022
  return {};
994
1023
  }
995
1024
  if (contract.contract_interface.variables.length === 0) {
@@ -1013,9 +1042,14 @@ function getVariablesV2(contract, simnet, verbose) {
1013
1042
 
1014
1043
  ${varFn}`;
1015
1044
  try {
1016
- const receipt = simnet.deployContract(fakeId, fullSrc, {
1017
- clarityVersion: 3
1018
- }, deployer);
1045
+ const receipt = simnet.deployContract(
1046
+ fakeId,
1047
+ fullSrc,
1048
+ {
1049
+ clarityVersion: 3
1050
+ },
1051
+ deployer
1052
+ );
1019
1053
  const result = receipt.result;
1020
1054
  const varsAbi = {
1021
1055
  tuple: []
@@ -1032,10 +1066,10 @@ ${varFn}`;
1032
1066
  }
1033
1067
  return (0, import_core8.cvToValue)(result, true);
1034
1068
  } catch (error) {
1035
- logger.error(`Error getting variables for ${(0, import_core8.getContractName)(contract.contract_id, false)}`);
1036
- logger.error(`Source code: ${contract.source} with type ${String(typeof contract.source)}`);
1037
- logger.error(error);
1038
- logger.error(fullSrc);
1069
+ logger.warn(
1070
+ { err: error },
1071
+ `Error getting variables for ${(0, import_core8.getContractName)(contract.contract_id, false)}`
1072
+ );
1039
1073
  return {};
1040
1074
  }
1041
1075
  }
@@ -1064,8 +1098,7 @@ function getContractTxs(batches) {
1064
1098
  function getDeploymentContract(contractName, deployment) {
1065
1099
  const txs = flatBatch(deployment.plan.batches);
1066
1100
  for (const tx of txs) {
1067
- if (!isContractTx(tx))
1068
- continue;
1101
+ if (!isContractTx(tx)) continue;
1069
1102
  if ("requirement-publish" in tx) {
1070
1103
  const [_, name] = tx["requirement-publish"]["contract-id"].split(".");
1071
1104
  if (name === contractName) {
@@ -1117,12 +1150,9 @@ function getIdentifier(tx) {
1117
1150
  throw new Error(`Unable to find ID for contract.`);
1118
1151
  }
1119
1152
  function isContractTx(tx) {
1120
- if ("contract-call" in tx)
1121
- return false;
1122
- if ("btc-transfer" in tx)
1123
- return false;
1124
- if ("emulated-contract-call" in tx)
1125
- return false;
1153
+ if ("contract-call" in tx) return false;
1154
+ if ("btc-transfer" in tx) return false;
1155
+ if ("emulated-contract-call" in tx) return false;
1126
1156
  return true;
1127
1157
  }
1128
1158
 
@@ -1136,16 +1166,18 @@ async function parseDeployment(path) {
1136
1166
  }
1137
1167
  var DEPLOYMENT_NETWORKS = ["devnet", "simnet", "testnet", "mainnet"];
1138
1168
  async function getDeployments(config) {
1139
- const entries = await Promise.all(DEPLOYMENT_NETWORKS.map(async (network) => {
1140
- const file = `default.${network}-plan.yaml`;
1141
- const path = (0, import_path5.join)((0, import_path5.dirname)(config.clarinetFile()), "deployments", file);
1142
- let plan;
1143
- try {
1144
- plan = await parseDeployment(path);
1145
- } catch (_) {
1146
- }
1147
- return [network, plan];
1148
- }));
1169
+ const entries = await Promise.all(
1170
+ DEPLOYMENT_NETWORKS.map(async (network) => {
1171
+ const file = `default.${network}-plan.yaml`;
1172
+ const path = (0, import_path5.join)((0, import_path5.dirname)(config.clarinetFile()), "deployments", file);
1173
+ let plan;
1174
+ try {
1175
+ plan = await parseDeployment(path);
1176
+ } catch (_) {
1177
+ }
1178
+ return [network, plan];
1179
+ })
1180
+ );
1149
1181
  return Object.fromEntries(entries);
1150
1182
  }
1151
1183
  async function generateESMFile({
@@ -1176,24 +1208,28 @@ function insertNetworkId(deployments, identifier, network) {
1176
1208
  }
1177
1209
  function collectContractDeployments(session, deployments, config) {
1178
1210
  var _a;
1179
- const full = Object.fromEntries(sortContracts(session.contracts).map((contract) => {
1180
- const contractName = (0, import_core9.getContractName)(contract.contract_id);
1181
- const contractDeployments = Object.fromEntries(DEPLOYMENT_NETWORKS.map((network) => {
1182
- const deployment = deployments[network];
1183
- if (typeof deployment === "undefined") {
1184
- return [network, null];
1185
- }
1186
- try {
1187
- const contractName2 = contract.contract_id.split(".")[1];
1188
- const tx = getDeploymentContract(contractName2, deployment);
1189
- const id = getIdentifier(tx);
1190
- return [network, id];
1191
- } catch (_) {
1192
- return [network, null];
1193
- }
1194
- }));
1195
- return [contractName, contractDeployments];
1196
- }));
1211
+ const full = Object.fromEntries(
1212
+ sortContracts(session.contracts).map((contract) => {
1213
+ const contractName = (0, import_core9.getContractName)(contract.contract_id);
1214
+ const contractDeployments = Object.fromEntries(
1215
+ DEPLOYMENT_NETWORKS.map((network) => {
1216
+ const deployment = deployments[network];
1217
+ if (typeof deployment === "undefined") {
1218
+ return [network, null];
1219
+ }
1220
+ try {
1221
+ const contractName2 = contract.contract_id.split(".")[1];
1222
+ const tx = getDeploymentContract(contractName2, deployment);
1223
+ const id = getIdentifier(tx);
1224
+ return [network, id];
1225
+ } catch (_) {
1226
+ return [network, null];
1227
+ }
1228
+ })
1229
+ );
1230
+ return [contractName, contractDeployments];
1231
+ })
1232
+ );
1197
1233
  const deployer = session.accounts.find((a) => a.name === "deployer");
1198
1234
  (_a = config.clarinet.project.requirements) == null ? void 0 : _a.forEach(({ contract_id }) => {
1199
1235
  insertNetworkId(full, contract_id, "mainnet");
@@ -1210,8 +1246,7 @@ function collectContractDeployments(session, deployments, config) {
1210
1246
  return full;
1211
1247
  }
1212
1248
  function collectDeploymentFiles(deployments, clarinetFolder, cwd) {
1213
- if (!deployments.simnet)
1214
- return [];
1249
+ if (!deployments.simnet) return [];
1215
1250
  const simnet = deployments.simnet;
1216
1251
  const txs = getContractTxs(simnet.plan.batches);
1217
1252
  const entries = txs.map((tx) => {
@@ -1226,8 +1261,7 @@ function collectDeploymentFiles(deployments, clarinetFolder, cwd) {
1226
1261
  }
1227
1262
  function generateSimnetCode(config, deployments, _session) {
1228
1263
  var _a;
1229
- if (!((_a = config.esm) == null ? void 0 : _a.include_accounts))
1230
- return "";
1264
+ if (!((_a = config.esm) == null ? void 0 : _a.include_accounts)) return "";
1231
1265
  const clarinetFolder = (0, import_path5.dirname)(config.clarinetFile());
1232
1266
  const files = collectDeploymentFiles(deployments, clarinetFolder, config.cwd);
1233
1267
  return `
@@ -1237,8 +1271,7 @@ export const simnetDeployment = ${JSON.stringify(files)};
1237
1271
  async function afterESM(config) {
1238
1272
  var _a;
1239
1273
  const command = (_a = config.esm) == null ? void 0 : _a.after;
1240
- if (!command)
1241
- return;
1274
+ if (!command) return;
1242
1275
  logger.debug(`Running after ESM command: ${command}`);
1243
1276
  const parts = command.split(" ");
1244
1277
  const [cmd, ...args] = parts;