ic-mops 0.39.2 → 0.40.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.
Files changed (229) hide show
  1. package/.eslintrc.json +0 -0
  2. package/.gitignore +1 -0
  3. package/README.md +0 -0
  4. package/api/actors.ts +2 -2
  5. package/api/downloadPackageFiles.ts +9 -6
  6. package/api/getHighestVersion.ts +1 -1
  7. package/api/index.ts +0 -0
  8. package/api/network.ts +1 -1
  9. package/api/resolveVersion.ts +1 -1
  10. package/cache.ts +3 -3
  11. package/cli.ts +3 -2
  12. package/commands/add.ts +6 -6
  13. package/commands/available-updates.ts +2 -2
  14. package/commands/bench/bench-canister.mo +0 -0
  15. package/commands/bench/user-bench.mo +0 -0
  16. package/commands/bench-replica.ts +10 -10
  17. package/commands/bench.ts +96 -56
  18. package/commands/bump.ts +2 -2
  19. package/commands/docs.ts +1 -1
  20. package/commands/import-identity.ts +2 -2
  21. package/commands/init.ts +9 -9
  22. package/commands/install-all.ts +4 -4
  23. package/commands/install-local.ts +1 -1
  24. package/commands/install.ts +2 -2
  25. package/commands/outdated.ts +0 -0
  26. package/commands/publish.ts +34 -9
  27. package/commands/remove.ts +8 -8
  28. package/commands/search.ts +2 -2
  29. package/commands/sources.ts +0 -0
  30. package/commands/sync.ts +8 -8
  31. package/commands/template.ts +2 -2
  32. package/commands/test/mmf1.ts +18 -18
  33. package/commands/test/reporters/compact-reporter.ts +5 -5
  34. package/commands/test/reporters/files-reporter.ts +3 -3
  35. package/commands/test/reporters/reporter.ts +3 -3
  36. package/commands/test/reporters/silent-reporter.ts +4 -4
  37. package/commands/test/reporters/verbose-reporter.ts +3 -3
  38. package/commands/test/test.ts +10 -10
  39. package/commands/test/utils.ts +1 -1
  40. package/commands/toolchain/index.ts +9 -9
  41. package/commands/toolchain/moc.ts +2 -2
  42. package/commands/toolchain/pocket-ic.ts +6 -31
  43. package/commands/toolchain/toolchain-utils.ts +11 -11
  44. package/commands/toolchain/wasmtime.ts +2 -2
  45. package/commands/transfer-ownership.ts +2 -2
  46. package/commands/update.ts +4 -4
  47. package/commands/user.ts +2 -2
  48. package/commands/whoami.ts +0 -0
  49. package/declarations/bench/bench.did.d.ts +3 -0
  50. package/declarations/main/main.did +27 -1
  51. package/declarations/main/main.did.d.ts +26 -1
  52. package/declarations/main/main.did.js +27 -1
  53. package/declarations/storage/index.d.ts +0 -0
  54. package/declarations/storage/index.js +0 -0
  55. package/declarations/storage/storage.did +0 -0
  56. package/declarations/storage/storage.did.d.ts +0 -0
  57. package/declarations/storage/storage.did.js +0 -0
  58. package/dist/api/actors.d.ts +0 -0
  59. package/dist/api/actors.js +0 -0
  60. package/dist/api/downloadPackageFiles.d.ts +1 -1
  61. package/dist/api/downloadPackageFiles.js +4 -0
  62. package/dist/api/getHighestVersion.d.ts +0 -0
  63. package/dist/api/getHighestVersion.js +0 -0
  64. package/dist/api/index.d.ts +0 -0
  65. package/dist/api/index.js +0 -0
  66. package/dist/api/network.d.ts +0 -0
  67. package/dist/api/network.js +0 -0
  68. package/dist/api/resolveVersion.d.ts +0 -0
  69. package/dist/api/resolveVersion.js +0 -0
  70. package/dist/bin/moc-wrapper.sh +3 -0
  71. package/dist/bin/mops.d.ts +0 -0
  72. package/dist/bin/mops.js +0 -0
  73. package/dist/bundle-package-json.d.ts +1 -0
  74. package/dist/bundle-package-json.js +11 -0
  75. package/dist/cache.d.ts +0 -0
  76. package/dist/cache.js +0 -0
  77. package/dist/cli.d.ts +0 -0
  78. package/dist/cli.js +1 -0
  79. package/dist/commands/add.d.ts +0 -0
  80. package/dist/commands/add.js +0 -0
  81. package/dist/commands/available-updates.d.ts +0 -0
  82. package/dist/commands/available-updates.js +0 -0
  83. package/dist/commands/bench/bench-canister.mo +0 -0
  84. package/dist/commands/bench/user-bench.mo +0 -0
  85. package/dist/commands/bench-replica.d.ts +3 -1
  86. package/dist/commands/bench-replica.js +2 -2
  87. package/dist/commands/bench.d.ts +5 -2
  88. package/dist/commands/bench.js +66 -29
  89. package/dist/commands/bump.d.ts +0 -0
  90. package/dist/commands/bump.js +0 -0
  91. package/dist/commands/docs.d.ts +0 -0
  92. package/dist/commands/docs.js +0 -0
  93. package/dist/commands/import-identity.d.ts +0 -0
  94. package/dist/commands/import-identity.js +0 -0
  95. package/dist/commands/init.d.ts +0 -0
  96. package/dist/commands/init.js +1 -1
  97. package/dist/commands/install-all.d.ts +0 -0
  98. package/dist/commands/install-all.js +0 -0
  99. package/dist/commands/install-local.d.ts +0 -0
  100. package/dist/commands/install-local.js +0 -0
  101. package/dist/commands/install.d.ts +0 -0
  102. package/dist/commands/install.js +0 -0
  103. package/dist/commands/outdated.d.ts +0 -0
  104. package/dist/commands/outdated.js +0 -0
  105. package/dist/commands/publish.d.ts +1 -0
  106. package/dist/commands/publish.js +24 -1
  107. package/dist/commands/remove.d.ts +0 -0
  108. package/dist/commands/remove.js +0 -0
  109. package/dist/commands/search.d.ts +0 -0
  110. package/dist/commands/search.js +0 -0
  111. package/dist/commands/self-update.d.ts +0 -0
  112. package/dist/commands/self-update.js +0 -0
  113. package/dist/commands/self.d.ts +3 -0
  114. package/dist/commands/self.js +62 -0
  115. package/dist/commands/sources.d.ts +0 -0
  116. package/dist/commands/sources.js +0 -0
  117. package/dist/commands/sync.d.ts +0 -0
  118. package/dist/commands/sync.js +0 -0
  119. package/dist/commands/template.d.ts +0 -0
  120. package/dist/commands/template.js +0 -0
  121. package/dist/commands/test/mmf1.d.ts +0 -0
  122. package/dist/commands/test/mmf1.js +1 -1
  123. package/dist/commands/test/reporters/compact-reporter.d.ts +0 -0
  124. package/dist/commands/test/reporters/compact-reporter.js +0 -0
  125. package/dist/commands/test/reporters/files-reporter.d.ts +0 -0
  126. package/dist/commands/test/reporters/files-reporter.js +0 -0
  127. package/dist/commands/test/reporters/reporter.d.ts +0 -0
  128. package/dist/commands/test/reporters/reporter.js +0 -0
  129. package/dist/commands/test/reporters/silent-reporter.d.ts +0 -0
  130. package/dist/commands/test/reporters/silent-reporter.js +0 -0
  131. package/dist/commands/test/reporters/verbose-reporter.d.ts +0 -0
  132. package/dist/commands/test/reporters/verbose-reporter.js +0 -0
  133. package/dist/commands/test/test.d.ts +0 -0
  134. package/dist/commands/test/test.js +2 -2
  135. package/dist/commands/test/utils.d.ts +0 -0
  136. package/dist/commands/test/utils.js +0 -0
  137. package/dist/commands/toolchain/index.d.ts +0 -0
  138. package/dist/commands/toolchain/index.js +0 -0
  139. package/dist/commands/toolchain/moc.d.ts +0 -0
  140. package/dist/commands/toolchain/moc.js +0 -0
  141. package/dist/commands/toolchain/pocket-ic.d.ts +1 -5
  142. package/dist/commands/toolchain/pocket-ic.js +4 -27
  143. package/dist/commands/toolchain/toolchain-utils.d.ts +1 -1
  144. package/dist/commands/toolchain/toolchain-utils.js +7 -7
  145. package/dist/commands/toolchain/wasmtime.d.ts +0 -0
  146. package/dist/commands/toolchain/wasmtime.js +0 -0
  147. package/dist/commands/transfer-ownership.d.ts +0 -0
  148. package/dist/commands/transfer-ownership.js +1 -1
  149. package/dist/commands/update.d.ts +0 -0
  150. package/dist/commands/update.js +0 -0
  151. package/dist/commands/user.d.ts +0 -0
  152. package/dist/commands/user.js +0 -0
  153. package/dist/commands/whoami.d.ts +0 -0
  154. package/dist/commands/whoami.js +0 -0
  155. package/dist/declarations/bench/bench.did +0 -0
  156. package/dist/declarations/bench/bench.did.d.ts +3 -0
  157. package/dist/declarations/bench/bench.did.js +0 -0
  158. package/dist/declarations/bench/index.d.ts +0 -0
  159. package/dist/declarations/bench/index.js +0 -0
  160. package/dist/declarations/main/index.d.ts +0 -0
  161. package/dist/declarations/main/index.js +0 -0
  162. package/dist/declarations/main/main.did +27 -1
  163. package/dist/declarations/main/main.did.d.ts +26 -1
  164. package/dist/declarations/main/main.did.js +27 -1
  165. package/dist/declarations/storage/index.d.ts +0 -0
  166. package/dist/declarations/storage/index.js +0 -0
  167. package/dist/declarations/storage/storage.did +0 -0
  168. package/dist/declarations/storage/storage.did.d.ts +0 -0
  169. package/dist/declarations/storage/storage.did.js +0 -0
  170. package/dist/helpers/find-changelog-entry.d.ts +1 -0
  171. package/dist/helpers/find-changelog-entry.js +24 -0
  172. package/dist/helpers/get-dfx-version.d.ts +0 -0
  173. package/dist/helpers/get-dfx-version.js +0 -0
  174. package/dist/helpers/get-moc-path.d.ts +0 -0
  175. package/dist/helpers/get-moc-path.js +0 -0
  176. package/dist/helpers/get-moc-version.d.ts +0 -0
  177. package/dist/helpers/get-moc-version.js +0 -0
  178. package/dist/integrity.d.ts +0 -0
  179. package/dist/integrity.js +0 -0
  180. package/dist/mops.d.ts +0 -0
  181. package/dist/mops.js +1 -1
  182. package/dist/notify-installs.d.ts +0 -0
  183. package/dist/notify-installs.js +0 -0
  184. package/dist/package.json +1 -1
  185. package/dist/parallel.d.ts +0 -0
  186. package/dist/parallel.js +0 -0
  187. package/dist/pem.d.ts +0 -0
  188. package/dist/pem.js +0 -0
  189. package/dist/release-cli.d.ts +1 -0
  190. package/dist/release-cli.js +35 -0
  191. package/dist/remove-scripts.d.ts +1 -0
  192. package/dist/remove-scripts.js +5 -0
  193. package/dist/resolve-packages.d.ts +0 -0
  194. package/dist/resolve-packages.js +0 -0
  195. package/dist/templates/README.md +0 -0
  196. package/dist/templates/licenses/Apache-2.0 +0 -0
  197. package/dist/templates/licenses/Apache-2.0-NOTICE +0 -0
  198. package/dist/templates/licenses/MIT +0 -0
  199. package/dist/templates/mops-publish.yml +0 -0
  200. package/dist/templates/mops-test.yml +0 -0
  201. package/dist/templates/src/lib.mo +0 -0
  202. package/dist/templates/test/lib.test.mo +0 -0
  203. package/dist/types.d.ts +0 -0
  204. package/dist/types.js +0 -0
  205. package/dist/vessel.d.ts +0 -0
  206. package/dist/vessel.js +1 -1
  207. package/global.d.ts +0 -0
  208. package/helpers/get-dfx-version.ts +1 -1
  209. package/helpers/get-moc-path.ts +1 -1
  210. package/helpers/get-moc-version.ts +1 -1
  211. package/integrity.ts +16 -16
  212. package/mops.ts +17 -17
  213. package/notify-installs.ts +2 -2
  214. package/package.json +1 -1
  215. package/parallel.ts +1 -1
  216. package/pem.ts +5 -5
  217. package/resolve-packages.ts +9 -9
  218. package/templates/README.md +0 -0
  219. package/templates/licenses/Apache-2.0 +0 -0
  220. package/templates/licenses/Apache-2.0-NOTICE +0 -0
  221. package/templates/licenses/MIT +0 -0
  222. package/templates/mops-publish.yml +0 -0
  223. package/templates/mops-test.yml +0 -0
  224. package/templates/src/lib.mo +0 -0
  225. package/templates/test/lib.test.mo +0 -0
  226. package/types.ts +25 -25
  227. package/vessel.ts +16 -16
  228. package/dist/commands/replica.d.ts +0 -36
  229. package/dist/commands/replica.js +0 -103
File without changes
File without changes
File without changes
@@ -1,5 +1,6 @@
1
1
  import type { Principal } from '@dfinity/principal';
2
2
  import type { ActorMethod } from '@dfinity/agent';
3
+ import type { IDL } from '@dfinity/candid';
3
4
 
4
5
  export interface BenchResult {
5
6
  'instructions' : bigint,
@@ -24,3 +25,5 @@ export interface anon_class_10_1 {
24
25
  'runCellUpdateAwait' : ActorMethod<[bigint, bigint], BenchResult>,
25
26
  }
26
27
  export interface _SERVICE extends anon_class_10_1 {}
28
+ export declare const idlFactory: IDL.InterfaceFactory;
29
+ export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -216,6 +216,7 @@ type PackageFileStatsPublic =
216
216
  };
217
217
  type PackageDetails =
218
218
  record {
219
+ benchmarks: Benchmarks__1;
219
220
  changes: PackageChanges;
220
221
  config: PackageConfigV2__1;
221
222
  dependents: vec PackageSummary__1;
@@ -273,9 +274,11 @@ type PackageConfigV2 =
273
274
  };
274
275
  type PackageChanges =
275
276
  record {
277
+ curBenchmarks: Benchmarks__1;
276
278
  deps: vec DepChange;
277
279
  devDeps: vec DepChange;
278
280
  notes: text;
281
+ prevBenchmarks: Benchmarks__1;
279
282
  tests: TestsChanges;
280
283
  };
281
284
  type Main =
@@ -303,6 +306,7 @@ type Main =
303
306
  blob;
304
307
  };
305
308
  });
309
+ getFileHashesQuery: (PackageName, PackageVersion) -> (Result_8) query;
306
310
  getFileIds: (PackageName, PackageVersion) -> (Result_7) query;
307
311
  getHighestSemverBatch:
308
312
  (vec record {
@@ -333,13 +337,14 @@ type Main =
333
337
  PackageName;
334
338
  PackageVersion;
335
339
  }) -> () oneway;
336
- restore: (nat, nat) -> ();
340
+ restore: (nat) -> ();
337
341
  search: (Text, opt nat, opt nat) -> (vec PackageSummary, PageCount) query;
338
342
  setUserProp: (text, text) -> (Result_1);
339
343
  startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
340
344
  startPublish: (PackageConfigV2) -> (Result_2);
341
345
  transferOwnership: (PackageName, principal) -> (Result_1);
342
346
  transformRequest: (HttpTransformArg) -> (HttpResponse) query;
347
+ uploadBenchmarks: (PublishingId, Benchmarks) -> (Result);
343
348
  uploadFileChunk: (PublishingId, FileId, nat, blob) -> (Result);
344
349
  uploadNotes: (PublishingId, text) -> (Result);
345
350
  uploadTestStats: (PublishingId, TestStats) -> (Result);
@@ -397,4 +402,25 @@ type DepChange =
397
402
  newVersion: text;
398
403
  oldVersion: text;
399
404
  };
405
+ type Benchmarks__1 = vec Benchmark;
406
+ type Benchmarks = vec Benchmark;
407
+ type BenchmarkMetric = text;
408
+ type Benchmark =
409
+ record {
410
+ cols: vec text;
411
+ compiler: text;
412
+ compilerVersion: text;
413
+ description: text;
414
+ file: text;
415
+ forceGC: bool;
416
+ gc: text;
417
+ metrics: vec record {
418
+ BenchmarkMetric;
419
+ vec vec int;
420
+ };
421
+ name: text;
422
+ replica: text;
423
+ replicaVersion: text;
424
+ rows: vec text;
425
+ };
400
426
  service : () -> Main
@@ -1,6 +1,24 @@
1
1
  import type { Principal } from '@dfinity/principal';
2
2
  import type { ActorMethod } from '@dfinity/agent';
3
+ import type { IDL } from '@dfinity/candid';
3
4
 
5
+ export interface Benchmark {
6
+ 'gc' : string,
7
+ 'metrics' : Array<[BenchmarkMetric, Array<Array<bigint>>]>,
8
+ 'cols' : Array<string>,
9
+ 'file' : string,
10
+ 'name' : string,
11
+ 'rows' : Array<string>,
12
+ 'description' : string,
13
+ 'compilerVersion' : string,
14
+ 'compiler' : string,
15
+ 'replica' : string,
16
+ 'replicaVersion' : string,
17
+ 'forceGC' : boolean,
18
+ }
19
+ export type BenchmarkMetric = string;
20
+ export type Benchmarks = Array<Benchmark>;
21
+ export type Benchmarks__1 = Array<Benchmark>;
4
22
  export interface DepChange {
5
23
  'oldVersion' : string,
6
24
  'name' : string,
@@ -60,6 +78,7 @@ export interface Main {
60
78
  [Array<PackageId>],
61
79
  Array<[PackageId, Array<[FileId, Uint8Array | number[]]>]>
62
80
  >,
81
+ 'getFileHashesQuery' : ActorMethod<[PackageName, PackageVersion], Result_8>,
63
82
  'getFileIds' : ActorMethod<[PackageName, PackageVersion], Result_7>,
64
83
  'getHighestSemverBatch' : ActorMethod<
65
84
  [Array<[PackageName, PackageVersion, SemverPart]>],
@@ -88,7 +107,7 @@ export interface Main {
88
107
  [Array<[PackageName, PackageVersion]>],
89
108
  undefined
90
109
  >,
91
- 'restore' : ActorMethod<[bigint, bigint], undefined>,
110
+ 'restore' : ActorMethod<[bigint], undefined>,
92
111
  'search' : ActorMethod<
93
112
  [Text, [] | [bigint], [] | [bigint]],
94
113
  [Array<PackageSummary>, PageCount]
@@ -101,6 +120,7 @@ export interface Main {
101
120
  'startPublish' : ActorMethod<[PackageConfigV2], Result_2>,
102
121
  'transferOwnership' : ActorMethod<[PackageName, Principal], Result_1>,
103
122
  'transformRequest' : ActorMethod<[HttpTransformArg], HttpResponse>,
123
+ 'uploadBenchmarks' : ActorMethod<[PublishingId, Benchmarks], Result>,
104
124
  'uploadFileChunk' : ActorMethod<
105
125
  [PublishingId, FileId, bigint, Uint8Array | number[]],
106
126
  Result
@@ -111,6 +131,8 @@ export interface Main {
111
131
  export interface PackageChanges {
112
132
  'tests' : TestsChanges,
113
133
  'deps' : Array<DepChange>,
134
+ 'curBenchmarks' : Benchmarks__1,
135
+ 'prevBenchmarks' : Benchmarks__1,
114
136
  'notes' : string,
115
137
  'devDeps' : Array<DepChange>,
116
138
  }
@@ -151,6 +173,7 @@ export interface PackageConfigV2__1 {
151
173
  'readme' : string,
152
174
  }
153
175
  export interface PackageDetails {
176
+ 'benchmarks' : Benchmarks__1,
154
177
  'ownerInfo' : User,
155
178
  'owner' : Principal,
156
179
  'deps' : Array<PackageSummary__1>,
@@ -325,3 +348,5 @@ export interface User__1 {
325
348
  'github' : string,
326
349
  }
327
350
  export interface _SERVICE extends Main {}
351
+ export declare const idlFactory: IDL.InterfaceFactory;
352
+ export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
@@ -95,6 +95,22 @@ export const idlFactory = ({ IDL }) => {
95
95
  'config' : PackageConfigV2__1,
96
96
  'publication' : PackagePublication,
97
97
  });
98
+ const BenchmarkMetric = IDL.Text;
99
+ const Benchmark = IDL.Record({
100
+ 'gc' : IDL.Text,
101
+ 'metrics' : IDL.Vec(IDL.Tuple(BenchmarkMetric, IDL.Vec(IDL.Vec(IDL.Int)))),
102
+ 'cols' : IDL.Vec(IDL.Text),
103
+ 'file' : IDL.Text,
104
+ 'name' : IDL.Text,
105
+ 'rows' : IDL.Vec(IDL.Text),
106
+ 'description' : IDL.Text,
107
+ 'compilerVersion' : IDL.Text,
108
+ 'compiler' : IDL.Text,
109
+ 'replica' : IDL.Text,
110
+ 'replicaVersion' : IDL.Text,
111
+ 'forceGC' : IDL.Bool,
112
+ });
113
+ const Benchmarks__1 = IDL.Vec(Benchmark);
98
114
  const PackageSummary__1 = IDL.Record({
99
115
  'ownerInfo' : User,
100
116
  'owner' : IDL.Principal,
@@ -130,6 +146,8 @@ export const idlFactory = ({ IDL }) => {
130
146
  const PackageChanges = IDL.Record({
131
147
  'tests' : TestsChanges,
132
148
  'deps' : IDL.Vec(DepChange),
149
+ 'curBenchmarks' : Benchmarks__1,
150
+ 'prevBenchmarks' : Benchmarks__1,
133
151
  'notes' : IDL.Text,
134
152
  'devDeps' : IDL.Vec(DepChange),
135
153
  });
@@ -145,6 +163,7 @@ export const idlFactory = ({ IDL }) => {
145
163
  'publication' : PackagePublication,
146
164
  });
147
165
  const PackageDetails = IDL.Record({
166
+ 'benchmarks' : Benchmarks__1,
148
167
  'ownerInfo' : User,
149
168
  'owner' : IDL.Principal,
150
169
  'deps' : IDL.Vec(PackageSummary__1),
@@ -255,6 +274,7 @@ export const idlFactory = ({ IDL }) => {
255
274
  'context' : IDL.Vec(IDL.Nat8),
256
275
  'response' : HttpResponse,
257
276
  });
277
+ const Benchmarks = IDL.Vec(Benchmark);
258
278
  const TestStats = IDL.Record({
259
279
  'passedNames' : IDL.Vec(IDL.Text),
260
280
  'passed' : IDL.Nat,
@@ -290,6 +310,11 @@ export const idlFactory = ({ IDL }) => {
290
310
  ],
291
311
  [],
292
312
  ),
313
+ 'getFileHashesQuery' : IDL.Func(
314
+ [PackageName, PackageVersion],
315
+ [Result_8],
316
+ ['query'],
317
+ ),
293
318
  'getFileIds' : IDL.Func(
294
319
  [PackageName, PackageVersion],
295
320
  [Result_7],
@@ -342,7 +367,7 @@ export const idlFactory = ({ IDL }) => {
342
367
  [],
343
368
  ['oneway'],
344
369
  ),
345
- 'restore' : IDL.Func([IDL.Nat, IDL.Nat], [], []),
370
+ 'restore' : IDL.Func([IDL.Nat], [], []),
346
371
  'search' : IDL.Func(
347
372
  [Text, IDL.Opt(IDL.Nat), IDL.Opt(IDL.Nat)],
348
373
  [IDL.Vec(PackageSummary), PageCount],
@@ -365,6 +390,7 @@ export const idlFactory = ({ IDL }) => {
365
390
  [HttpResponse],
366
391
  ['query'],
367
392
  ),
393
+ 'uploadBenchmarks' : IDL.Func([PublishingId, Benchmarks], [Result], []),
368
394
  'uploadFileChunk' : IDL.Func(
369
395
  [PublishingId, FileId, IDL.Nat, IDL.Vec(IDL.Nat8)],
370
396
  [Result],
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ export declare function findChangelogEntry(changelog: string, version: string): string;
@@ -0,0 +1,24 @@
1
+ import { fromMarkdown } from 'mdast-util-from-markdown';
2
+ import { toMarkdown } from 'mdast-util-to-markdown';
3
+ export function findChangelogEntry(changelog, version) {
4
+ let tree = fromMarkdown(changelog);
5
+ let found = false;
6
+ let nodes = [];
7
+ for (let node of tree.children) {
8
+ if (found) {
9
+ if (node.type === 'heading') {
10
+ break;
11
+ }
12
+ else {
13
+ nodes.push(node);
14
+ }
15
+ }
16
+ else if (node.type === 'heading' && toMarkdown(node).match(new RegExp(`\\b${version}\\b`))) {
17
+ found = true;
18
+ }
19
+ }
20
+ return toMarkdown({
21
+ type: 'root',
22
+ children: nodes,
23
+ });
24
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/integrity.js CHANGED
File without changes
package/dist/mops.d.ts CHANGED
File without changes
package/dist/mops.js CHANGED
@@ -82,7 +82,7 @@ export let getIdentity = async () => {
82
82
  let res = await prompts({
83
83
  type: 'invisible',
84
84
  name: 'value',
85
- message: 'Enter password:'
85
+ message: 'Enter password:',
86
86
  });
87
87
  return await decodeFile(identityPemEncrypted, res.value);
88
88
  }
File without changes
File without changes
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.39.2",
3
+ "version": "0.40.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/bin/mops.js",
File without changes
package/dist/parallel.js CHANGED
File without changes
package/dist/pem.d.ts CHANGED
File without changes
package/dist/pem.js CHANGED
File without changes
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ /* eslint-disable no-undef */
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { URL } from 'node:url';
5
+ import { execSync } from 'node:child_process';
6
+ import semver from 'semver';
7
+ import { sha256 } from '@noble/hashes/sha256';
8
+ import { bytesToHex } from '@noble/hashes/utils';
9
+ import { findChangelogEntry } from './helpers/find-changelog-entry.js';
10
+ let __dirname = new URL('.', import.meta.url).pathname;
11
+ execSync('npm run prepare', { stdio: 'inherit', cwd: __dirname });
12
+ execSync('npm run bundle', { stdio: 'inherit', cwd: __dirname });
13
+ let version = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json'), 'utf8')).version;
14
+ let major = semver.parse(version)?.major;
15
+ let tag = semver.parse(version)?.prerelease[0] || 'latest';
16
+ let releaseNotes = findChangelogEntry(fs.readFileSync(path.resolve(__dirname, 'CHANGELOG.md'), 'utf8'), version);
17
+ let hash = bytesToHex(sha256(fs.readFileSync(path.resolve(__dirname, 'bundle/cli.tgz'))));
18
+ fs.cpSync(path.resolve(__dirname, 'bundle/cli.tgz'), path.resolve(__dirname, `../cli-releases/versions/${version}/cli.tgz`), { force: false, errorOnExist: true });
19
+ fs.writeFileSync(path.resolve(__dirname, `../cli-releases/versions/${version}/RELEASE_NOTES.md`), releaseNotes);
20
+ fs.writeFileSync(path.resolve(__dirname, `../cli-releases/versions/${version}/cli.tgz.sha256`), hash);
21
+ fs.cpSync(path.resolve(__dirname, `../cli-releases/versions/${version}`), path.resolve(__dirname, `../cli-releases/versions/${tag}`), { force: true, errorOnExist: false, recursive: true });
22
+ fs.cpSync(path.resolve(__dirname, `../cli-releases/versions/${version}`), path.resolve(__dirname, `../cli-releases/versions/${major}`), { force: true, errorOnExist: false, recursive: true });
23
+ fs.writeFileSync(path.resolve(__dirname, `../cli-releases/tags/${tag}`), version);
24
+ console.log(`Release '${version}' created with tag '${tag}'`);
25
+ if (!fs.existsSync(path.resolve(__dirname, '../cli-releases/releases.json'))) {
26
+ fs.writeFileSync(path.resolve(__dirname, '../cli-releases/releases.json'), JSON.stringify({ tags: {}, versions: {} }, null, 2));
27
+ }
28
+ let releases = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../cli-releases/releases.json'), 'utf8'));
29
+ releases.tags[tag] = version;
30
+ releases.versions[version] = {
31
+ relseaseNotes: releaseNotes,
32
+ hash,
33
+ url: `https://cli.mops.one/versions/${version}/cli.tgz`,
34
+ };
35
+ fs.writeFileSync(path.resolve(__dirname, '../cli-releases/releases.json'), JSON.stringify(releases, null, 2));
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+ let text = readFileSync('dist/package.json', 'utf8');
3
+ let json = JSON.parse(text);
4
+ delete json.scripts;
5
+ writeFileSync('dist/package.json', JSON.stringify(json, null, 2));
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/types.d.ts CHANGED
File without changes
package/dist/types.js CHANGED
File without changes
package/dist/vessel.d.ts CHANGED
File without changes
package/dist/vessel.js CHANGED
@@ -37,7 +37,7 @@ export const readVesselConfig = async (dir, { cache = true, silent = false } = {
37
37
  }
38
38
  const [vessel, packageSetArray] = await Promise.all([
39
39
  dhallFileToJson((dir || process.cwd()) + '/vessel.dhall', silent),
40
- dhallFileToJson((dir || process.cwd()) + '/package-set.dhall', silent)
40
+ dhallFileToJson((dir || process.cwd()) + '/package-set.dhall', silent),
41
41
  ]);
42
42
  if (!vessel || !packageSetArray) {
43
43
  return null;
package/global.d.ts CHANGED
File without changes
@@ -1,6 +1,6 @@
1
1
  import {execSync} from 'node:child_process';
2
2
 
3
- export function getDfxVersion(): string {
3
+ export function getDfxVersion() : string {
4
4
  try {
5
5
  let res = execSync('dfx --version').toString();
6
6
  return res.trim().split('dfx ')[1] || '';
@@ -1,6 +1,6 @@
1
1
  import {execSync} from 'node:child_process';
2
2
 
3
- export function getMocPath(): string {
3
+ export function getMocPath() : string {
4
4
  let mocPath = process.env.DFX_MOC_PATH;
5
5
  if (!mocPath) {
6
6
  mocPath = execSync('dfx cache show').toString().trim() + '/moc';
@@ -1,7 +1,7 @@
1
1
  import {execSync} from 'node:child_process';
2
2
  import {getMocPath} from './get-moc-path.js';
3
3
 
4
- export function getMocVersion(): string {
4
+ export function getMocVersion() : string {
5
5
  let mocPath = getMocPath();
6
6
  let match = execSync(mocPath).toString().trim().match(/Motoko compiler ([^\s]+) .*/);
7
7
  return match?.[1] || '';
package/integrity.ts CHANGED
@@ -7,24 +7,24 @@ import {mainActor} from './api/actors.js';
7
7
  import {resolvePackages} from './resolve-packages.js';
8
8
 
9
9
  type LockFileGeneric = {
10
- version: number;
10
+ version : number;
11
11
  };
12
12
 
13
13
  type LockFileV1 = {
14
- version: 1;
15
- mopsTomlHash: string;
16
- hashes: Record<string, Record<string, string>>;
14
+ version : 1;
15
+ mopsTomlHash : string;
16
+ hashes : Record<string, Record<string, string>>;
17
17
  };
18
18
 
19
19
  type LockFileV2 = {
20
- version: 2;
21
- mopsTomlDepsHash: string;
22
- hashes: Record<string, Record<string, string>>;
20
+ version : 2;
21
+ mopsTomlDepsHash : string;
22
+ hashes : Record<string, Record<string, string>>;
23
23
  };
24
24
 
25
25
  type LockFile = LockFileV1 | LockFileV2;
26
26
 
27
- export async function checkIntegrity(lock?: 'check' | 'update' | 'ignore') {
27
+ export async function checkIntegrity(lock ?: 'check' | 'update' | 'ignore') {
28
28
  let force = !!lock;
29
29
 
30
30
  if (!lock && !process.env['CI'] && fs.existsSync(path.join(getRootDir(), 'mops.lock'))) {
@@ -44,14 +44,14 @@ export async function checkIntegrity(lock?: 'check' | 'update' | 'ignore') {
44
44
  }
45
45
  }
46
46
 
47
- async function getFileHashesFromRegistry(): Promise<[string, [string, Uint8Array | number[]][]][]> {
47
+ async function getFileHashesFromRegistry() : Promise<[string, [string, Uint8Array | number[]][]][]> {
48
48
  let packageIds = await getResolvedMopsPackageIds();
49
49
  let actor = await mainActor();
50
50
  let fileHashesByPackageIds = await actor.getFileHashesByPackageIds(packageIds);
51
51
  return fileHashesByPackageIds;
52
52
  }
53
53
 
54
- async function getResolvedMopsPackageIds(): Promise<string[]> {
54
+ async function getResolvedMopsPackageIds() : Promise<string[]> {
55
55
  let resolvedPackages = await resolvePackages();
56
56
  let packageIds = Object.entries(resolvedPackages)
57
57
  .filter(([_, version]) => getDependencyType(version) === 'mops')
@@ -60,7 +60,7 @@ async function getResolvedMopsPackageIds(): Promise<string[]> {
60
60
  }
61
61
 
62
62
  // get hash of local file from '.mops' dir by fileId
63
- export function getLocalFileHash(fileId: string): string {
63
+ export function getLocalFileHash(fileId : string) : string {
64
64
  let rootDir = getRootDir();
65
65
  let file = path.join(rootDir, '.mops', fileId);
66
66
  if (!fs.existsSync(file)) {
@@ -71,11 +71,11 @@ export function getLocalFileHash(fileId: string): string {
71
71
  return bytesToHex(sha256(fileData));
72
72
  }
73
73
 
74
- function getMopsTomlHash(): string {
74
+ function getMopsTomlHash() : string {
75
75
  return bytesToHex(sha256(fs.readFileSync(getRootDir() + '/mops.toml')));
76
76
  }
77
77
 
78
- function getMopsTomlDepsHash(): string {
78
+ function getMopsTomlDepsHash() : string {
79
79
  let config = readConfig();
80
80
  let deps = config.dependencies || {};
81
81
  let devDeps = config['dev-dependencies'] || {};
@@ -113,7 +113,7 @@ export async function updateLockFile() {
113
113
 
114
114
  // if lock file exists and mops.toml hasn't changed, don't update it
115
115
  if (fs.existsSync(lockFile)) {
116
- let lockFileJson: LockFileV2 = JSON.parse(fs.readFileSync(lockFile).toString());
116
+ let lockFileJson : LockFileV2 = JSON.parse(fs.readFileSync(lockFile).toString());
117
117
  let mopsTomlDepsHash = getMopsTomlDepsHash();
118
118
  if (mopsTomlDepsHash === lockFileJson.mopsTomlDepsHash) {
119
119
  return;
@@ -122,7 +122,7 @@ export async function updateLockFile() {
122
122
 
123
123
  let fileHashes = await getFileHashesFromRegistry();
124
124
 
125
- let lockFileJson: LockFileV2 = {
125
+ let lockFileJson : LockFileV2 = {
126
126
  version: 2,
127
127
  mopsTomlDepsHash: getMopsTomlDepsHash(),
128
128
  hashes: fileHashes.reduce((acc, [packageId, fileHashes]) => {
@@ -151,7 +151,7 @@ export async function checkLockFile(force = false) {
151
151
  return;
152
152
  }
153
153
 
154
- let lockFileJsonGeneric: LockFileGeneric = JSON.parse(fs.readFileSync(lockFile).toString());
154
+ let lockFileJsonGeneric : LockFileGeneric = JSON.parse(fs.readFileSync(lockFile).toString());
155
155
  let packageIds = await getResolvedMopsPackageIds();
156
156
 
157
157
  // check lock file version