ic-mops 2.2.0 → 2.2.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 (84) hide show
  1. package/.DS_Store +0 -0
  2. package/CHANGELOG.md +3 -0
  3. package/bundle/bench/bench-canister.mo +130 -0
  4. package/bundle/bench/user-bench.mo +10 -0
  5. package/bundle/bin/moc-wrapper.sh +40 -0
  6. package/bundle/bin/mops.js +3 -0
  7. package/bundle/cli.js +1569 -0
  8. package/bundle/cli.tgz +0 -0
  9. package/bundle/declarations/bench/bench.did +30 -0
  10. package/bundle/declarations/bench/bench.did.d.ts +33 -0
  11. package/bundle/declarations/bench/bench.did.js +30 -0
  12. package/bundle/declarations/bench/index.d.ts +50 -0
  13. package/bundle/declarations/bench/index.js +40 -0
  14. package/bundle/declarations/main/index.d.ts +50 -0
  15. package/bundle/declarations/main/index.js +40 -0
  16. package/bundle/declarations/main/main.did +428 -0
  17. package/bundle/declarations/main/main.did.d.ts +348 -0
  18. package/bundle/declarations/main/main.did.js +406 -0
  19. package/bundle/declarations/storage/index.d.ts +50 -0
  20. package/bundle/declarations/storage/index.js +30 -0
  21. package/bundle/declarations/storage/storage.did +46 -0
  22. package/bundle/declarations/storage/storage.did.d.ts +40 -0
  23. package/bundle/declarations/storage/storage.did.js +38 -0
  24. package/bundle/default-stylesheet.css +415 -0
  25. package/bundle/package.json +36 -0
  26. package/bundle/templates/README.md +13 -0
  27. package/bundle/templates/licenses/Apache-2.0 +202 -0
  28. package/bundle/templates/licenses/Apache-2.0-NOTICE +13 -0
  29. package/bundle/templates/licenses/MIT +21 -0
  30. package/bundle/templates/mops-publish.yml +17 -0
  31. package/bundle/templates/mops-test.yml +24 -0
  32. package/bundle/templates/src/lib.mo +15 -0
  33. package/bundle/templates/test/lib.test.mo +4 -0
  34. package/bundle/wasm_bg.wasm +0 -0
  35. package/bundle/xhr-sync-worker.js +51 -0
  36. package/commands/toolchain/index.ts +4 -0
  37. package/dist/commands/toolchain/index.js +3 -0
  38. package/dist/mops.js +0 -4
  39. package/dist/package.json +6 -7
  40. package/dist/tests/toolchain.test.js +11 -0
  41. package/dist/wasm/pkg/bundler/package.json +20 -0
  42. package/dist/wasm/pkg/bundler/wasm.d.ts +3 -0
  43. package/dist/wasm/pkg/bundler/wasm.js +5 -0
  44. package/dist/wasm/pkg/bundler/wasm_bg.js +93 -0
  45. package/dist/wasm/pkg/bundler/wasm_bg.wasm +0 -0
  46. package/dist/wasm/pkg/bundler/wasm_bg.wasm.d.ts +8 -0
  47. package/dist/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
  48. package/dist/wasm/pkg/web/wasm_bg.wasm +0 -0
  49. package/mops.ts +0 -6
  50. package/package.json +8 -9
  51. package/tests/build/success/.dfx/local/canister_ids.json +17 -0
  52. package/tests/build/success/.dfx/local/canisters/bar/bar.did +3 -0
  53. package/tests/build/success/.dfx/local/canisters/bar/bar.most +4 -0
  54. package/tests/build/success/.dfx/local/canisters/bar/bar.wasm +0 -0
  55. package/tests/build/success/.dfx/local/canisters/bar/constructor.did +3 -0
  56. package/tests/build/success/.dfx/local/canisters/bar/index.js +42 -0
  57. package/tests/build/success/.dfx/local/canisters/bar/init_args.txt +1 -0
  58. package/tests/build/success/.dfx/local/canisters/bar/service.did +3 -0
  59. package/tests/build/success/.dfx/local/canisters/bar/service.did.d.ts +7 -0
  60. package/tests/build/success/.dfx/local/canisters/bar/service.did.js +4 -0
  61. package/tests/build/success/.dfx/local/canisters/foo/constructor.did +3 -0
  62. package/tests/build/success/.dfx/local/canisters/foo/foo.did +3 -0
  63. package/tests/build/success/.dfx/local/canisters/foo/foo.most +4 -0
  64. package/tests/build/success/.dfx/local/canisters/foo/foo.wasm +0 -0
  65. package/tests/build/success/.dfx/local/canisters/foo/index.js +42 -0
  66. package/tests/build/success/.dfx/local/canisters/foo/init_args.txt +1 -0
  67. package/tests/build/success/.dfx/local/canisters/foo/service.did +3 -0
  68. package/tests/build/success/.dfx/local/canisters/foo/service.did.d.ts +7 -0
  69. package/tests/build/success/.dfx/local/canisters/foo/service.did.js +4 -0
  70. package/tests/build/success/.dfx/local/lsp/ucwa4-rx777-77774-qaada-cai.did +3 -0
  71. package/tests/build/success/.dfx/local/lsp/ulvla-h7777-77774-qaacq-cai.did +3 -0
  72. package/tests/build/success/.dfx/local/network-id +4 -0
  73. package/tests/toolchain-local-subpath/bin/moc +2 -0
  74. package/tests/toolchain-local-subpath/mops.toml +2 -0
  75. package/tests/toolchain.test.ts +13 -0
  76. package/wasm/Cargo.lock +54 -101
  77. package/wasm/pkg/bundler/package.json +20 -0
  78. package/wasm/pkg/bundler/wasm.d.ts +3 -0
  79. package/wasm/pkg/bundler/wasm.js +5 -0
  80. package/wasm/pkg/bundler/wasm_bg.js +93 -0
  81. package/wasm/pkg/bundler/wasm_bg.wasm +0 -0
  82. package/wasm/pkg/bundler/wasm_bg.wasm.d.ts +8 -0
  83. package/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
  84. package/wasm/pkg/web/wasm_bg.wasm +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) <year> <copyright-owner>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,17 @@
1
+ name: publish on mops
2
+
3
+ on:
4
+ release:
5
+ types: [released]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
13
+ - uses: dfinity/setup-mops@v1
14
+ with:
15
+ # Make sure you set the MOPS_IDENTITY_PEM secret in your repository settings https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository
16
+ identity-pem: ${{ secrets.MOPS_IDENTITY_PEM }}
17
+ - run: mops publish
@@ -0,0 +1,24 @@
1
+ name: mops test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ pull_request:
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16
+ - uses: dfinity/setup-mops@v1
17
+ with:
18
+ mops-version: 1
19
+
20
+ - name: install mops packages
21
+ run: mops install
22
+
23
+ - name: run tests
24
+ run: mops test
@@ -0,0 +1,15 @@
1
+ module {
2
+ // This comment will not be included in the documentation
3
+ // Use triple slash for documentation
4
+
5
+ /// Add two natural numbers
6
+ ///
7
+ /// Example:
8
+ /// ```motoko
9
+ /// assert add(1, 2) == 3;
10
+ /// assert add(7, 3) == 10;
11
+ /// ```
12
+ public func add(x : Nat, y : Nat) : Nat {
13
+ return x + y;
14
+ };
15
+ };
@@ -0,0 +1,4 @@
1
+ import { add } "../src";
2
+
3
+ assert add(1, 2) == 3;
4
+ assert add(3, 22) == 25;
Binary file
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ // Persistent worker thread for handling synchronous XHR requests.
3
+ //
4
+ // This worker runs in a separate thread and performs async HTTP requests on behalf of the main
5
+ // thread, which blocks on Atomics.wait() until we signal completion. A single JSDOM instance is
6
+ // created at startup and reused across requests to avoid the ~400ms initialization cost each time.
7
+ //
8
+ // The signaling protocol (shared with sendSyncWorkerRequest in XMLHttpRequest-impl.js):
9
+ // 1. Main thread sends us a SharedArrayBuffer, a MessagePort, and the serialized request config.
10
+ // 2. We perform the XHR asynchronously.
11
+ // 3. When done, we post the serialized response to the MessagePort, then signal the main thread
12
+ // by writing 1 to the SharedArrayBuffer with Atomics.store() and waking it with Atomics.notify().
13
+
14
+ const { parentPort } = require("node:worker_threads");
15
+ const { JSDOM } = require("../../../..");
16
+ const idlUtils = require("../../../generated/idl/utils");
17
+
18
+ const dom = new JSDOM();
19
+ const IDLE_TIMEOUT_MS = 5000;
20
+
21
+ let idleTimer = setTimeout(() => process.exit(0), IDLE_TIMEOUT_MS);
22
+ idleTimer.unref();
23
+
24
+ parentPort.on("message", ({ sharedBuffer, responsePort, config }) => {
25
+ clearTimeout(idleTimer);
26
+
27
+ const int32 = new Int32Array(sharedBuffer);
28
+
29
+ const xhr = new dom.window.XMLHttpRequest();
30
+ const xhrImpl = idlUtils.implForWrapper(xhr);
31
+ xhrImpl._adoptSerializedRequest(config);
32
+
33
+ function done() {
34
+ const response = xhrImpl._serializeResponse();
35
+ const transfer = response.responseBytes ? [response.responseBytes.buffer] : [];
36
+ responsePort.postMessage(response, transfer);
37
+ Atomics.store(int32, 0, 1);
38
+ Atomics.notify(int32, 0);
39
+
40
+ idleTimer = setTimeout(() => process.exit(0), IDLE_TIMEOUT_MS);
41
+ idleTimer.unref();
42
+ }
43
+
44
+ try {
45
+ xhr.addEventListener("loadend", done, false);
46
+ xhr.send(xhrImpl._body);
47
+ } catch (error) {
48
+ xhrImpl._error = error;
49
+ done();
50
+ }
51
+ });
@@ -174,6 +174,10 @@ async function download(
174
174
  version: string,
175
175
  { silent = false, verbose = false } = {},
176
176
  ) {
177
+ if (version.match(FILE_PATH_REGEX)) {
178
+ return;
179
+ }
180
+
177
181
  let toolUtils = getToolUtils(tool);
178
182
  let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
179
183
 
@@ -136,6 +136,9 @@ async function init({ reset = false, silent = false } = {}) {
136
136
  }
137
137
  }
138
138
  async function download(tool, version, { silent = false, verbose = false } = {}) {
139
+ if (version.match(FILE_PATH_REGEX)) {
140
+ return;
141
+ }
139
142
  let toolUtils = getToolUtils(tool);
140
143
  let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
141
144
  silent || logUpdate("Installing", tool, version);
package/dist/mops.js CHANGED
@@ -4,7 +4,6 @@ import fs from "node:fs";
4
4
  import TOML from "@iarna/toml";
5
5
  import chalk from "chalk";
6
6
  import prompts from "prompts";
7
- import fetch from "node-fetch";
8
7
  import { decodeFile } from "./pem.js";
9
8
  import { cliError } from "./error.js";
10
9
  import { mainActor, storageActor } from "./api/actors.js";
@@ -12,9 +11,6 @@ import { getNetwork } from "./api/network.js";
12
11
  import { getHighestVersion } from "./api/getHighestVersion.js";
13
12
  import { getPackageId } from "./helpers/get-package-id.js";
14
13
  import { FILE_PATH_REGEX } from "./constants.js";
15
- if (!globalThis.fetch) {
16
- globalThis.fetch = fetch;
17
- }
18
14
  // (!) make changes in pair with backend
19
15
  export let apiVersion = "1.3";
20
16
  export let globalConfigDir = "";
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "bin/mops.js",
@@ -48,29 +48,28 @@
48
48
  "filesize": "10.1.6",
49
49
  "fs-extra": "11.2.0",
50
50
  "get-folder-size": "5.0.0",
51
- "glob": "11.0.1",
51
+ "glob": "13.0.6",
52
52
  "globby": "14.0.2",
53
53
  "got": "14.4.6",
54
- "jsdom": "26.1.0",
54
+ "jsdom": "28.1.0",
55
55
  "log-update": "6.1.0",
56
56
  "markdown-table": "3.0.4",
57
57
  "mdast-util-from-markdown": "2.0.2",
58
58
  "mdast-util-to-markdown": "2.1.2",
59
59
  "minimatch": "10.0.1",
60
60
  "ncp": "2.0.0",
61
- "node-fetch": "3.3.2",
62
61
  "octokit": "3.1.2",
63
62
  "pem-file": "1.0.1",
64
63
  "pic-ic": "0.5.4",
65
64
  "pic-js-mops": "0.14.8",
66
65
  "prettier": "3.5.3",
67
- "prettier-plugin-motoko": "0.11.0",
66
+ "prettier-plugin-motoko": "0.12.5",
68
67
  "promisify-child-process": "4.1.2",
69
68
  "prompts": "2.4.2",
70
69
  "semver": "7.7.1",
71
70
  "stream-to-promise": "3.0.0",
72
71
  "string-width": "7.2.0",
73
- "tar": "7.5.6",
72
+ "tar": "7.5.9",
74
73
  "terminal-size": "4.0.0",
75
74
  "vscode-languageserver-textdocument": "1.0.12"
76
75
  },
@@ -80,7 +79,7 @@
80
79
  "@types/decompress": "4.2.7",
81
80
  "@types/fs-extra": "11.0.4",
82
81
  "@types/glob": "8.1.0",
83
- "@types/jsdom": "21.1.7",
82
+ "@types/jsdom": "28.0.0",
84
83
  "@types/ncp": "2.0.8",
85
84
  "@types/node": "24.0.3",
86
85
  "@types/prompts": "2.4.9",
@@ -8,4 +8,15 @@ describe("toolchain", () => {
8
8
  expect(result.exitCode).toBe(0);
9
9
  expect(result.stdout.trim()).toBe("./mock");
10
10
  });
11
+ test("file URI with subdirectory path", async () => {
12
+ const cwd = path.join(import.meta.dirname, "toolchain-local-subpath");
13
+ const result = await cli(["toolchain", "bin", "moc"], { cwd });
14
+ expect(result.exitCode).toBe(0);
15
+ expect(result.stdout.trim()).toBe("./bin/moc");
16
+ });
17
+ test("file URI does not trigger download during install", async () => {
18
+ const cwd = path.join(import.meta.dirname, "toolchain-local-subpath");
19
+ const result = await cli(["install"], { cwd });
20
+ expect(result.stderr).not.toContain("Invalid Version");
21
+ });
11
22
  });
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "wasm",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "Ryan Vandersmith <ryan.vandersmith@dfinity.org>"
6
+ ],
7
+ "version": "0.1.0",
8
+ "files": [
9
+ "wasm_bg.wasm",
10
+ "wasm.js",
11
+ "wasm_bg.js",
12
+ "wasm.d.ts"
13
+ ],
14
+ "main": "wasm.js",
15
+ "types": "wasm.d.ts",
16
+ "sideEffects": [
17
+ "./wasm.js",
18
+ "./snippets/*"
19
+ ]
20
+ }
@@ -0,0 +1,3 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export function is_candid_compatible(new_interface: string, original_interface: string): boolean;
@@ -0,0 +1,5 @@
1
+ import * as wasm from "./wasm_bg.wasm";
2
+ export * from "./wasm_bg.js";
3
+ import { __wbg_set_wasm } from "./wasm_bg.js";
4
+ __wbg_set_wasm(wasm);
5
+ wasm.__wbindgen_start();
@@ -0,0 +1,93 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+
7
+ let WASM_VECTOR_LEN = 0;
8
+
9
+ let cachedUint8ArrayMemory0 = null;
10
+
11
+ function getUint8ArrayMemory0() {
12
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
13
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
14
+ }
15
+ return cachedUint8ArrayMemory0;
16
+ }
17
+
18
+ const cachedTextEncoder = new TextEncoder();
19
+
20
+ if (!('encodeInto' in cachedTextEncoder)) {
21
+ cachedTextEncoder.encodeInto = function (arg, view) {
22
+ const buf = cachedTextEncoder.encode(arg);
23
+ view.set(buf);
24
+ return {
25
+ read: arg.length,
26
+ written: buf.length
27
+ };
28
+ }
29
+ }
30
+
31
+ function passStringToWasm0(arg, malloc, realloc) {
32
+
33
+ if (realloc === undefined) {
34
+ const buf = cachedTextEncoder.encode(arg);
35
+ const ptr = malloc(buf.length, 1) >>> 0;
36
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
37
+ WASM_VECTOR_LEN = buf.length;
38
+ return ptr;
39
+ }
40
+
41
+ let len = arg.length;
42
+ let ptr = malloc(len, 1) >>> 0;
43
+
44
+ const mem = getUint8ArrayMemory0();
45
+
46
+ let offset = 0;
47
+
48
+ for (; offset < len; offset++) {
49
+ const code = arg.charCodeAt(offset);
50
+ if (code > 0x7F) break;
51
+ mem[ptr + offset] = code;
52
+ }
53
+
54
+ if (offset !== len) {
55
+ if (offset !== 0) {
56
+ arg = arg.slice(offset);
57
+ }
58
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
59
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
60
+ const ret = cachedTextEncoder.encodeInto(arg, view);
61
+
62
+ offset += ret.written;
63
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
64
+ }
65
+
66
+ WASM_VECTOR_LEN = offset;
67
+ return ptr;
68
+ }
69
+ /**
70
+ * @param {string} new_interface
71
+ * @param {string} original_interface
72
+ * @returns {boolean}
73
+ */
74
+ export function is_candid_compatible(new_interface, original_interface) {
75
+ const ptr0 = passStringToWasm0(new_interface, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
76
+ const len0 = WASM_VECTOR_LEN;
77
+ const ptr1 = passStringToWasm0(original_interface, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
78
+ const len1 = WASM_VECTOR_LEN;
79
+ const ret = wasm.is_candid_compatible(ptr0, len0, ptr1, len1);
80
+ return ret !== 0;
81
+ }
82
+
83
+ export function __wbindgen_init_externref_table() {
84
+ const table = wasm.__wbindgen_externrefs;
85
+ const offset = table.grow(4);
86
+ table.set(0, undefined);
87
+ table.set(offset + 0, undefined);
88
+ table.set(offset + 1, null);
89
+ table.set(offset + 2, true);
90
+ table.set(offset + 3, false);
91
+ ;
92
+ };
93
+
@@ -0,0 +1,8 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const is_candid_compatible: (a: number, b: number, c: number, d: number) => number;
5
+ export const __wbindgen_externrefs: WebAssembly.Table;
6
+ export const __wbindgen_malloc: (a: number, b: number) => number;
7
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
8
+ export const __wbindgen_start: () => void;
Binary file
Binary file
package/mops.ts CHANGED
@@ -5,8 +5,6 @@ import { Identity } from "@icp-sdk/core/agent";
5
5
  import TOML from "@iarna/toml";
6
6
  import chalk from "chalk";
7
7
  import prompts from "prompts";
8
- import fetch from "node-fetch";
9
-
10
8
  import { decodeFile } from "./pem.js";
11
9
  import { cliError } from "./error.js";
12
10
  import { Config, Dependency } from "./types.js";
@@ -16,10 +14,6 @@ import { getHighestVersion } from "./api/getHighestVersion.js";
16
14
  import { getPackageId } from "./helpers/get-package-id.js";
17
15
  import { FILE_PATH_REGEX } from "./constants.js";
18
16
 
19
- if (!globalThis.fetch) {
20
- globalThis.fetch = fetch as any;
21
- }
22
-
23
17
  // (!) make changes in pair with backend
24
18
  export let apiVersion = "1.3";
25
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/bin/mops.js",
@@ -36,8 +36,8 @@
36
36
  "build:wasm:web": "wasm-pack build wasm --target web --out-dir pkg/web && rm wasm/pkg/web/.gitignore",
37
37
  "dist": "npm run build:wasm && tsc && mkdir -p dist/wasm && cp -r wasm/pkg dist/wasm",
38
38
  "bundle": "rm -rf ./bundle && bun build ./environments/web/cli.ts --outdir ./bundle --target node --minify --external @napi-rs/lzma --external fsevents --format esm --define '__dirname=import.meta.dirname' && run-s bundle:fix bundle:copy bundle:package-json bundle:tar",
39
- "bundle:fix": "rexreplace 'new URL\\(\"\\.\\./templates' 'new URL(\"./templates' bundle/cli.js && rexreplace 'resolve\\(\".*?/xhr-sync-worker\\.js\"\\)' 'resolve(\"./xhr-sync-worker.js\")' bundle/cli.js && rexreplace '\"import.meta.dirname\",\"wasm_bg.wasm\"' 'import.meta.dirname || new URL(\".\", import.meta.url).pathname,\"wasm_bg.wasm\"' bundle/cli.js",
40
- "bundle:copy": "cp -r commands/bench bundle && cp -r bin declarations templates package.json bundle && cp -r node_modules/prettier-plugin-motoko/wasm/pkg/nodejs/wasm_bg.wasm node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js bundle",
39
+ "bundle:fix": "rexreplace 'new URL\\(\"\\.\\./templates' 'new URL(\"./templates' bundle/cli.js && rexreplace 'resolve\\(\".*?/xhr-sync-worker\\.js\"\\)' 'resolve(\"./xhr-sync-worker.js\")' bundle/cli.js && rexreplace '\"import.meta.dirname\",\"wasm_bg.wasm\"' 'import.meta.dirname || new URL(\".\", import.meta.url).pathname,\"wasm_bg.wasm\"' bundle/cli.js && rexreplace 'resolve\\(\"import.meta.dirname\",\".*?/default-stylesheet\\.css\"\\)' 'resolve(import.meta.dirname,\"./default-stylesheet.css\")' bundle/cli.js",
40
+ "bundle:copy": "cp -r commands/bench bundle && cp -r bin declarations templates package.json bundle && cp -r node_modules/prettier-plugin-motoko/wasm/pkg/nodejs/wasm_bg.wasm node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js node_modules/jsdom/lib/jsdom/browser/default-stylesheet.css bundle",
41
41
  "bundle:package-json": "tsx bundle-package-json.ts",
42
42
  "bundle:tar": "rm -f bundle/cli.tgz && touch -t 200101010101 bundle/cli.tgz && find bundle -exec touch -d '1970-01-01 00:00:00' {} + && tar --sort name --exclude bundle/cli.tgz -cvf - bundle | gzip -n > bundle/cli.tgz",
43
43
  "copy": "cp -r commands/bench dist/commands && cp -r declarations templates package.json bin dist | true",
@@ -69,29 +69,28 @@
69
69
  "filesize": "10.1.6",
70
70
  "fs-extra": "11.2.0",
71
71
  "get-folder-size": "5.0.0",
72
- "glob": "11.0.1",
72
+ "glob": "13.0.6",
73
73
  "globby": "14.0.2",
74
74
  "got": "14.4.6",
75
- "jsdom": "26.1.0",
75
+ "jsdom": "28.1.0",
76
76
  "log-update": "6.1.0",
77
77
  "markdown-table": "3.0.4",
78
78
  "mdast-util-from-markdown": "2.0.2",
79
79
  "mdast-util-to-markdown": "2.1.2",
80
80
  "minimatch": "10.0.1",
81
81
  "ncp": "2.0.0",
82
- "node-fetch": "3.3.2",
83
82
  "octokit": "3.1.2",
84
83
  "pem-file": "1.0.1",
85
84
  "pic-ic": "0.5.4",
86
85
  "pic-js-mops": "0.14.8",
87
86
  "prettier": "3.5.3",
88
- "prettier-plugin-motoko": "0.11.0",
87
+ "prettier-plugin-motoko": "0.12.5",
89
88
  "promisify-child-process": "4.1.2",
90
89
  "prompts": "2.4.2",
91
90
  "semver": "7.7.1",
92
91
  "stream-to-promise": "3.0.0",
93
92
  "string-width": "7.2.0",
94
- "tar": "7.5.6",
93
+ "tar": "7.5.9",
95
94
  "terminal-size": "4.0.0",
96
95
  "vscode-languageserver-textdocument": "1.0.12"
97
96
  },
@@ -101,7 +100,7 @@
101
100
  "@types/decompress": "4.2.7",
102
101
  "@types/fs-extra": "11.0.4",
103
102
  "@types/glob": "8.1.0",
104
- "@types/jsdom": "21.1.7",
103
+ "@types/jsdom": "28.0.0",
105
104
  "@types/ncp": "2.0.8",
106
105
  "@types/node": "24.0.3",
107
106
  "@types/prompts": "2.4.9",
@@ -0,0 +1,17 @@
1
+ {
2
+ "__Candid_UI": {
3
+ "local": "ufxgi-4p777-77774-qaadq-cai"
4
+ },
5
+ "a": {
6
+ "local": "uzt4z-lp777-77774-qaabq-cai"
7
+ },
8
+ "b": {
9
+ "local": "umunu-kh777-77774-qaaca-cai"
10
+ },
11
+ "bar": {
12
+ "local": "ulvla-h7777-77774-qaacq-cai"
13
+ },
14
+ "foo": {
15
+ "local": "ucwa4-rx777-77774-qaada-cai"
16
+ }
17
+ }
@@ -0,0 +1,3 @@
1
+ service : {
2
+ call: () -> (text);
3
+ }
@@ -0,0 +1,4 @@
1
+ // Version: 1.0.0
2
+ actor {
3
+
4
+ };
@@ -0,0 +1,3 @@
1
+ service : {
2
+ call: () -> (text);
3
+ }
@@ -0,0 +1,42 @@
1
+ import { Actor, HttpAgent } from "@dfinity/agent";
2
+
3
+ // Imports and re-exports candid interface
4
+ import { idlFactory } from './bar.did.js';
5
+ export { idlFactory } from './bar.did.js';
6
+ // CANISTER_ID is replaced by webpack based on node environment
7
+ export const canisterId = process.env.CANISTER_ID_BAR;
8
+
9
+ /**
10
+ * @deprecated since dfx 0.11.1
11
+ * Do not import from `.dfx`, instead switch to using `dfx generate` to generate your JS interface.
12
+ * @param {string | import("@dfinity/principal").Principal} canisterId Canister ID of Agent
13
+ * @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig} | { agent?: import("@dfinity/agent").Agent; actorOptions?: import("@dfinity/agent").ActorConfig }} [options]
14
+ * @return {import("@dfinity/agent").ActorSubclass<import("./bar.did.js")._SERVICE>}
15
+ */
16
+ export const createActor = (canisterId, options = {}) => {
17
+ console.warn(`Deprecation warning: you are currently importing code from .dfx. Going forward, refactor to use the dfx generate command for JavaScript bindings.
18
+
19
+ See https://internetcomputer.org/docs/current/developer-docs/updates/release-notes/ for migration instructions`);
20
+ const agent = options.agent || new HttpAgent({ ...options.agentOptions });
21
+
22
+ // Fetch root key for certificate validation during development
23
+ if (process.env.DFX_NETWORK !== "ic") {
24
+ agent.fetchRootKey().catch(err => {
25
+ console.warn("Unable to fetch root key. Check to ensure that your local replica is running");
26
+ console.error(err);
27
+ });
28
+ }
29
+
30
+ // Creates an actor with using the candid interface and the HttpAgent
31
+ return Actor.createActor(idlFactory, {
32
+ agent,
33
+ canisterId,
34
+ ...(options ? options.actorOptions : {}),
35
+ });
36
+ };
37
+
38
+ /**
39
+ * A ready-to-use agent for the bar canister
40
+ * @type {import("@dfinity/agent").ActorSubclass<import("./bar.did.js")._SERVICE>}
41
+ */
42
+ export const bar = createActor(canisterId);
@@ -0,0 +1,3 @@
1
+ service : {
2
+ call: () -> (text);
3
+ }
@@ -0,0 +1,7 @@
1
+ import type { Principal } from '@dfinity/principal';
2
+ import type { ActorMethod } from '@dfinity/agent';
3
+ import type { IDL } from '@dfinity/candid';
4
+
5
+ export interface _SERVICE { 'call' : ActorMethod<[], string> }
6
+ export declare const idlFactory: IDL.InterfaceFactory;
7
+ export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -0,0 +1,4 @@
1
+ export const idlFactory = ({ IDL }) => {
2
+ return IDL.Service({ 'call' : IDL.Func([], [IDL.Text], []) });
3
+ };
4
+ export const init = ({ IDL }) => { return []; };
@@ -0,0 +1,3 @@
1
+ service : {
2
+ call: () -> (text);
3
+ }
@@ -0,0 +1,3 @@
1
+ service : {
2
+ call: () -> (text);
3
+ }
@@ -0,0 +1,4 @@
1
+ // Version: 1.0.0
2
+ actor {
3
+
4
+ };
@@ -0,0 +1,42 @@
1
+ import { Actor, HttpAgent } from "@dfinity/agent";
2
+
3
+ // Imports and re-exports candid interface
4
+ import { idlFactory } from './foo.did.js';
5
+ export { idlFactory } from './foo.did.js';
6
+ // CANISTER_ID is replaced by webpack based on node environment
7
+ export const canisterId = process.env.CANISTER_ID_FOO;
8
+
9
+ /**
10
+ * @deprecated since dfx 0.11.1
11
+ * Do not import from `.dfx`, instead switch to using `dfx generate` to generate your JS interface.
12
+ * @param {string | import("@dfinity/principal").Principal} canisterId Canister ID of Agent
13
+ * @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig} | { agent?: import("@dfinity/agent").Agent; actorOptions?: import("@dfinity/agent").ActorConfig }} [options]
14
+ * @return {import("@dfinity/agent").ActorSubclass<import("./foo.did.js")._SERVICE>}
15
+ */
16
+ export const createActor = (canisterId, options = {}) => {
17
+ console.warn(`Deprecation warning: you are currently importing code from .dfx. Going forward, refactor to use the dfx generate command for JavaScript bindings.
18
+
19
+ See https://internetcomputer.org/docs/current/developer-docs/updates/release-notes/ for migration instructions`);
20
+ const agent = options.agent || new HttpAgent({ ...options.agentOptions });
21
+
22
+ // Fetch root key for certificate validation during development
23
+ if (process.env.DFX_NETWORK !== "ic") {
24
+ agent.fetchRootKey().catch(err => {
25
+ console.warn("Unable to fetch root key. Check to ensure that your local replica is running");
26
+ console.error(err);
27
+ });
28
+ }
29
+
30
+ // Creates an actor with using the candid interface and the HttpAgent
31
+ return Actor.createActor(idlFactory, {
32
+ agent,
33
+ canisterId,
34
+ ...(options ? options.actorOptions : {}),
35
+ });
36
+ };
37
+
38
+ /**
39
+ * A ready-to-use agent for the foo canister
40
+ * @type {import("@dfinity/agent").ActorSubclass<import("./foo.did.js")._SERVICE>}
41
+ */
42
+ export const foo = createActor(canisterId);
@@ -0,0 +1,3 @@
1
+ service : {
2
+ call: () -> (text);
3
+ }