ic-mops 0.45.3 → 1.0.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +0 -0
- package/.gitignore +0 -0
- package/CHANGELOG.md +15 -0
- package/README.md +1 -1
- package/api/actors.ts +25 -17
- package/api/downloadPackageFiles.ts +0 -0
- package/api/getHighestVersion.ts +0 -0
- package/api/index.ts +0 -0
- package/api/network.ts +0 -0
- package/api/resolveVersion.ts +0 -0
- package/cache.ts +20 -8
- package/cli.ts +28 -27
- package/commands/add.ts +4 -0
- package/commands/bench/bench-canister.mo +34 -8
- package/commands/bench/user-bench.mo +0 -0
- package/commands/bench-replica.ts +11 -6
- package/commands/bench.ts +31 -5
- package/commands/bump.ts +0 -0
- package/commands/docs.ts +0 -0
- package/commands/outdated.ts +0 -0
- package/commands/publish.ts +1 -1
- package/commands/replica.ts +237 -0
- package/commands/search.ts +0 -0
- package/commands/sources.ts +2 -3
- package/commands/sync.ts +0 -0
- package/commands/template.ts +0 -0
- package/commands/test/mmf1.ts +5 -5
- package/commands/test/reporters/compact-reporter.ts +2 -1
- package/commands/test/reporters/files-reporter.ts +3 -2
- package/commands/test/reporters/reporter.ts +2 -1
- package/commands/test/reporters/silent-reporter.ts +2 -1
- package/commands/test/reporters/verbose-reporter.ts +14 -4
- package/commands/test/test.ts +213 -74
- package/commands/test/utils.ts +0 -0
- package/commands/toolchain/moc.ts +0 -0
- package/commands/toolchain/pocket-ic.ts +0 -0
- package/commands/toolchain/toolchain-utils.ts +0 -0
- package/commands/toolchain/wasmtime.ts +0 -0
- package/commands/transfer-ownership.ts +0 -0
- package/commands/update.ts +0 -0
- package/commands/user.ts +71 -1
- package/declarations/bench/bench.did +8 -4
- package/declarations/bench/bench.did.d.ts +4 -0
- package/declarations/bench/bench.did.js +4 -0
- package/declarations/storage/index.d.ts +0 -0
- package/declarations/storage/index.js +0 -0
- package/declarations/storage/storage.did +0 -0
- package/declarations/storage/storage.did.d.ts +0 -0
- package/declarations/storage/storage.did.js +0 -0
- package/dist/api/actors.js +19 -13
- package/dist/cache.js +17 -8
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +24 -27
- package/dist/commands/add.js +3 -0
- package/dist/commands/bench/bench-canister.mo +34 -8
- package/dist/commands/bench/user-bench.mo +0 -0
- package/dist/commands/bench-replica.d.ts +2 -1
- package/dist/commands/bench-replica.js +10 -6
- package/dist/commands/bench.js +29 -5
- package/dist/commands/publish.js +1 -1
- package/dist/commands/replica.d.ts +59 -0
- package/dist/commands/replica.js +193 -0
- package/dist/commands/sources.d.ts +2 -2
- package/dist/commands/sources.js +2 -3
- package/dist/commands/test/mmf1.d.ts +2 -2
- package/dist/commands/test/mmf1.js +4 -4
- package/dist/commands/test/reporters/compact-reporter.d.ts +2 -1
- package/dist/commands/test/reporters/compact-reporter.js +1 -1
- package/dist/commands/test/reporters/files-reporter.d.ts +2 -1
- package/dist/commands/test/reporters/files-reporter.js +2 -2
- package/dist/commands/test/reporters/reporter.d.ts +2 -1
- package/dist/commands/test/reporters/silent-reporter.d.ts +2 -1
- package/dist/commands/test/reporters/silent-reporter.js +1 -1
- package/dist/commands/test/reporters/verbose-reporter.d.ts +3 -1
- package/dist/commands/test/reporters/verbose-reporter.js +12 -4
- package/dist/commands/test/test.d.ts +10 -8
- package/dist/commands/test/test.js +170 -71
- package/dist/commands/user.d.ts +6 -0
- package/dist/commands/user.js +59 -1
- package/dist/declarations/bench/bench.did +8 -4
- package/dist/declarations/bench/bench.did.d.ts +4 -0
- package/dist/declarations/bench/bench.did.js +4 -0
- package/dist/declarations/storage/index.d.ts +0 -0
- package/dist/declarations/storage/index.js +0 -0
- package/dist/declarations/storage/storage.did +0 -0
- package/dist/declarations/storage/storage.did.d.ts +0 -0
- package/dist/declarations/storage/storage.did.js +0 -0
- package/dist/mops.d.ts +1 -1
- package/dist/mops.js +4 -28
- package/dist/package.json +4 -3
- package/dist/resolve-packages.d.ts +2 -2
- package/dist/resolve-packages.js +29 -7
- package/dist/templates/README.md +0 -0
- package/dist/templates/licenses/Apache-2.0 +0 -0
- package/dist/templates/licenses/Apache-2.0-NOTICE +0 -0
- package/dist/templates/licenses/MIT +0 -0
- package/dist/templates/mops-publish.yml +0 -0
- package/dist/templates/mops-test.yml +0 -0
- package/dist/templates/src/lib.mo +0 -0
- package/dist/templates/test/lib.test.mo +0 -0
- package/dist/types.d.ts +1 -0
- package/global.d.ts +0 -0
- package/helpers/get-dfx-version.ts +0 -0
- package/helpers/get-moc-path.ts +0 -0
- package/helpers/get-moc-version.ts +0 -0
- package/mops.ts +4 -31
- package/package.json +4 -3
- package/parallel.ts +0 -0
- package/resolve-packages.ts +39 -8
- package/templates/README.md +0 -0
- package/templates/licenses/Apache-2.0 +0 -0
- package/templates/licenses/Apache-2.0-NOTICE +0 -0
- package/templates/licenses/MIT +0 -0
- package/templates/mops-publish.yml +0 -0
- package/templates/mops-test.yml +0 -0
- package/templates/src/lib.mo +0 -0
- package/templates/test/lib.test.mo +0 -0
- package/types.ts +3 -1
- package/.DS_Store +0 -0
- package/bundle/bench/bench-canister.mo +0 -87
- package/bundle/bench/user-bench.mo +0 -14
- package/bundle/bin/moc-wrapper.sh +0 -40
- package/bundle/bin/mops.js +0 -3
- package/bundle/cli.js +0 -163
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did +0 -26
- package/bundle/declarations/bench/bench.did.d.ts +0 -29
- package/bundle/declarations/bench/bench.did.js +0 -26
- package/bundle/declarations/bench/index.d.ts +0 -50
- package/bundle/declarations/bench/index.js +0 -40
- package/bundle/declarations/main/index.d.ts +0 -50
- package/bundle/declarations/main/index.js +0 -40
- package/bundle/declarations/main/main.did +0 -438
- package/bundle/declarations/main/main.did.d.ts +0 -360
- package/bundle/declarations/main/main.did.js +0 -412
- package/bundle/declarations/storage/index.d.ts +0 -50
- package/bundle/declarations/storage/index.js +0 -30
- package/bundle/declarations/storage/storage.did +0 -46
- package/bundle/declarations/storage/storage.did.d.ts +0 -40
- package/bundle/declarations/storage/storage.did.js +0 -38
- package/bundle/package.json +0 -31
- package/bundle/templates/README.md +0 -13
- package/bundle/templates/licenses/Apache-2.0 +0 -202
- package/bundle/templates/licenses/Apache-2.0-NOTICE +0 -13
- package/bundle/templates/licenses/MIT +0 -21
- package/bundle/templates/mops-publish.yml +0 -17
- package/bundle/templates/mops-test.yml +0 -22
- package/bundle/templates/src/lib.mo +0 -15
- package/bundle/templates/test/lib.test.mo +0 -4
- package/commands/import-identity.ts +0 -62
- package/commands/whoami.ts +0 -12
|
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
package/global.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/helpers/get-moc-path.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/mops.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {Identity} from '@dfinity/agent';
|
|
|
5
5
|
import TOML from '@iarna/toml';
|
|
6
6
|
import chalk from 'chalk';
|
|
7
7
|
import prompts from 'prompts';
|
|
8
|
-
import ncp from 'ncp';
|
|
9
8
|
import fetch from 'node-fetch';
|
|
10
9
|
|
|
11
10
|
import {decodeFile} from './pem.js';
|
|
@@ -47,35 +46,6 @@ if (process.env.XDG_CACHE_HOME) {
|
|
|
47
46
|
globalCacheDir = path.join(process.env.XDG_CACHE_HOME, 'mops');
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
// temp: move old config to new location
|
|
51
|
-
let oldGlobalConfigDir = path.resolve(process.env.HOME || process.env.APPDATA || '/', 'mops');
|
|
52
|
-
if (fs.existsSync(oldGlobalConfigDir) && !fs.existsSync(globalConfigDir)) {
|
|
53
|
-
fs.mkdirSync(globalConfigDir, {recursive: true});
|
|
54
|
-
if (fs.existsSync(path.join(oldGlobalConfigDir, 'identity.pem'))) {
|
|
55
|
-
fs.copyFileSync(path.join(oldGlobalConfigDir, 'identity.pem'), path.join(globalConfigDir, 'identity.pem'));
|
|
56
|
-
}
|
|
57
|
-
if (fs.existsSync(path.join(oldGlobalConfigDir, 'identity.pem.encrypted'))) {
|
|
58
|
-
fs.copyFileSync(path.join(oldGlobalConfigDir, 'identity.pem.encrypted'), path.join(globalConfigDir, 'identity.pem.encrypted'));
|
|
59
|
-
}
|
|
60
|
-
console.log('Moved config to ' + chalk.green(globalConfigDir));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// temp: move old cache to new location
|
|
64
|
-
if (fs.existsSync(oldGlobalConfigDir) && !fs.existsSync(globalCacheDir)) {
|
|
65
|
-
fs.mkdirSync(globalCacheDir, {recursive: true});
|
|
66
|
-
ncp.ncp(path.join(oldGlobalConfigDir, 'packages'), path.join(globalCacheDir, 'packages'), {
|
|
67
|
-
stopOnErr: true,
|
|
68
|
-
clobber: false,
|
|
69
|
-
}, (err) => {
|
|
70
|
-
if (err) {
|
|
71
|
-
console.log('Error moving config: ', err);
|
|
72
|
-
fs.rmSync(globalCacheDir, {recursive: true, force: true});
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
console.log('Moved cache to ' + chalk.green(globalCacheDir));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
49
|
export function getNetworkFile() : string | URL {
|
|
80
50
|
let networkFile : string | URL = '';
|
|
81
51
|
try {
|
|
@@ -127,10 +97,13 @@ export function getRootDir() {
|
|
|
127
97
|
return path.dirname(configFile);
|
|
128
98
|
}
|
|
129
99
|
|
|
130
|
-
export function checkConfigFile() {
|
|
100
|
+
export function checkConfigFile(exit = false) {
|
|
131
101
|
let configFile = getClosestConfigFile();
|
|
132
102
|
if (!configFile) {
|
|
133
103
|
console.log(chalk.red('Error: ') + `Config file 'mops.toml' not found. Please run ${chalk.green('mops init')} first`);
|
|
104
|
+
if (exit) {
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
134
107
|
return false;
|
|
135
108
|
}
|
|
136
109
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-pre.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mops": "dist/bin/mops.js",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"del": "7.1.0",
|
|
60
60
|
"dhall-to-json-cli": "1.7.6",
|
|
61
61
|
"execa": "9.3.0",
|
|
62
|
+
"filesize": "10.1.4",
|
|
62
63
|
"fs-extra": "11.2.0",
|
|
63
64
|
"get-folder-size": "5.0.0",
|
|
64
65
|
"glob": "11.0.0",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"node-fetch": "3.3.2",
|
|
74
75
|
"octokit": "3.1.2",
|
|
75
76
|
"pem-file": "1.0.1",
|
|
76
|
-
"pic-ic": "0.
|
|
77
|
+
"pic-ic": "0.5.1",
|
|
77
78
|
"prompts": "2.4.2",
|
|
78
79
|
"semver": "7.6.3",
|
|
79
80
|
"stream-to-promise": "3.0.0",
|
|
@@ -92,9 +93,9 @@
|
|
|
92
93
|
"@types/semver": "7.5.8",
|
|
93
94
|
"@types/stream-to-promise": "2.2.4",
|
|
94
95
|
"@types/tar": "6.1.13",
|
|
95
|
-
"eslint": "8.57.0",
|
|
96
96
|
"bun": "1.0.35",
|
|
97
97
|
"esbuild": "0.23.0",
|
|
98
|
+
"eslint": "8.57.0",
|
|
98
99
|
"tsx": "4.16.5",
|
|
99
100
|
"typescript": "5.5.4"
|
|
100
101
|
},
|
package/parallel.ts
CHANGED
|
File without changes
|
package/resolve-packages.ts
CHANGED
|
@@ -5,15 +5,20 @@ import {checkConfigFile, getRootDir, parseGithubURL, readConfig} from './mops.js
|
|
|
5
5
|
import {VesselConfig, readVesselConfig} from './vessel.js';
|
|
6
6
|
import {Config, Dependency} from './types.js';
|
|
7
7
|
import {getDepCacheDir, getDepCacheName} from './cache.js';
|
|
8
|
+
import {getPackageId} from './helpers/get-package-id.js';
|
|
8
9
|
|
|
9
|
-
export async function resolvePackages({
|
|
10
|
+
export async function resolvePackages({conflicts = 'ignore' as 'warning' | 'error' | 'ignore'} = {}) : Promise<Record<string, string>> {
|
|
10
11
|
if (!checkConfigFile()) {
|
|
11
12
|
return {};
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
let rootDir = getRootDir();
|
|
15
16
|
let packages : Record<string, Dependency & {isRoot : boolean;}> = {};
|
|
16
|
-
let versions : Record<string,
|
|
17
|
+
let versions : Record<string, Array<{
|
|
18
|
+
isMopsPackage : boolean;
|
|
19
|
+
version : string;
|
|
20
|
+
dependencyOf : string;
|
|
21
|
+
}>> = {};
|
|
17
22
|
|
|
18
23
|
let compareVersions = (a : string = '0.0.0', b : string = '0.0.0') => {
|
|
19
24
|
let ap = a.split('.').map((x : string) => parseInt(x)) as [number, number, number];
|
|
@@ -95,19 +100,32 @@ export async function resolvePackages({verbose = false} = {}) : Promise<Record<s
|
|
|
95
100
|
|
|
96
101
|
// collect nested deps
|
|
97
102
|
if (nestedConfig) {
|
|
98
|
-
await collectDeps(nestedConfig, localNestedDir);
|
|
103
|
+
await collectDeps(nestedConfig, localNestedDir, false);
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
if (!versions[name]) {
|
|
102
107
|
versions[name] = [];
|
|
103
108
|
}
|
|
104
109
|
|
|
110
|
+
let parentPkgId = isRoot ? '<root>' : '';
|
|
111
|
+
if ('package' in config) {
|
|
112
|
+
parentPkgId = getPackageId(config.package?.name || '', config.package?.version || '');
|
|
113
|
+
}
|
|
114
|
+
|
|
105
115
|
if (repo) {
|
|
106
116
|
const {branch} = parseGithubURL(repo);
|
|
107
|
-
versions[name]?.push(
|
|
117
|
+
versions[name]?.push({
|
|
118
|
+
version: branch,
|
|
119
|
+
dependencyOf: parentPkgId,
|
|
120
|
+
isMopsPackage: false,
|
|
121
|
+
});
|
|
108
122
|
}
|
|
109
123
|
else if (version) {
|
|
110
|
-
versions[name]?.push(
|
|
124
|
+
versions[name]?.push({
|
|
125
|
+
version: version,
|
|
126
|
+
dependencyOf: parentPkgId,
|
|
127
|
+
isMopsPackage: true,
|
|
128
|
+
});
|
|
111
129
|
}
|
|
112
130
|
}
|
|
113
131
|
};
|
|
@@ -116,14 +134,27 @@ export async function resolvePackages({verbose = false} = {}) : Promise<Record<s
|
|
|
116
134
|
await collectDeps(config, rootDir, true);
|
|
117
135
|
|
|
118
136
|
// show conflicts
|
|
119
|
-
|
|
137
|
+
let hasConflicts = false;
|
|
138
|
+
|
|
139
|
+
if (conflicts !== 'ignore') {
|
|
120
140
|
for (let [dep, vers] of Object.entries(versions)) {
|
|
121
|
-
|
|
122
|
-
|
|
141
|
+
let majors = new Set(vers.filter(x => x.isMopsPackage).map(x => x.version.split('.')[0]));
|
|
142
|
+
if (majors.size > 1) {
|
|
143
|
+
console.error(chalk.reset('') + chalk.redBright(conflicts === 'error' ? 'Error!' : 'Warning!'), `Conflicting versions of dependency "${dep}"`);
|
|
144
|
+
|
|
145
|
+
for (let {version, dependencyOf} of vers.reverse()) {
|
|
146
|
+
console.error(chalk.reset(' ') + `${dep} ${chalk.bold.red(version.split('.')[0])}.${version.split('.').slice(1).join('.')} is dependency of ${chalk.bold(dependencyOf)}`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
hasConflicts = true;
|
|
123
150
|
}
|
|
124
151
|
}
|
|
125
152
|
}
|
|
126
153
|
|
|
154
|
+
if (conflicts === 'error' && hasConflicts) {
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
|
|
127
158
|
return Object.fromEntries(
|
|
128
159
|
Object.entries(packages).map(([name, pkg]) => {
|
|
129
160
|
let version : string;
|
package/templates/README.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/templates/licenses/MIT
CHANGED
|
File without changes
|
|
File without changes
|
package/templates/mops-test.yml
CHANGED
|
File without changes
|
package/templates/src/lib.mo
CHANGED
|
File without changes
|
|
File without changes
|
package/types.ts
CHANGED
package/.DS_Store
DELETED
|
Binary file
|
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# set -e
|
|
4
|
-
|
|
5
|
-
findRootDir() {
|
|
6
|
-
dir="$(pwd)"
|
|
7
|
-
while [[ "$dir" != "" && ! -e "$dir/mops.toml" ]]; do
|
|
8
|
-
dir=${dir%/*}
|
|
9
|
-
done
|
|
10
|
-
echo "$dir"
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
rootDir=$(findRootDir)
|
|
14
|
-
mopsToml="$rootDir/mops.toml"
|
|
15
|
-
|
|
16
|
-
if [[ $rootDir == "" ]] || [[ ! -f $mopsToml ]]; then
|
|
17
|
-
mocPath="$(mops toolchain bin moc --fallback)"
|
|
18
|
-
else
|
|
19
|
-
if command -v openssl >/dev/null 2>&1; then
|
|
20
|
-
mopsTomlHash=$(openssl sha256 $mopsToml | awk -F'= ' '{print $2}')
|
|
21
|
-
else
|
|
22
|
-
mopsTomlHash=$(shasum $mopsToml -a 256 | awk -F' ' '{print $1}')
|
|
23
|
-
fi;
|
|
24
|
-
|
|
25
|
-
cached="$rootDir/.mops/moc-$mopsTomlHash"
|
|
26
|
-
|
|
27
|
-
if [ -f $cached ]; then
|
|
28
|
-
mocPath=$(cat $cached)
|
|
29
|
-
if [[ "$mocPath" != *"/moc" ]] ; then
|
|
30
|
-
mocPath="$(mops toolchain bin moc --fallback)"
|
|
31
|
-
echo -n $mocPath > "$cached"
|
|
32
|
-
fi;
|
|
33
|
-
else
|
|
34
|
-
mkdir -p "$(dirname $cached)"
|
|
35
|
-
mocPath="$(mops toolchain bin moc --fallback)"
|
|
36
|
-
echo -n $mocPath > "$cached"
|
|
37
|
-
fi;
|
|
38
|
-
fi;
|
|
39
|
-
|
|
40
|
-
$mocPath "$@"
|
package/bundle/bin/mops.js
DELETED