ic-mops 0.40.0 → 0.41.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.
Files changed (193) hide show
  1. package/.DS_Store +0 -0
  2. package/.npmrc +2 -1
  3. package/CHANGELOG.md +8 -0
  4. package/DEVELOPMENT.md +25 -0
  5. package/bundle/bench/bench-canister.mo +87 -0
  6. package/bundle/bench/user-bench.mo +14 -0
  7. package/bundle/bin/moc-wrapper.sh +3 -0
  8. package/bundle/bin/mops.js +3 -0
  9. package/bundle/cli.js +88 -0
  10. package/bundle/cli.tgz +0 -0
  11. package/bundle/declarations/bench/bench.did +26 -0
  12. package/bundle/declarations/bench/bench.did.d.ts +29 -0
  13. package/bundle/declarations/bench/bench.did.js +26 -0
  14. package/bundle/declarations/bench/index.d.ts +50 -0
  15. package/bundle/declarations/bench/index.js +40 -0
  16. package/bundle/declarations/main/index.d.ts +50 -0
  17. package/bundle/declarations/main/index.js +40 -0
  18. package/bundle/declarations/main/main.did +433 -0
  19. package/bundle/declarations/main/main.did.d.ts +355 -0
  20. package/bundle/declarations/main/main.did.js +407 -0
  21. package/bundle/declarations/storage/index.d.ts +50 -0
  22. package/bundle/declarations/storage/index.js +30 -0
  23. package/bundle/declarations/storage/storage.did +46 -0
  24. package/bundle/declarations/storage/storage.did.d.ts +37 -0
  25. package/bundle/declarations/storage/storage.did.js +38 -0
  26. package/bundle/package.json +31 -0
  27. package/bundle/templates/README.md +13 -0
  28. package/bundle/templates/licenses/Apache-2.0 +202 -0
  29. package/bundle/templates/licenses/Apache-2.0-NOTICE +13 -0
  30. package/bundle/templates/licenses/MIT +21 -0
  31. package/bundle/templates/mops-publish.yml +17 -0
  32. package/bundle/templates/mops-test.yml +22 -0
  33. package/bundle/templates/src/lib.mo +15 -0
  34. package/bundle/templates/test/lib.test.mo +4 -0
  35. package/bundle-package-json.ts +17 -0
  36. package/check-requirements.ts +50 -0
  37. package/cli.ts +22 -19
  38. package/commands/add.ts +4 -0
  39. package/commands/install-all.ts +2 -0
  40. package/commands/publish.ts +18 -30
  41. package/commands/self.ts +75 -0
  42. package/commands/template.ts +9 -10
  43. package/commands/toolchain/index.ts +7 -0
  44. package/declarations/bench/bench.did.d.ts +1 -1
  45. package/declarations/bench/index.js +1 -2
  46. package/declarations/main/index.js +1 -2
  47. package/declarations/main/main.did +15 -8
  48. package/declarations/main/main.did.d.ts +12 -9
  49. package/declarations/main/main.did.js +11 -8
  50. package/dist/api/actors.d.ts +0 -0
  51. package/dist/api/actors.js +0 -0
  52. package/dist/api/downloadPackageFiles.d.ts +0 -0
  53. package/dist/api/downloadPackageFiles.js +0 -0
  54. package/dist/api/getHighestVersion.d.ts +0 -0
  55. package/dist/api/getHighestVersion.js +0 -0
  56. package/dist/api/index.d.ts +0 -0
  57. package/dist/api/index.js +0 -0
  58. package/dist/api/network.d.ts +0 -0
  59. package/dist/api/network.js +0 -0
  60. package/dist/api/resolveVersion.d.ts +0 -0
  61. package/dist/api/resolveVersion.js +0 -0
  62. package/dist/bin/mops.d.ts +1 -1
  63. package/dist/bin/mops.js +2 -1
  64. package/dist/bundle-package-json.d.ts +0 -0
  65. package/dist/bundle-package-json.js +2 -0
  66. package/dist/cache.d.ts +0 -0
  67. package/dist/cache.js +0 -0
  68. package/dist/check-requirements.d.ts +3 -0
  69. package/dist/check-requirements.js +44 -0
  70. package/dist/cli.d.ts +0 -0
  71. package/dist/cli.js +18 -18
  72. package/dist/commands/add.d.ts +0 -0
  73. package/dist/commands/add.js +2 -0
  74. package/dist/commands/available-updates.d.ts +0 -0
  75. package/dist/commands/available-updates.js +0 -0
  76. package/dist/commands/bench-replica.d.ts +0 -0
  77. package/dist/commands/bench-replica.js +0 -0
  78. package/dist/commands/bench.d.ts +0 -0
  79. package/dist/commands/bench.js +0 -0
  80. package/dist/commands/bump.d.ts +0 -0
  81. package/dist/commands/bump.js +0 -0
  82. package/dist/commands/docs.d.ts +0 -0
  83. package/dist/commands/docs.js +0 -0
  84. package/dist/commands/import-identity.d.ts +0 -0
  85. package/dist/commands/import-identity.js +0 -0
  86. package/dist/commands/init.d.ts +0 -0
  87. package/dist/commands/init.js +0 -0
  88. package/dist/commands/install-all.d.ts +0 -0
  89. package/dist/commands/install-all.js +2 -0
  90. package/dist/commands/install-local.d.ts +0 -0
  91. package/dist/commands/install-local.js +0 -0
  92. package/dist/commands/install.d.ts +0 -0
  93. package/dist/commands/install.js +0 -0
  94. package/dist/commands/outdated.d.ts +0 -0
  95. package/dist/commands/outdated.js +0 -0
  96. package/dist/commands/publish.d.ts +0 -0
  97. package/dist/commands/publish.js +14 -25
  98. package/dist/commands/remove.d.ts +0 -0
  99. package/dist/commands/remove.js +0 -0
  100. package/dist/commands/search.d.ts +0 -0
  101. package/dist/commands/search.js +0 -0
  102. package/dist/commands/self.js +1 -1
  103. package/dist/commands/sources.d.ts +0 -0
  104. package/dist/commands/sources.js +0 -0
  105. package/dist/commands/sync.d.ts +0 -0
  106. package/dist/commands/sync.js +0 -0
  107. package/dist/commands/template.d.ts +0 -0
  108. package/dist/commands/template.js +9 -10
  109. package/dist/commands/test/mmf1.d.ts +0 -0
  110. package/dist/commands/test/mmf1.js +0 -0
  111. package/dist/commands/test/reporters/compact-reporter.d.ts +0 -0
  112. package/dist/commands/test/reporters/compact-reporter.js +0 -0
  113. package/dist/commands/test/reporters/files-reporter.d.ts +0 -0
  114. package/dist/commands/test/reporters/files-reporter.js +0 -0
  115. package/dist/commands/test/reporters/reporter.d.ts +0 -0
  116. package/dist/commands/test/reporters/reporter.js +0 -0
  117. package/dist/commands/test/reporters/silent-reporter.d.ts +0 -0
  118. package/dist/commands/test/reporters/silent-reporter.js +0 -0
  119. package/dist/commands/test/reporters/verbose-reporter.d.ts +0 -0
  120. package/dist/commands/test/reporters/verbose-reporter.js +0 -0
  121. package/dist/commands/test/test.d.ts +0 -0
  122. package/dist/commands/test/test.js +0 -0
  123. package/dist/commands/test/utils.d.ts +0 -0
  124. package/dist/commands/test/utils.js +0 -0
  125. package/dist/commands/toolchain/index.d.ts +0 -0
  126. package/dist/commands/toolchain/index.js +5 -0
  127. package/dist/commands/toolchain/moc.d.ts +0 -0
  128. package/dist/commands/toolchain/moc.js +0 -0
  129. package/dist/commands/toolchain/pocket-ic.d.ts +0 -0
  130. package/dist/commands/toolchain/pocket-ic.js +0 -0
  131. package/dist/commands/toolchain/toolchain-utils.d.ts +0 -0
  132. package/dist/commands/toolchain/toolchain-utils.js +0 -0
  133. package/dist/commands/toolchain/wasmtime.d.ts +0 -0
  134. package/dist/commands/toolchain/wasmtime.js +0 -0
  135. package/dist/commands/transfer-ownership.d.ts +0 -0
  136. package/dist/commands/transfer-ownership.js +0 -0
  137. package/dist/commands/update.d.ts +0 -0
  138. package/dist/commands/update.js +0 -0
  139. package/dist/commands/user.d.ts +0 -0
  140. package/dist/commands/user.js +0 -0
  141. package/dist/commands/whoami.d.ts +0 -0
  142. package/dist/commands/whoami.js +0 -0
  143. package/dist/declarations/bench/bench.did +0 -0
  144. package/dist/declarations/bench/bench.did.d.ts +1 -1
  145. package/dist/declarations/bench/bench.did.js +0 -0
  146. package/dist/declarations/bench/index.d.ts +0 -0
  147. package/dist/declarations/bench/index.js +1 -2
  148. package/dist/declarations/main/index.d.ts +0 -0
  149. package/dist/declarations/main/index.js +1 -2
  150. package/dist/declarations/main/main.did +15 -8
  151. package/dist/declarations/main/main.did.d.ts +12 -9
  152. package/dist/declarations/main/main.did.js +11 -8
  153. package/dist/helpers/find-changelog-entry.d.ts +0 -0
  154. package/dist/helpers/find-changelog-entry.js +0 -0
  155. package/dist/helpers/get-dfx-version.d.ts +0 -0
  156. package/dist/helpers/get-dfx-version.js +0 -0
  157. package/dist/helpers/get-moc-path.d.ts +0 -0
  158. package/dist/helpers/get-moc-path.js +0 -0
  159. package/dist/helpers/get-moc-version.d.ts +0 -0
  160. package/dist/helpers/get-moc-version.js +0 -0
  161. package/dist/integrity.d.ts +0 -0
  162. package/dist/integrity.js +0 -0
  163. package/dist/mops.d.ts +1 -0
  164. package/dist/mops.js +12 -1
  165. package/dist/notify-installs.d.ts +0 -0
  166. package/dist/notify-installs.js +0 -0
  167. package/dist/package.json +18 -24
  168. package/dist/parallel.d.ts +0 -0
  169. package/dist/parallel.js +0 -0
  170. package/dist/pem.d.ts +0 -0
  171. package/dist/pem.js +0 -0
  172. package/dist/release-cli.d.ts +0 -0
  173. package/dist/release-cli.js +13 -7
  174. package/dist/resolve-packages.d.ts +0 -0
  175. package/dist/resolve-packages.js +0 -0
  176. package/dist/templates.d.ts +1 -0
  177. package/dist/templates.js +4 -0
  178. package/dist/types.d.ts +4 -0
  179. package/dist/types.js +0 -0
  180. package/dist/vessel.d.ts +0 -0
  181. package/dist/vessel.js +0 -0
  182. package/helpers/find-changelog-entry.ts +27 -0
  183. package/mops.ts +15 -1
  184. package/package.json +26 -17
  185. package/release-cli.ts +67 -0
  186. package/remove-scripts.ts +6 -0
  187. package/templates.ts +5 -0
  188. package/tsconfig.json +1 -1
  189. package/types.ts +7 -2
  190. package/commands/self-update.ts +0 -6
  191. package/dist/commands/self-update.d.ts +0 -3
  192. package/dist/commands/self-update.js +0 -5
  193. /package/bin/{mops.ts → mops.js} +0 -0
package/.DS_Store ADDED
Binary file
package/.npmrc CHANGED
@@ -1 +1,2 @@
1
- save-exact = true
1
+ save-exact = true
2
+ # omit = optional
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Mops CLI Changelog
2
+
3
+ ## 0.41.0
4
+ - Add `mops self update` command to update the CLI to the latest version
5
+ - Add `mops self uninstall` command to uninstall the CLI
6
+
7
+ ## 0.40.0
8
+ - Publish package benchmarks
package/DEVELOPMENT.md ADDED
@@ -0,0 +1,25 @@
1
+ # Mops CLI
2
+
3
+ 1. Update the version in `package.json` using `npm version` command.
4
+
5
+ 2. Update changelog in `CHANGELOG.md` file.
6
+
7
+ 3. Publish.
8
+
9
+ ## Publish to npm
10
+ ```
11
+ npm publish
12
+ ```
13
+
14
+ ## Publish on chain
15
+
16
+ 1. Prepeare release
17
+ ```
18
+ npm run release
19
+ ```
20
+
21
+ 2. Deploy canister
22
+ (from root of the project)
23
+ ```
24
+ dfx deploy --network ic --no-wallet cli
25
+ ```
@@ -0,0 +1,87 @@
1
+ import Nat64 "mo:base/Nat64";
2
+ import Nat "mo:base/Nat";
3
+ import Debug "mo:base/Debug";
4
+ import ExperimentalInternetComputer "mo:base/ExperimentalInternetComputer";
5
+ import Prim "mo:prim";
6
+ import Bench "mo:bench";
7
+
8
+ import UserBench "./user-bench"; // file path will be replaced with the *.bench.mo file path
9
+
10
+ actor class() {
11
+ var benchOpt : ?Bench.Bench = null;
12
+
13
+ public func init() : async Bench.BenchSchema {
14
+ let bench = UserBench.init();
15
+ benchOpt := ?bench;
16
+ bench.getSchema();
17
+ };
18
+
19
+ public query func getSchema() : async Bench.BenchSchema {
20
+ let ?bench = benchOpt else Debug.trap("bench not initialized");
21
+ bench.getSchema();
22
+ };
23
+
24
+ func _getStats() : Bench.BenchResult {
25
+ {
26
+ instructions = 0;
27
+ rts_heap_size = Prim.rts_heap_size();
28
+ rts_memory_size = Prim.rts_memory_size();
29
+ rts_total_allocation = Prim.rts_total_allocation();
30
+ rts_mutator_instructions = Prim.rts_mutator_instructions();
31
+ rts_collector_instructions = Prim.rts_collector_instructions();
32
+ }
33
+ };
34
+
35
+ func _diffStats(before : Bench.BenchResult, after : Bench.BenchResult) : Bench.BenchResult {
36
+ {
37
+ instructions = after.instructions - before.instructions;
38
+ rts_heap_size = after.rts_heap_size - before.rts_heap_size;
39
+ rts_memory_size = after.rts_memory_size - before.rts_memory_size;
40
+ rts_total_allocation = after.rts_total_allocation - before.rts_total_allocation;
41
+ rts_mutator_instructions = after.rts_mutator_instructions - before.rts_mutator_instructions;
42
+ rts_collector_instructions = after.rts_collector_instructions - before.rts_collector_instructions;
43
+ }
44
+ };
45
+
46
+ func _runCell(rowIndex : Nat, colIndex : Nat) : Bench.BenchResult {
47
+ let ?bench = benchOpt else Debug.trap("bench not initialized");
48
+ let statsBefore = _getStats();
49
+
50
+ let instructions = Nat64.toNat(ExperimentalInternetComputer.countInstructions(func() {
51
+ bench.runCell(rowIndex, colIndex);
52
+ }));
53
+
54
+ let statsAfter = _getStats();
55
+ _diffStats(statsBefore, { statsAfter with instructions });
56
+ };
57
+
58
+ func _runCellAwait(rowIndex : Nat, colIndex : Nat) : async Bench.BenchResult {
59
+ let ?bench = benchOpt else Debug.trap("bench not initialized");
60
+ let statsBefore = _getStats();
61
+
62
+ let instructions = Nat64.toNat(ExperimentalInternetComputer.countInstructions(func() {
63
+ bench.runCell(rowIndex, colIndex);
64
+ }));
65
+
66
+ await (func() : async () {})();
67
+
68
+ let statsAfter = _getStats();
69
+ _diffStats(statsBefore, { statsAfter with instructions });
70
+ };
71
+
72
+ public query func getStats() : async Bench.BenchResult {
73
+ _getStats();
74
+ };
75
+
76
+ public query func runCellQuery(rowIndex : Nat, colIndex : Nat) : async Bench.BenchResult {
77
+ _runCell(rowIndex, colIndex);
78
+ };
79
+
80
+ public func runCellUpdate(rowIndex : Nat, colIndex : Nat) : async Bench.BenchResult {
81
+ _runCell(rowIndex, colIndex);
82
+ };
83
+
84
+ public func runCellUpdateAwait(rowIndex : Nat, colIndex : Nat) : async Bench.BenchResult {
85
+ await _runCellAwait(rowIndex, colIndex);
86
+ };
87
+ };
@@ -0,0 +1,14 @@
1
+ import Nat "mo:base/Nat";
2
+ import Iter "mo:base/Iter";
3
+ import Buffer "mo:base/Buffer";
4
+ import Vector "mo:vector/Class";
5
+ import Bench "mo:bench";
6
+
7
+ // placeholder file that will be replaced with the *.bench.mo file
8
+ module {
9
+ public func init() : Bench.Bench {
10
+ let bench = Bench.Bench();
11
+ // benchmark code goes here...
12
+ bench;
13
+ };
14
+ };
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ mocPath="$(mops toolchain bin moc --fallback)"
3
+ $mocPath "$@"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import '../cli.js';