ic-mops 0.44.1 → 0.45.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 (70) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/bin/moc-wrapper.sh +2 -1
  3. package/bundle/bin/moc-wrapper.sh +2 -1
  4. package/bundle/cli.js +90 -33
  5. package/bundle/cli.tgz +0 -0
  6. package/bundle/declarations/bench/bench.did +2 -2
  7. package/bundle/declarations/bench/bench.did.d.ts +2 -2
  8. package/bundle/declarations/bench/bench.did.js +2 -2
  9. package/bundle/declarations/bench/index.js +8 -0
  10. package/bundle/declarations/main/main.did +5 -0
  11. package/bundle/declarations/main/main.did.d.ts +5 -0
  12. package/bundle/declarations/main/main.did.js +5 -0
  13. package/bundle/package.json +1 -1
  14. package/cache.ts +2 -1
  15. package/check-requirements.ts +2 -1
  16. package/cli.ts +5 -1
  17. package/commands/available-updates.ts +4 -0
  18. package/commands/install/install-mops-dep.ts +7 -5
  19. package/commands/publish.ts +10 -5
  20. package/commands/remove.ts +5 -4
  21. package/declarations/bench/bench.did +2 -2
  22. package/declarations/bench/bench.did.d.ts +2 -2
  23. package/declarations/bench/bench.did.js +2 -2
  24. package/declarations/bench/index.js +8 -0
  25. package/declarations/main/main.did +5 -0
  26. package/declarations/main/main.did.d.ts +5 -0
  27. package/declarations/main/main.did.js +5 -0
  28. package/dist/bin/moc-wrapper.sh +2 -1
  29. package/dist/cache.js +2 -1
  30. package/dist/check-requirements.js +2 -1
  31. package/dist/cli.js +5 -1
  32. package/dist/commands/available-updates.js +3 -0
  33. package/dist/commands/install/install-mops-dep.js +7 -5
  34. package/dist/commands/publish.d.ts +1 -0
  35. package/dist/commands/publish.js +8 -4
  36. package/dist/commands/remove.js +5 -4
  37. package/dist/declarations/bench/bench.did +2 -2
  38. package/dist/declarations/bench/bench.did.d.ts +2 -2
  39. package/dist/declarations/bench/bench.did.js +2 -2
  40. package/dist/declarations/bench/index.js +8 -0
  41. package/dist/declarations/main/main.did +5 -0
  42. package/dist/declarations/main/main.did.d.ts +5 -0
  43. package/dist/declarations/main/main.did.js +5 -0
  44. package/dist/helpers/get-dep-name.d.ts +1 -0
  45. package/dist/helpers/get-dep-name.js +3 -0
  46. package/dist/helpers/get-package-id.d.ts +1 -0
  47. package/dist/helpers/get-package-id.js +4 -0
  48. package/dist/integrity.js +2 -1
  49. package/dist/mops.js +5 -4
  50. package/dist/notify-installs.js +5 -2
  51. package/dist/package.json +1 -1
  52. package/dist/pem.js +1 -1
  53. package/dist/vessel.js +1 -1
  54. package/helpers/get-dep-name.ts +3 -0
  55. package/helpers/get-package-id.ts +5 -0
  56. package/integrity.ts +2 -1
  57. package/mops.ts +5 -4
  58. package/notify-installs.ts +6 -2
  59. package/package.json +2 -2
  60. package/pem.ts +1 -1
  61. package/vessel.ts +1 -1
  62. package/.npmrc +0 -2
  63. package/dist/commands/install-all.d.ts +0 -7
  64. package/dist/commands/install-all.js +0 -45
  65. package/dist/commands/install-local.d.ts +0 -4
  66. package/dist/commands/install-local.js +0 -47
  67. package/dist/commands/install.d.ts +0 -5
  68. package/dist/commands/install.js +0 -109
  69. package/dist/remove-scripts.d.ts +0 -1
  70. package/dist/remove-scripts.js +0 -5
package/bundle/cli.tgz CHANGED
Binary file
@@ -1,4 +1,4 @@
1
- type anon_class_10_1 =
1
+ type _anon_class_10_1 =
2
2
  service {
3
3
  getSchema: () -> (BenchSchema) query;
4
4
  getStats: () -> (BenchResult) query;
@@ -23,4 +23,4 @@ type BenchResult =
23
23
  rts_mutator_instructions: int;
24
24
  rts_total_allocation: int;
25
25
  };
26
- service : () -> anon_class_10_1
26
+ service : () -> _anon_class_10_1
@@ -16,7 +16,7 @@ export interface BenchSchema {
16
16
  'rows' : Array<string>,
17
17
  'description' : string,
18
18
  }
19
- export interface anon_class_10_1 {
19
+ export interface _anon_class_10_1 {
20
20
  'getSchema' : ActorMethod<[], BenchSchema>,
21
21
  'getStats' : ActorMethod<[], BenchResult>,
22
22
  'init' : ActorMethod<[], BenchSchema>,
@@ -24,6 +24,6 @@ export interface anon_class_10_1 {
24
24
  'runCellUpdate' : ActorMethod<[bigint, bigint], BenchResult>,
25
25
  'runCellUpdateAwait' : ActorMethod<[bigint, bigint], BenchResult>,
26
26
  }
27
- export interface _SERVICE extends anon_class_10_1 {}
27
+ export interface _SERVICE extends _anon_class_10_1 {}
28
28
  export declare const idlFactory: IDL.InterfaceFactory;
29
29
  export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -13,7 +13,7 @@ export const idlFactory = ({ IDL }) => {
13
13
  'rts_mutator_instructions' : IDL.Int,
14
14
  'rts_heap_size' : IDL.Int,
15
15
  });
16
- const anon_class_10_1 = IDL.Service({
16
+ const _anon_class_10_1 = IDL.Service({
17
17
  'getSchema' : IDL.Func([], [BenchSchema], ['query']),
18
18
  'getStats' : IDL.Func([], [BenchResult], ['query']),
19
19
  'init' : IDL.Func([], [BenchSchema], []),
@@ -21,6 +21,6 @@ export const idlFactory = ({ IDL }) => {
21
21
  'runCellUpdate' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
22
22
  'runCellUpdateAwait' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
23
23
  });
24
- return anon_class_10_1;
24
+ return _anon_class_10_1;
25
25
  };
26
26
  export const init = ({ IDL }) => { return []; };
@@ -4,6 +4,14 @@ import { Actor, HttpAgent } from "@dfinity/agent";
4
4
  import { idlFactory } from "./bench.did.js";
5
5
  export { idlFactory } from "./bench.did.js";
6
6
 
7
+ /* CANISTER_ID is replaced by webpack based on node environment
8
+ * Note: canister environment variable will be standardized as
9
+ * process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
10
+ * beginning in dfx 0.15.0
11
+ */
12
+ export const canisterId =
13
+ process.env.CANISTER_ID_BENCH;
14
+
7
15
  export const createActor = (canisterId, options = {}) => {
8
16
  const agent = options.agent || new HttpAgent({ ...options.agentOptions });
9
17
 
@@ -151,6 +151,7 @@ type PackageVersion = text;
151
151
  type PackageSummary__1 =
152
152
  record {
153
153
  config: PackageConfigV3;
154
+ depAlias: text;
154
155
  downloadsInLast30Days: nat;
155
156
  downloadsInLast7Days: nat;
156
157
  downloadsTotal: nat;
@@ -163,6 +164,7 @@ type PackageSummaryWithChanges__1 =
163
164
  record {
164
165
  changes: PackageChanges;
165
166
  config: PackageConfigV3;
167
+ depAlias: text;
166
168
  downloadsInLast30Days: nat;
167
169
  downloadsInLast7Days: nat;
168
170
  downloadsTotal: nat;
@@ -175,6 +177,7 @@ type PackageSummaryWithChanges =
175
177
  record {
176
178
  changes: PackageChanges;
177
179
  config: PackageConfigV3;
180
+ depAlias: text;
178
181
  downloadsInLast30Days: nat;
179
182
  downloadsInLast7Days: nat;
180
183
  downloadsTotal: nat;
@@ -186,6 +189,7 @@ type PackageSummaryWithChanges =
186
189
  type PackageSummary =
187
190
  record {
188
191
  config: PackageConfigV3;
192
+ depAlias: text;
189
193
  downloadsInLast30Days: nat;
190
194
  downloadsInLast7Days: nat;
191
195
  downloadsTotal: nat;
@@ -224,6 +228,7 @@ type PackageDetails =
224
228
  benchmarks: Benchmarks__1;
225
229
  changes: PackageChanges;
226
230
  config: PackageConfigV3;
231
+ depAlias: text;
227
232
  dependents: vec PackageSummary__1;
228
233
  deps: vec PackageSummary__1;
229
234
  devDeps: vec PackageSummary__1;
@@ -178,6 +178,7 @@ export interface PackageDetails {
178
178
  'benchmarks' : Benchmarks__1,
179
179
  'ownerInfo' : User,
180
180
  'owner' : Principal,
181
+ 'depAlias' : string,
181
182
  'deps' : Array<PackageSummary__1>,
182
183
  'quality' : PackageQuality,
183
184
  'testStats' : TestStats__1,
@@ -218,6 +219,7 @@ export interface PackageQuality {
218
219
  export interface PackageSummary {
219
220
  'ownerInfo' : User,
220
221
  'owner' : Principal,
222
+ 'depAlias' : string,
221
223
  'quality' : PackageQuality,
222
224
  'downloadsTotal' : bigint,
223
225
  'downloadsInLast30Days' : bigint,
@@ -228,6 +230,7 @@ export interface PackageSummary {
228
230
  export interface PackageSummaryWithChanges {
229
231
  'ownerInfo' : User,
230
232
  'owner' : Principal,
233
+ 'depAlias' : string,
231
234
  'quality' : PackageQuality,
232
235
  'downloadsTotal' : bigint,
233
236
  'downloadsInLast30Days' : bigint,
@@ -239,6 +242,7 @@ export interface PackageSummaryWithChanges {
239
242
  export interface PackageSummaryWithChanges__1 {
240
243
  'ownerInfo' : User,
241
244
  'owner' : Principal,
245
+ 'depAlias' : string,
242
246
  'quality' : PackageQuality,
243
247
  'downloadsTotal' : bigint,
244
248
  'downloadsInLast30Days' : bigint,
@@ -250,6 +254,7 @@ export interface PackageSummaryWithChanges__1 {
250
254
  export interface PackageSummary__1 {
251
255
  'ownerInfo' : User,
252
256
  'owner' : Principal,
257
+ 'depAlias' : string,
253
258
  'quality' : PackageQuality,
254
259
  'downloadsTotal' : bigint,
255
260
  'downloadsInLast30Days' : bigint,
@@ -90,6 +90,7 @@ export const idlFactory = ({ IDL }) => {
90
90
  const PackageSummary = IDL.Record({
91
91
  'ownerInfo' : User,
92
92
  'owner' : IDL.Principal,
93
+ 'depAlias' : IDL.Text,
93
94
  'quality' : PackageQuality,
94
95
  'downloadsTotal' : IDL.Nat,
95
96
  'downloadsInLast30Days' : IDL.Nat,
@@ -116,6 +117,7 @@ export const idlFactory = ({ IDL }) => {
116
117
  const PackageSummary__1 = IDL.Record({
117
118
  'ownerInfo' : User,
118
119
  'owner' : IDL.Principal,
120
+ 'depAlias' : IDL.Text,
119
121
  'quality' : PackageQuality,
120
122
  'downloadsTotal' : IDL.Nat,
121
123
  'downloadsInLast30Days' : IDL.Nat,
@@ -156,6 +158,7 @@ export const idlFactory = ({ IDL }) => {
156
158
  const PackageSummaryWithChanges__1 = IDL.Record({
157
159
  'ownerInfo' : User,
158
160
  'owner' : IDL.Principal,
161
+ 'depAlias' : IDL.Text,
159
162
  'quality' : PackageQuality,
160
163
  'downloadsTotal' : IDL.Nat,
161
164
  'downloadsInLast30Days' : IDL.Nat,
@@ -168,6 +171,7 @@ export const idlFactory = ({ IDL }) => {
168
171
  'benchmarks' : Benchmarks__1,
169
172
  'ownerInfo' : User,
170
173
  'owner' : IDL.Principal,
174
+ 'depAlias' : IDL.Text,
171
175
  'deps' : IDL.Vec(PackageSummary__1),
172
176
  'quality' : PackageQuality,
173
177
  'testStats' : TestStats__1,
@@ -187,6 +191,7 @@ export const idlFactory = ({ IDL }) => {
187
191
  const PackageSummaryWithChanges = IDL.Record({
188
192
  'ownerInfo' : User,
189
193
  'owner' : IDL.Principal,
194
+ 'depAlias' : IDL.Text,
190
195
  'quality' : PackageQuality,
191
196
  'downloadsTotal' : IDL.Nat,
192
197
  'downloadsInLast30Days' : IDL.Nat,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.44.1",
3
+ "version": "0.45.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "bin/mops.js",
package/cache.ts CHANGED
@@ -4,6 +4,7 @@ import ncp from 'ncp';
4
4
  import getFolderSize from 'get-folder-size';
5
5
 
6
6
  import {getDependencyType, globalCacheDir, parseGithubURL} from './mops.js';
7
+ import {getPackageId} from './helpers/get-package-id.js';
7
8
 
8
9
  export let show = () => {
9
10
  return globalCacheDir;
@@ -24,7 +25,7 @@ export function getDepCacheName(name : string, version : string) {
24
25
  }
25
26
 
26
27
  export function getMopsDepCacheName(name : string, version : string) {
27
- return `${name}@${version}`;
28
+ return getPackageId(name, version);
28
29
  }
29
30
 
30
31
  export function getGithubDepCacheName(name : string, repo : string) {
@@ -5,6 +5,7 @@ import chalk from 'chalk';
5
5
  import {getDependencyType, getRootDir, readConfig} from './mops.js';
6
6
  import {resolvePackages} from './resolve-packages.js';
7
7
  import {getMocVersion} from './helpers/get-moc-version.js';
8
+ import {getPackageId} from './helpers/get-package-id.js';
8
9
 
9
10
  export async function checkRequirements({verbose = false} = {}) {
10
11
  let config = readConfig();
@@ -23,7 +24,7 @@ export async function checkRequirements({verbose = false} = {}) {
23
24
  let resolvedPackages = await resolvePackages();
24
25
  for (let [name, version] of Object.entries(resolvedPackages)) {
25
26
  if (getDependencyType(version) === 'mops') {
26
- let pkgId = `${name}@${version}`;
27
+ let pkgId = getPackageId(name, version);
27
28
  let depConfig = readConfig(path.join(rootDir, '.mops', pkgId, 'mops.toml'));
28
29
  let moc = depConfig.requirements?.moc;
29
30
 
package/cli.ts CHANGED
@@ -125,6 +125,7 @@ program
125
125
  .option('--no-docs', 'Do not generate docs')
126
126
  .option('--no-test', 'Do not run tests')
127
127
  .option('--no-bench', 'Do not run benchmarks')
128
+ .option('--verbose')
128
129
  .action(async (options) => {
129
130
  if (!checkConfigFile()) {
130
131
  process.exit(1);
@@ -168,12 +169,15 @@ program
168
169
  program
169
170
  .command('sources')
170
171
  .description('for dfx packtool')
172
+ .option('--no-install', 'Do not install dependencies before running sources')
171
173
  .option('--verbose')
172
174
  .action(async (options) => {
173
175
  if (!checkConfigFile()) {
174
176
  process.exit(1);
175
177
  }
176
- await installAll({silent: true, lock: 'ignore', threads: 6});
178
+ if (options.install) {
179
+ await installAll({silent: true, lock: 'ignore', threads: 6});
180
+ }
177
181
  await toolchain.ensureToolchainInited({strict: false});
178
182
  let sourcesArr = await sources(options);
179
183
  console.log(sourcesArr.join('\n'));
@@ -2,6 +2,7 @@ import process from 'node:process';
2
2
  import chalk from 'chalk';
3
3
  import {mainActor} from '../api/actors.js';
4
4
  import {Config} from '../types.js';
5
+ import {getDepName} from '../helpers/get-dep-name.js';
5
6
 
6
7
  // [pkg, oldVersion, newVersion]
7
8
  export async function getAvailableUpdates(config : Config, pkg ?: string) : Promise<Array<[string, string, string]>> {
@@ -10,6 +11,9 @@ export async function getAvailableUpdates(config : Config, pkg ?: string) : Prom
10
11
  let allDeps = [...deps, ...devDeps].filter((dep) => dep.version);
11
12
  let depsToUpdate = pkg ? allDeps.filter((dep) => dep.name === pkg) : allDeps;
12
13
 
14
+ // skip pinned dependencies
15
+ depsToUpdate = depsToUpdate.filter((dep) => getDepName(dep.name) === dep.name);
16
+
13
17
  let getCurrentVersion = (pkg : string) => {
14
18
  for (let dep of allDeps) {
15
19
  if (dep.name === pkg && dep.version) {
@@ -12,6 +12,7 @@ import {parallel} from '../../parallel.js';
12
12
  import {getDepCacheDir, getMopsDepCacheName, isDepCached} from '../../cache.js';
13
13
  import {downloadFile, getPackageFilesInfo} from '../../api/downloadPackageFiles.js';
14
14
  import {installDeps} from './install-deps.js';
15
+ import {getDepName} from '../../helpers/get-dep-name.js';
15
16
 
16
17
  type InstallMopsDepOptions = {
17
18
  verbose ?: boolean;
@@ -22,6 +23,7 @@ type InstallMopsDepOptions = {
22
23
 
23
24
  export async function installMopsDep(pkg : string, version = '', {verbose, silent, dep, threads} : InstallMopsDepOptions = {}) : Promise<boolean> {
24
25
  threads = threads || 12;
26
+ let depName = getDepName(pkg);
25
27
 
26
28
  if (!checkConfigFile()) {
27
29
  return false;
@@ -33,12 +35,12 @@ export async function installMopsDep(pkg : string, version = '', {verbose, silen
33
35
  let step = 0;
34
36
  let progress = () => {
35
37
  step++;
36
- silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} ${progressBar(step, total)}`);
38
+ silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${depName}@${version} ${progressBar(step, total)}`);
37
39
  };
38
40
  progress();
39
41
 
40
42
  if (!version) {
41
- let versionRes = await getHighestVersion(pkg);
43
+ let versionRes = await getHighestVersion(depName);
42
44
  if ('err' in versionRes) {
43
45
  console.log(chalk.red('Error: ') + versionRes.err);
44
46
  return false;
@@ -46,12 +48,12 @@ export async function installMopsDep(pkg : string, version = '', {verbose, silen
46
48
  version = versionRes.ok;
47
49
  }
48
50
 
49
- let cacheName = getMopsDepCacheName(pkg, version);
51
+ let cacheName = getMopsDepCacheName(depName, version);
50
52
  let cacheDir = getDepCacheDir(cacheName);
51
53
 
52
54
  // global cache hit
53
55
  if (isDepCached(cacheName)) {
54
- silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (cache)`);
56
+ silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${depName}@${version} (cache)`);
55
57
  }
56
58
  // download
57
59
  else {
@@ -61,7 +63,7 @@ export async function installMopsDep(pkg : string, version = '', {verbose, silen
61
63
  }
62
64
 
63
65
  try {
64
- let {storageId, fileIds} = await getPackageFilesInfo(pkg, version);
66
+ let {storageId, fileIds} = await getPackageFilesInfo(depName, version);
65
67
 
66
68
  total = fileIds.length + 2;
67
69
 
@@ -18,7 +18,7 @@ import {SilentReporter} from './test/reporters/silent-reporter.js';
18
18
  import {findChangelogEntry} from '../helpers/find-changelog-entry.js';
19
19
  import {bench} from './bench.js';
20
20
 
21
- export async function publish(options : {docs ?: boolean, test ?: boolean, bench ?: boolean} = {}) {
21
+ export async function publish(options : {docs ?: boolean, test ?: boolean, bench ?: boolean, verbose ?: boolean} = {}) {
22
22
  if (!checkConfigFile()) {
23
23
  return;
24
24
  }
@@ -222,6 +222,11 @@ export async function publish(options : {docs ?: boolean, test ?: boolean, bench
222
222
  files = [...files, ...defaultFiles];
223
223
  files = globbySync([...files, ...defaultFiles]);
224
224
 
225
+ if (options.verbose) {
226
+ console.log('Files:');
227
+ console.log(files.map((file) => ' ' + file).join('\n'));
228
+ }
229
+
225
230
  // generate docs
226
231
  let docsFile = path.join(rootDir, '.mops/.docs/docs.tgz');
227
232
  if (options.docs) {
@@ -308,7 +313,7 @@ export async function publish(options : {docs ?: boolean, test ?: boolean, bench
308
313
  let publishing = await actor.startPublish(backendPkgConfig);
309
314
  if ('err' in publishing) {
310
315
  console.log(chalk.red('Error: ') + publishing.err);
311
- return;
316
+ process.exit(1);
312
317
  }
313
318
  let puiblishingId = publishing.ok;
314
319
 
@@ -347,7 +352,7 @@ export async function publish(options : {docs ?: boolean, test ?: boolean, bench
347
352
  let res = await actor.startFileUpload(puiblishingId, file, BigInt(chunkCount), firstChunk);
348
353
  if ('err' in res) {
349
354
  console.log(chalk.red('Error: ') + res.err);
350
- return;
355
+ process.exit(1);
351
356
  }
352
357
  let fileId = res.ok;
353
358
 
@@ -357,7 +362,7 @@ export async function publish(options : {docs ?: boolean, test ?: boolean, bench
357
362
  let res = await actor.uploadFileChunk(puiblishingId, fileId, BigInt(i), chunk);
358
363
  if ('err' in res) {
359
364
  console.log(chalk.red('Error: ') + res.err);
360
- return;
365
+ process.exit(1);
361
366
  }
362
367
  }
363
368
  });
@@ -371,7 +376,7 @@ export async function publish(options : {docs ?: boolean, test ?: boolean, bench
371
376
  let res = await actor.finishPublish(puiblishingId);
372
377
  if ('err' in res) {
373
378
  console.log(chalk.red('Error: ') + res.err);
374
- return;
379
+ process.exit(1);
375
380
  }
376
381
 
377
382
  console.log(chalk.green('Published ') + `${config.package.name}@${config.package.version}`);
@@ -7,6 +7,7 @@ import {checkIntegrity} from '../integrity.js';
7
7
  import {getDepCacheDir, getDepCacheName} from '../cache.js';
8
8
  import path from 'node:path';
9
9
  import {syncLocalCache} from './install/sync-local-cache.js';
10
+ import {getPackageId} from '../helpers/get-package-id.js';
10
11
 
11
12
  type RemoveOptions = {
12
13
  verbose ?: boolean;
@@ -25,7 +26,7 @@ export async function remove(name : string, {dev = false, verbose = false, dryRu
25
26
  let devDeps = Object.values(config['dev-dependencies'] || {});
26
27
  return [...deps, ...devDeps]
27
28
  .filter((dep) => {
28
- let depId = dep.name + '@' + dep.version;
29
+ let depId = getPackageId(dep.name, dep.version || '');
29
30
  return depId !== exceptPkgId;
30
31
  }).map((dep) => {
31
32
  return [dep, ...getTransitiveDependenciesOf(dep.name, dep.version, dep.repo)];
@@ -61,12 +62,12 @@ export async function remove(name : string, {dev = false, verbose = false, dryRu
61
62
  }
62
63
 
63
64
  let version = pkgDetails.version;
64
- let packageId = `${name}@${version}`;
65
+ let packageId = getPackageId(name, version || '');
65
66
 
66
67
  // transitive deps ignoring deps of this package
67
68
  let transitiveDeps = getTransitiveDependencies(config, packageId);
68
69
  let transitiveDepIds = new Set(transitiveDeps.map((dep) => {
69
- return dep.name + '@' + dep.version;
70
+ return getPackageId(dep.name, dep.version || '');
70
71
  }));
71
72
 
72
73
  // transitive deps of this package (including itself)
@@ -74,7 +75,7 @@ export async function remove(name : string, {dev = false, verbose = false, dryRu
74
75
 
75
76
  // remove local cache
76
77
  for (let dep of transitiveDepsOfPackage) {
77
- let depId = dep.name + '@' + dep.version;
78
+ let depId = getPackageId(dep.name, dep.version || '');
78
79
  if (transitiveDepIds.has(depId)) {
79
80
  verbose && console.log(`Ignored transitive dependency ${depId} (other deps depend on it)`);
80
81
  continue;
@@ -1,4 +1,4 @@
1
- type anon_class_10_1 =
1
+ type _anon_class_10_1 =
2
2
  service {
3
3
  getSchema: () -> (BenchSchema) query;
4
4
  getStats: () -> (BenchResult) query;
@@ -23,4 +23,4 @@ type BenchResult =
23
23
  rts_mutator_instructions: int;
24
24
  rts_total_allocation: int;
25
25
  };
26
- service : () -> anon_class_10_1
26
+ service : () -> _anon_class_10_1
@@ -16,7 +16,7 @@ export interface BenchSchema {
16
16
  'rows' : Array<string>,
17
17
  'description' : string,
18
18
  }
19
- export interface anon_class_10_1 {
19
+ export interface _anon_class_10_1 {
20
20
  'getSchema' : ActorMethod<[], BenchSchema>,
21
21
  'getStats' : ActorMethod<[], BenchResult>,
22
22
  'init' : ActorMethod<[], BenchSchema>,
@@ -24,6 +24,6 @@ export interface anon_class_10_1 {
24
24
  'runCellUpdate' : ActorMethod<[bigint, bigint], BenchResult>,
25
25
  'runCellUpdateAwait' : ActorMethod<[bigint, bigint], BenchResult>,
26
26
  }
27
- export interface _SERVICE extends anon_class_10_1 {}
27
+ export interface _SERVICE extends _anon_class_10_1 {}
28
28
  export declare const idlFactory: IDL.InterfaceFactory;
29
29
  export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -13,7 +13,7 @@ export const idlFactory = ({ IDL }) => {
13
13
  'rts_mutator_instructions' : IDL.Int,
14
14
  'rts_heap_size' : IDL.Int,
15
15
  });
16
- const anon_class_10_1 = IDL.Service({
16
+ const _anon_class_10_1 = IDL.Service({
17
17
  'getSchema' : IDL.Func([], [BenchSchema], ['query']),
18
18
  'getStats' : IDL.Func([], [BenchResult], ['query']),
19
19
  'init' : IDL.Func([], [BenchSchema], []),
@@ -21,6 +21,6 @@ export const idlFactory = ({ IDL }) => {
21
21
  'runCellUpdate' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
22
22
  'runCellUpdateAwait' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
23
23
  });
24
- return anon_class_10_1;
24
+ return _anon_class_10_1;
25
25
  };
26
26
  export const init = ({ IDL }) => { return []; };
@@ -4,6 +4,14 @@ import { Actor, HttpAgent } from "@dfinity/agent";
4
4
  import { idlFactory } from "./bench.did.js";
5
5
  export { idlFactory } from "./bench.did.js";
6
6
 
7
+ /* CANISTER_ID is replaced by webpack based on node environment
8
+ * Note: canister environment variable will be standardized as
9
+ * process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
10
+ * beginning in dfx 0.15.0
11
+ */
12
+ export const canisterId =
13
+ process.env.CANISTER_ID_BENCH;
14
+
7
15
  export const createActor = (canisterId, options = {}) => {
8
16
  const agent = options.agent || new HttpAgent({ ...options.agentOptions });
9
17
 
@@ -151,6 +151,7 @@ type PackageVersion = text;
151
151
  type PackageSummary__1 =
152
152
  record {
153
153
  config: PackageConfigV3;
154
+ depAlias: text;
154
155
  downloadsInLast30Days: nat;
155
156
  downloadsInLast7Days: nat;
156
157
  downloadsTotal: nat;
@@ -163,6 +164,7 @@ type PackageSummaryWithChanges__1 =
163
164
  record {
164
165
  changes: PackageChanges;
165
166
  config: PackageConfigV3;
167
+ depAlias: text;
166
168
  downloadsInLast30Days: nat;
167
169
  downloadsInLast7Days: nat;
168
170
  downloadsTotal: nat;
@@ -175,6 +177,7 @@ type PackageSummaryWithChanges =
175
177
  record {
176
178
  changes: PackageChanges;
177
179
  config: PackageConfigV3;
180
+ depAlias: text;
178
181
  downloadsInLast30Days: nat;
179
182
  downloadsInLast7Days: nat;
180
183
  downloadsTotal: nat;
@@ -186,6 +189,7 @@ type PackageSummaryWithChanges =
186
189
  type PackageSummary =
187
190
  record {
188
191
  config: PackageConfigV3;
192
+ depAlias: text;
189
193
  downloadsInLast30Days: nat;
190
194
  downloadsInLast7Days: nat;
191
195
  downloadsTotal: nat;
@@ -224,6 +228,7 @@ type PackageDetails =
224
228
  benchmarks: Benchmarks__1;
225
229
  changes: PackageChanges;
226
230
  config: PackageConfigV3;
231
+ depAlias: text;
227
232
  dependents: vec PackageSummary__1;
228
233
  deps: vec PackageSummary__1;
229
234
  devDeps: vec PackageSummary__1;
@@ -178,6 +178,7 @@ export interface PackageDetails {
178
178
  'benchmarks' : Benchmarks__1,
179
179
  'ownerInfo' : User,
180
180
  'owner' : Principal,
181
+ 'depAlias' : string,
181
182
  'deps' : Array<PackageSummary__1>,
182
183
  'quality' : PackageQuality,
183
184
  'testStats' : TestStats__1,
@@ -218,6 +219,7 @@ export interface PackageQuality {
218
219
  export interface PackageSummary {
219
220
  'ownerInfo' : User,
220
221
  'owner' : Principal,
222
+ 'depAlias' : string,
221
223
  'quality' : PackageQuality,
222
224
  'downloadsTotal' : bigint,
223
225
  'downloadsInLast30Days' : bigint,
@@ -228,6 +230,7 @@ export interface PackageSummary {
228
230
  export interface PackageSummaryWithChanges {
229
231
  'ownerInfo' : User,
230
232
  'owner' : Principal,
233
+ 'depAlias' : string,
231
234
  'quality' : PackageQuality,
232
235
  'downloadsTotal' : bigint,
233
236
  'downloadsInLast30Days' : bigint,
@@ -239,6 +242,7 @@ export interface PackageSummaryWithChanges {
239
242
  export interface PackageSummaryWithChanges__1 {
240
243
  'ownerInfo' : User,
241
244
  'owner' : Principal,
245
+ 'depAlias' : string,
242
246
  'quality' : PackageQuality,
243
247
  'downloadsTotal' : bigint,
244
248
  'downloadsInLast30Days' : bigint,
@@ -250,6 +254,7 @@ export interface PackageSummaryWithChanges__1 {
250
254
  export interface PackageSummary__1 {
251
255
  'ownerInfo' : User,
252
256
  'owner' : Principal,
257
+ 'depAlias' : string,
253
258
  'quality' : PackageQuality,
254
259
  'downloadsTotal' : bigint,
255
260
  'downloadsInLast30Days' : bigint,
@@ -90,6 +90,7 @@ export const idlFactory = ({ IDL }) => {
90
90
  const PackageSummary = IDL.Record({
91
91
  'ownerInfo' : User,
92
92
  'owner' : IDL.Principal,
93
+ 'depAlias' : IDL.Text,
93
94
  'quality' : PackageQuality,
94
95
  'downloadsTotal' : IDL.Nat,
95
96
  'downloadsInLast30Days' : IDL.Nat,
@@ -116,6 +117,7 @@ export const idlFactory = ({ IDL }) => {
116
117
  const PackageSummary__1 = IDL.Record({
117
118
  'ownerInfo' : User,
118
119
  'owner' : IDL.Principal,
120
+ 'depAlias' : IDL.Text,
119
121
  'quality' : PackageQuality,
120
122
  'downloadsTotal' : IDL.Nat,
121
123
  'downloadsInLast30Days' : IDL.Nat,
@@ -156,6 +158,7 @@ export const idlFactory = ({ IDL }) => {
156
158
  const PackageSummaryWithChanges__1 = IDL.Record({
157
159
  'ownerInfo' : User,
158
160
  'owner' : IDL.Principal,
161
+ 'depAlias' : IDL.Text,
159
162
  'quality' : PackageQuality,
160
163
  'downloadsTotal' : IDL.Nat,
161
164
  'downloadsInLast30Days' : IDL.Nat,
@@ -168,6 +171,7 @@ export const idlFactory = ({ IDL }) => {
168
171
  'benchmarks' : Benchmarks__1,
169
172
  'ownerInfo' : User,
170
173
  'owner' : IDL.Principal,
174
+ 'depAlias' : IDL.Text,
171
175
  'deps' : IDL.Vec(PackageSummary__1),
172
176
  'quality' : PackageQuality,
173
177
  'testStats' : TestStats__1,
@@ -187,6 +191,7 @@ export const idlFactory = ({ IDL }) => {
187
191
  const PackageSummaryWithChanges = IDL.Record({
188
192
  'ownerInfo' : User,
189
193
  'owner' : IDL.Principal,
194
+ 'depAlias' : IDL.Text,
190
195
  'quality' : PackageQuality,
191
196
  'downloadsTotal' : IDL.Nat,
192
197
  'downloadsInLast30Days' : IDL.Nat,
@@ -16,7 +16,7 @@ mopsToml="$rootDir/mops.toml"
16
16
  if [[ $rootDir == "" ]] || [[ ! -f $mopsToml ]]; then
17
17
  mocPath="$(mops toolchain bin moc --fallback)"
18
18
  else
19
- if command -v openssl &> /dev/null; then
19
+ if command -v openssl >/dev/null 2>&1; then
20
20
  mopsTomlHash=$(openssl sha256 $mopsToml | awk -F'= ' '{print $2}')
21
21
  else
22
22
  mopsTomlHash=$(shasum $mopsToml -a 256 | awk -F' ' '{print $1}')
@@ -31,6 +31,7 @@ else
31
31
  echo -n $mocPath > "$cached"
32
32
  fi;
33
33
  else
34
+ mkdir -p "$(dirname $cached)"
34
35
  mocPath="$(mops toolchain bin moc --fallback)"
35
36
  echo -n $mocPath > "$cached"
36
37
  fi;
package/dist/cache.js CHANGED
@@ -3,6 +3,7 @@ import path from 'node:path';
3
3
  import ncp from 'ncp';
4
4
  import getFolderSize from 'get-folder-size';
5
5
  import { getDependencyType, globalCacheDir, parseGithubURL } from './mops.js';
6
+ import { getPackageId } from './helpers/get-package-id.js';
6
7
  export let show = () => {
7
8
  return globalCacheDir;
8
9
  };
@@ -18,7 +19,7 @@ export function getDepCacheName(name, version) {
18
19
  return depType === 'mops' ? getMopsDepCacheName(name, version) : getGithubDepCacheName(name, version);
19
20
  }
20
21
  export function getMopsDepCacheName(name, version) {
21
- return `${name}@${version}`;
22
+ return getPackageId(name, version);
22
23
  }
23
24
  export function getGithubDepCacheName(name, repo) {
24
25
  const { branch, commitHash } = parseGithubURL(repo);
@@ -4,6 +4,7 @@ import chalk from 'chalk';
4
4
  import { getDependencyType, getRootDir, readConfig } from './mops.js';
5
5
  import { resolvePackages } from './resolve-packages.js';
6
6
  import { getMocVersion } from './helpers/get-moc-version.js';
7
+ import { getPackageId } from './helpers/get-package-id.js';
7
8
  export async function checkRequirements({ verbose = false } = {}) {
8
9
  let config = readConfig();
9
10
  let mocVersion = config.toolchain?.moc;
@@ -20,7 +21,7 @@ export async function checkRequirements({ verbose = false } = {}) {
20
21
  let resolvedPackages = await resolvePackages();
21
22
  for (let [name, version] of Object.entries(resolvedPackages)) {
22
23
  if (getDependencyType(version) === 'mops') {
23
- let pkgId = `${name}@${version}`;
24
+ let pkgId = getPackageId(name, version);
24
25
  let depConfig = readConfig(path.join(rootDir, '.mops', pkgId, 'mops.toml'));
25
26
  let moc = depConfig.requirements?.moc;
26
27
  if (moc) {