From 181196d1f48e3b424f03ed14a93f066a65f0c0f9 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 15 Sep 2023 14:17:50 +0000 Subject: [PATCH] yeehaw --- .../browser/compile_prove_verify.test.ts | 4 ++-- compiler/source-resolver/src/index.ts | 10 +++++----- compiler/source-resolver/src/index_node.ts | 6 +++--- .../test/cjs_initialization.test.cjs | 10 +++++----- .../test/esm_initialization.test.mjs | 14 +++++++------- compiler/source-resolver/types/index.d.ts | 2 +- compiler/source-resolver/types/index_node.d.ts | 4 ++-- compiler/wasm/test/shared.ts | 4 ++-- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/compiler/integration-tests/test/integration/browser/compile_prove_verify.test.ts b/compiler/integration-tests/test/integration/browser/compile_prove_verify.test.ts index 8a9f7160f37..e2a88e331d0 100644 --- a/compiler/integration-tests/test/integration/browser/compile_prove_verify.test.ts +++ b/compiler/integration-tests/test/integration/browser/compile_prove_verify.test.ts @@ -1,5 +1,5 @@ import { expect } from '@esm-bundle/chai'; -import { initialiseResolver } from "@noir-lang/source-resolver"; +import { initializeResolver } from "@noir-lang/source-resolver"; import newCompiler, { compile, init_log_level as compilerLogLevel @@ -66,7 +66,7 @@ test_cases.forEach((testInfo) => { expect(noir_source).to.be.a.string; - initialiseResolver((id: String) => { + initializeResolver((id: String) => { console.log("Resolving:", id); return noir_source; }); diff --git a/compiler/source-resolver/src/index.ts b/compiler/source-resolver/src/index.ts index a83b6b03728..7d8e254f7db 100644 --- a/compiler/source-resolver/src/index.ts +++ b/compiler/source-resolver/src/index.ts @@ -9,15 +9,15 @@ export let read_file = function (source_id: any): string { if (typeof result === "string") { return result; } else { - throw new Error("Noir source resolver funtion MUST return String synchronously. Are you trying to return anything else, eg. `Promise`?"); + throw new Error("Noir source resolver function MUST return String synchronously. Are you trying to return anything else, eg. `Promise`?"); } } else { - throw new Error('Not yet initialised. Use initialiseResolver(() => string)'); + throw new Error('Not yet initialized. Use initializeResolver(() => string)'); } }; -function initialise(noir_resolver: (source_id: String) => string): (source_id: String) => string { +function initialize(noir_resolver: (source_id: String) => string): (source_id: String) => string { if (typeof noir_resolver === "function") { return noir_resolver; @@ -26,6 +26,6 @@ function initialise(noir_resolver: (source_id: String) => string): (source_id: S } } -export function initialiseResolver(resolver: (source_id: String) => string): void { - resolveFunction = initialise(resolver); +export function initializeResolver(resolver: (source_id: String) => string): void { + resolveFunction = initialize(resolver); } \ No newline at end of file diff --git a/compiler/source-resolver/src/index_node.ts b/compiler/source-resolver/src/index_node.ts index faa0d3efcdb..396af74c058 100644 --- a/compiler/source-resolver/src/index_node.ts +++ b/compiler/source-resolver/src/index_node.ts @@ -1,8 +1,8 @@ /// -import { initialiseResolver, read_file } from './index.js'; +import { initializeResolver, read_file } from './index.js'; -initialiseResolver((source_id: String) => { +initializeResolver((source_id: String) => { let fileContent = ""; try { const fs = require("fs"); @@ -15,6 +15,6 @@ initialiseResolver((source_id: String) => { return fileContent; }); -export { initialiseResolver, read_file }; +export { initializeResolver, read_file }; diff --git a/compiler/source-resolver/test/cjs_initialization.test.cjs b/compiler/source-resolver/test/cjs_initialization.test.cjs index d83f5b1b7cb..1dc7784fa40 100644 --- a/compiler/source-resolver/test/cjs_initialization.test.cjs +++ b/compiler/source-resolver/test/cjs_initialization.test.cjs @@ -1,6 +1,6 @@ const test = require('ava'); -const { initialiseResolver, read_file } = require("../lib-node/index_node.js"); +const { initializeResolver, read_file } = require("../lib-node/index_node.js"); test('It reads file from file system within read_file using default implementation.', t => { @@ -14,7 +14,7 @@ test('It calls function from initializer within read_file function.', t => { const RESULT_RESPONSE = "TEST"; - initialiseResolver((source) => { + initializeResolver((source) => { return source; }); @@ -28,7 +28,7 @@ test('It communicates error when resolver returns non-String to read_file functi const RESULT_RESPONSE = "TEST"; - initialiseResolver((source) => { + initializeResolver((source) => { return Promise.resolve(source); }); @@ -36,14 +36,14 @@ test('It communicates error when resolver returns non-String to read_file functi read_file(RESULT_RESPONSE); }, { instanceOf: Error }); - t.is(error.message, 'Noir source resolver funtion MUST return String synchronously. Are you trying to return anything else, eg. `Promise`?'); + t.is(error.message, 'Noir source resolver function MUST return String synchronously. Are you trying to return anything else, eg. `Promise`?'); }); test('It communicates error when resolver is initialized to anything but a function.', t => { const error = t.throws(() => { - initialiseResolver(null); + initializeResolver(null); }, { instanceOf: Error }); t.is(error.message, 'Provided Noir Resolver is not a function, hint: use function(module_id) => NoirSource as second parameter'); diff --git a/compiler/source-resolver/test/esm_initialization.test.mjs b/compiler/source-resolver/test/esm_initialization.test.mjs index 30f77dcf7a0..197b48e48d0 100644 --- a/compiler/source-resolver/test/esm_initialization.test.mjs +++ b/compiler/source-resolver/test/esm_initialization.test.mjs @@ -5,15 +5,15 @@ */ import test from 'ava'; -import { initialiseResolver, read_file } from "../lib-node/index.js"; +import { initializeResolver, read_file } from "../lib-node/index.js"; -test('It communicates error when read_file was called before initialiseResolver.', t => { +test('It communicates error when read_file was called before initializeResolver.', t => { const error = t.throws(() => { const readResult = read_file("./package.json"); }, { instanceOf: Error }); - t.is(error.message, 'Not yet initialised. Use initialiseResolver(() => string)'); + t.is(error.message, 'Not yet initialized. Use initializeResolver(() => string)'); }); @@ -21,7 +21,7 @@ test('It calls function from initializer within read_file function.', t => { const RESULT_RESPONSE = "TEST"; - initialiseResolver((source) => { + initializeResolver((source) => { return source; }); @@ -35,7 +35,7 @@ test('It communicates error when resolver returns non-String to read_file functi const RESULT_RESPONSE = "TEST"; - initialiseResolver((source) => { + initializeResolver((source) => { return Promise.resolve(source); }); @@ -43,14 +43,14 @@ test('It communicates error when resolver returns non-String to read_file functi read_file(RESULT_RESPONSE); }, { instanceOf: Error }); - t.is(error.message, 'Noir source resolver funtion MUST return String synchronously. Are you trying to return anything else, eg. `Promise`?'); + t.is(error.message, 'Noir source resolver function MUST return String synchronously. Are you trying to return anything else, eg. `Promise`?'); }); test('It communicates error when resolver is initialized to anything but a function.', t => { const error = t.throws(() => { - initialiseResolver(null); + initializeResolver(null); }, { instanceOf: Error }); t.is(error.message, 'Provided Noir Resolver is not a function, hint: use function(module_id) => NoirSource as second parameter'); diff --git a/compiler/source-resolver/types/index.d.ts b/compiler/source-resolver/types/index.d.ts index 14f4c17445b..22d9a98fa1f 100644 --- a/compiler/source-resolver/types/index.d.ts +++ b/compiler/source-resolver/types/index.d.ts @@ -1,2 +1,2 @@ export declare let read_file: (source_id: any) => string; -export declare function initialiseResolver(resolver: (source_id: String) => string): void; +export declare function initializeResolver(resolver: (source_id: String) => string): void; diff --git a/compiler/source-resolver/types/index_node.d.ts b/compiler/source-resolver/types/index_node.d.ts index 75e87c00efb..3a109e47e73 100644 --- a/compiler/source-resolver/types/index_node.d.ts +++ b/compiler/source-resolver/types/index_node.d.ts @@ -1,2 +1,2 @@ -import { initialiseResolver, read_file } from './index.js'; -export { initialiseResolver, read_file }; +import { initializeResolver, read_file } from './index.js'; +export { initializeResolver, read_file }; diff --git a/compiler/wasm/test/shared.ts b/compiler/wasm/test/shared.ts index fa52ec2f116..24a09cc1a04 100644 --- a/compiler/wasm/test/shared.ts +++ b/compiler/wasm/test/shared.ts @@ -1,4 +1,4 @@ -import { initialiseResolver } from "@noir-lang/source-resolver"; +import { initializeResolver } from "@noir-lang/source-resolver"; import { compile } from "@noir-lang/noir_wasm"; export const noirSourcePath = "../../noir-script/src/main.nr"; @@ -8,7 +8,7 @@ export const nargoArtifactPath = export async function compileNoirSource(noir_source: string): Promise { console.log("Compiling Noir source..."); - initialiseResolver((id: String) => { + initializeResolver((id: String) => { console.log(`Resolving source ${id}`); const source = noir_source;