From d4e3ba3db988b1b5b1b2653900fb234041cd6df4 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 28 Aug 2024 12:54:52 -0500 Subject: [PATCH 01/12] improve wasmedge_quickjs installation process --- .eslintignore | 1 + .gitignore | 1 + .npmignore | 1 + .prettierignore | 1 + install_script.sh | 11 ---------- install_wasmedge_quickjs.sh | 8 +++++++ package-lock.json | 1 - package.json | 5 ++--- .../file_watcher/setup_file_watcher.ts | 4 ++-- .../commands/compile/get_context.ts | 15 ++----------- .../experimental/commands/compile/index.ts | 11 ++-------- .../commands/compile/javascript.ts | 12 +++-------- src/build/experimental/utils/global_paths.ts | 5 +++++ src/build/experimental/utils/types.ts | 1 - src/build/stable/commands/clean.ts | 21 ++++++------------- src/build/stable/utils/global_paths.ts | 8 +------ 16 files changed, 35 insertions(+), 71 deletions(-) delete mode 100755 install_script.sh create mode 100755 install_wasmedge_quickjs.sh diff --git a/.eslintignore b/.eslintignore index fe97082244..4b1bdec12a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,3 +9,4 @@ declarations property_tests/tests/**/src/* dist static_canister_template_licenses.yml +wasmedge_quickjs diff --git a/.gitignore b/.gitignore index a25a888abd..21cd734771 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ dist node_modules target +wasmedge_quickjs diff --git a/.npmignore b/.npmignore index 0958955d01..9ef4d3f989 100644 --- a/.npmignore +++ b/.npmignore @@ -30,3 +30,4 @@ !package.json !README.md !server.did +!wasmedge_quickjs/** diff --git a/.prettierignore b/.prettierignore index 521b488aa0..2dcec44090 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,3 +7,4 @@ target /the_azle_book/book /docs static_canister_template_licenses.yml +/wasmedge_quickjs diff --git a/install_script.sh b/install_script.sh deleted file mode 100755 index 4c2b86e591..0000000000 --- a/install_script.sh +++ /dev/null @@ -1,11 +0,0 @@ -mkdir -p "$HOME/.config/azle" - -WASMEDGE_REPO_DIR_NAME="wasmedge-quickjs_$npm_package_version" -WASMEDGE_REPO_PATH="$HOME/.config/azle/$WASMEDGE_REPO_DIR_NAME" - -if [ ! -e "$WASMEDGE_REPO_PATH" ]; then - git clone --depth 1 --filter=blob:none --sparse https://github.com/demergent-labs/wasmedge-quickjs "$WASMEDGE_REPO_PATH" - cd "$WASMEDGE_REPO_PATH" - git sparse-checkout set modules - git checkout c21ff69f442998e4cda4619166e23a9bc91418be -fi diff --git a/install_wasmedge_quickjs.sh b/install_wasmedge_quickjs.sh new file mode 100755 index 0000000000..821c14414b --- /dev/null +++ b/install_wasmedge_quickjs.sh @@ -0,0 +1,8 @@ +WASMEDGE_REPO_PATH="./wasmedge_quickjs" + +rm -rf "$WASMEDGE_REPO_PATH" + +git clone --depth 1 --filter=blob:none --sparse https://github.com/demergent-labs/wasmedge-quickjs "$WASMEDGE_REPO_PATH" +cd "$WASMEDGE_REPO_PATH" +git sparse-checkout set modules LICENSE LICENSE-QuickJS.txt +git checkout c21ff69f442998e4cda4619166e23a9bc91418be diff --git a/package-lock.json b/package-lock.json index d8dbc80ff9..fbd276256a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,6 @@ "": { "name": "azle", "version": "0.23.0", - "hasInstallScript": true, "license": "MIT", "dependencies": { "@dfinity/agent": "^1.1.0", diff --git a/package.json b/package.json index 3b054ab149..a7da1d6e89 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,8 @@ "scripts": { "typecheck": "tsc --noEmit", "lint": "if [ \"$npm_config_fix\" ]; then eslint . --ext .js,.ts --cache --fix; else eslint . --ext .js,.ts --cache; fi", - "prepare": "husky install", - "test": "test/test.sh", - "install": "./install_script.sh" + "prepare": "./install_wasmedge_quickjs.sh && husky install", + "test": "test/test.sh" }, "type": "module", "bin": { diff --git a/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts b/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts index 65a74e3590..9e87cd87d8 100644 --- a/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts +++ b/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts @@ -3,12 +3,12 @@ import { join } from 'path'; import { execSyncPretty } from '../../../../stable/utils/exec_sync_pretty'; import { AZLE_PACKAGE_PATH } from '../../../../stable/utils/global_paths'; +import { WASMEDGE_QUICKJS_PATH } from '../../../utils/global_paths'; export function setupFileWatcher( reloadedJsPath: string, canisterId: string, mainPath: string, - wasmedgeQuickJsPath: string, esmAliases: Record, esmExternals: string[], canisterName: string, @@ -45,7 +45,7 @@ export function setupFileWatcher( reloadedJsPath, canisterId, mainPath, - wasmedgeQuickJsPath, + WASMEDGE_QUICKJS_PATH, JSON.stringify(esmAliases), JSON.stringify(esmExternals), canisterName, diff --git a/src/build/experimental/commands/compile/get_context.ts b/src/build/experimental/commands/compile/get_context.ts index a4fa818066..d0e15b10e4 100644 --- a/src/build/experimental/commands/compile/get_context.ts +++ b/src/build/experimental/commands/compile/get_context.ts @@ -2,12 +2,8 @@ import { readFile } from 'fs/promises'; import { join } from 'path'; import { getCanisterId } from '../../../../../dfx'; -import { version } from '../../../../../package.json'; import { getContext as getStableContext } from '../../../stable/commands/compile/get_context'; -import { - AZLE_PACKAGE_PATH, - GLOBAL_AZLE_CONFIG_DIR -} from '../../../stable/utils/global_paths'; +import { AZLE_PACKAGE_PATH } from '../../../stable/utils/global_paths'; import { CanisterConfig } from '../../../stable/utils/types'; import { Context, WasmData } from '../../utils/types'; import { getConsumer } from './open_value_sharing/consumer'; @@ -37,19 +33,12 @@ export async function getContext( managementDid }; - const wasmedgeQuickJsName = `wasmedge-quickjs_${version}`; - const wasmedgeQuickJsPath = join( - GLOBAL_AZLE_CONFIG_DIR, - wasmedgeQuickJsName - ); - return { ...stableContext, canisterId, esmAliases, esmExternals, reloadedJsPath, - wasmData, - wasmedgeQuickJsPath + wasmData }; } diff --git a/src/build/experimental/commands/compile/index.ts b/src/build/experimental/commands/compile/index.ts index e1344fb665..b5d3ec67a9 100644 --- a/src/build/experimental/commands/compile/index.ts +++ b/src/build/experimental/commands/compile/index.ts @@ -27,18 +27,12 @@ export async function runCommand( main, reloadedJsPath, wasmBinaryPath, - wasmData, - wasmedgeQuickJsPath + wasmData } = await getContext(canisterName, canisterConfig); await createHiddenAzleDirectories(canisterPath); - const javaScript = await compileJavaScript( - main, - wasmedgeQuickJsPath, - esmAliases, - esmExternals - ); + const javaScript = await compileJavaScript(main, esmAliases, esmExternals); const { candid, methodMeta } = await getCandidAndMethodMeta( canisterName, @@ -74,7 +68,6 @@ export async function runCommand( reloadedJsPath, canisterId, main, - wasmedgeQuickJsPath, esmAliases, esmExternals, canisterName, diff --git a/src/build/experimental/commands/compile/javascript.ts b/src/build/experimental/commands/compile/javascript.ts index 3987dc4718..9b0d10461a 100644 --- a/src/build/experimental/commands/compile/javascript.ts +++ b/src/build/experimental/commands/compile/javascript.ts @@ -8,20 +8,15 @@ import { handleClassApiCanister } from '../../../stable/commands/compile/javascript'; import { AZLE_PACKAGE_PATH } from '../../../stable/utils/global_paths'; +import { WASMEDGE_QUICKJS_PATH } from '../../utils/global_paths'; export async function compile( main: string, - wasmedgeQuickJsPath: string, esmAliases: Record, esmExternals: string[] ): Promise { const prelude = getPrelude(main); - const buildOptions = getBuildOptions( - prelude, - wasmedgeQuickJsPath, - esmAliases, - esmExternals - ); + const buildOptions = getBuildOptions(prelude, esmAliases, esmExternals); const bundled = await bundle(buildOptions); return bundled @@ -95,12 +90,11 @@ export function getPrelude(main: string): string { export function getBuildOptions( ts: string, - wasmedgeQuickJsPath: string, esmAliases: Record, esmExternals: string[] ): BuildOptions { const finalWasmedgeQuickJsPath = - process.env.AZLE_WASMEDGE_QUICKJS_DIR ?? wasmedgeQuickJsPath; + process.env.AZLE_WASMEDGE_QUICKJS_PATH ?? WASMEDGE_QUICKJS_PATH; const externalImplemented = [ '_node:fs', diff --git a/src/build/experimental/utils/global_paths.ts b/src/build/experimental/utils/global_paths.ts index 12ed8baae6..b603f5433f 100644 --- a/src/build/experimental/utils/global_paths.ts +++ b/src/build/experimental/utils/global_paths.ts @@ -7,3 +7,8 @@ export const EXPERIMENTAL_CANISTER_TEMPLATE_PATH = join( 'canister_templates', 'experimental.wasm' ); + +export const WASMEDGE_QUICKJS_PATH = join( + AZLE_PACKAGE_PATH, + 'wasmedge_quickjs' +); diff --git a/src/build/experimental/utils/types.ts b/src/build/experimental/utils/types.ts index c72ba77f12..f1c6d50a7e 100644 --- a/src/build/experimental/utils/types.ts +++ b/src/build/experimental/utils/types.ts @@ -10,7 +10,6 @@ export type Context = { esmExternals: string[]; reloadedJsPath: string; wasmData: WasmData; - wasmedgeQuickJsPath: string; } & StableContext; export type WasmData = { diff --git a/src/build/stable/commands/clean.ts b/src/build/stable/commands/clean.ts index 2d28bfbb6c..7ee8fe5726 100644 --- a/src/build/stable/commands/clean.ts +++ b/src/build/stable/commands/clean.ts @@ -1,33 +1,24 @@ import { rm } from 'fs/promises'; -import { GLOBAL_AZLE_CONFIG_DIR } from '../utils/global_paths'; - export async function runCommand(): Promise { - await rm(GLOBAL_AZLE_CONFIG_DIR, { - recursive: true, - force: true - }); - - console.info(`~/.config/azle directory deleted`); - - await rm('.azle', { + await rm('./.azle', { recursive: true, force: true }); - console.info(`.azle directory deleted`); + console.info(`./.azle directory deleted`); - await rm('.dfx', { + await rm('./.dfx', { recursive: true, force: true }); - console.info(`.dfx directory deleted`); + console.info(`./.dfx directory deleted`); - await rm('node_modules', { + await rm('./node_modules', { recursive: true, force: true }); - console.info(`node_modules directory deleted`); + console.info(`./node_modules directory deleted`); } diff --git a/src/build/stable/utils/global_paths.ts b/src/build/stable/utils/global_paths.ts index 11c066e7be..872b762080 100644 --- a/src/build/stable/utils/global_paths.ts +++ b/src/build/stable/utils/global_paths.ts @@ -1,12 +1,6 @@ -import { homedir } from 'os'; -import { dirname, join, resolve } from 'path'; +import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -export const GLOBAL_AZLE_CONFIG_DIR = resolve( - homedir(), - join('.config', 'azle') -); - export const AZLE_PACKAGE_PATH = join( dirname(fileURLToPath(import.meta.url)), '..', From 1b3ba12cfc788933e6ea12fbae75410d05335d48 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 28 Aug 2024 16:23:20 -0500 Subject: [PATCH 02/12] use add instead of set for sparse checkout --- install_wasmedge_quickjs.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install_wasmedge_quickjs.sh b/install_wasmedge_quickjs.sh index 821c14414b..8b823de07b 100755 --- a/install_wasmedge_quickjs.sh +++ b/install_wasmedge_quickjs.sh @@ -4,5 +4,7 @@ rm -rf "$WASMEDGE_REPO_PATH" git clone --depth 1 --filter=blob:none --sparse https://github.com/demergent-labs/wasmedge-quickjs "$WASMEDGE_REPO_PATH" cd "$WASMEDGE_REPO_PATH" -git sparse-checkout set modules LICENSE LICENSE-QuickJS.txt +git sparse-checkout set modules +git sparse-checkout add LICENSE +git sparse-checkout add LICENSE-QuickJS.txt git checkout c21ff69f442998e4cda4619166e23a9bc91418be From 6bf5eea76d7e5953396c8bd64cb2f007f618b84e Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 28 Aug 2024 17:02:10 -0500 Subject: [PATCH 03/12] change global experimental check to be a side-effect import --- experimental/canisters/icrc/errors.ts | 6 +----- experimental/canisters/icrc/icrc_1.ts | 6 +----- experimental/canisters/icrc/icrc_2.ts | 6 +----- experimental/canisters/icrc/index.ts | 6 +----- .../canisters/ledger/address/index.ts | 6 +----- experimental/canisters/ledger/index.ts | 7 +------ experimental/canisters/management/bitcoin.ts | 7 +------ .../canisters/management/canister_info.ts | 7 +------ .../management/canister_management.ts | 6 +----- .../canisters/management/http_request.ts | 6 +----- experimental/canisters/management/index.ts | 7 +------ experimental/canisters/management/t_ecdsa.ts | 6 +----- experimental/index.ts | 6 +----- .../compile/file_watcher/file_watcher.ts | 20 ++++++------------- .../file_watcher/setup_file_watcher.ts | 2 -- .../stable/commands/compile/javascript.ts | 18 +++++++++++++++-- src/lib/experimental/candid/candid_type.ts | 6 +----- src/lib/experimental/candid/index.ts | 6 +----- src/lib/experimental/candid/manual.ts | 6 +----- src/lib/experimental/candid/recursive.ts | 6 +----- src/lib/experimental/candid/serde/decode.ts | 6 +----- src/lib/experimental/candid/serde/encode.ts | 6 +----- src/lib/experimental/candid/serde/index.ts | 6 +----- .../candid/serde/visitors/decode_visitor.ts | 6 +----- .../candid/serde/visitors/encode_visitor.ts | 6 +----- .../candid/serde/visitors/index.ts | 6 +----- .../candid/serde/visitors/types.ts | 6 +----- .../candid/serde/visitors/visit/record.ts | 6 +----- .../candid/serde/visitors/visit/recursive.ts | 6 +----- .../candid/serde/visitors/visit/tuple.ts | 6 +----- .../visitors/visit/variant/azle_result.ts | 6 +----- .../visitors/visit/variant/azle_variant.ts | 6 +----- .../serde/visitors/visit/variant/index.ts | 6 +----- .../candid/serde/visitors/visit/vec.ts | 6 +----- src/lib/experimental/candid/to_idl_type.ts | 6 +----- src/lib/experimental/candid/type_mapping.ts | 6 +----- .../candid/types/constructed/blob.ts | 6 +----- .../candid/types/constructed/index.ts | 6 +----- .../candid/types/constructed/opt.ts | 6 +----- .../candid/types/constructed/record.ts | 6 +----- .../candid/types/constructed/to_idl_map.ts | 6 +----- .../candid/types/constructed/tuple.ts | 6 +----- .../candid/types/constructed/variant.ts | 6 +----- .../candid/types/constructed/vec.ts | 6 +----- .../candid/types/primitive/bool.ts | 6 +----- .../candid/types/primitive/empty.ts | 6 +----- .../candid/types/primitive/floats/float32.ts | 6 +----- .../candid/types/primitive/floats/float64.ts | 6 +----- .../candid/types/primitive/floats/index.ts | 6 +----- .../candid/types/primitive/index.ts | 6 +----- .../candid/types/primitive/ints/index.ts | 6 +----- .../candid/types/primitive/ints/int.ts | 6 +----- .../candid/types/primitive/ints/int16.ts | 6 +----- .../candid/types/primitive/ints/int32.ts | 6 +----- .../candid/types/primitive/ints/int64.ts | 6 +----- .../candid/types/primitive/ints/int8.ts | 6 +----- .../candid/types/primitive/nats/index.ts | 6 +----- .../candid/types/primitive/nats/nat.ts | 6 +----- .../candid/types/primitive/nats/nat16.ts | 6 +----- .../candid/types/primitive/nats/nat32.ts | 6 +----- .../candid/types/primitive/nats/nat64.ts | 6 +----- .../candid/types/primitive/nats/nat8.ts | 6 +----- .../candid/types/primitive/null.ts | 6 +----- .../candid/types/primitive/reserved.ts | 6 +----- .../candid/types/primitive/text.ts | 6 +----- .../candid/types/primitive/void.ts | 6 +----- .../candid/types/reference/func.ts | 6 +----- .../candid/types/reference/index.ts | 6 +----- .../candid/types/reference/principal.ts | 6 +----- .../service/canister_function/index.ts | 6 +----- .../service/canister_function/query_update.ts | 6 +----- .../canister_function/system_methods.ts | 6 +----- .../candid/types/reference/service/index.ts | 6 +----- .../canister_methods/execute_method.ts | 6 +----- .../experimental/canister_methods/index.ts | 6 +----- .../experimental/canister_methods/is_async.ts | 6 +----- .../canister_methods/methods/heartbeat.ts | 6 +----- .../canister_methods/methods/index.ts | 6 +----- .../canister_methods/methods/init.ts | 6 +----- .../methods/inspect_message.ts | 6 +----- .../canister_methods/methods/post_upgrade.ts | 6 +----- .../canister_methods/methods/pre_upgrade.ts | 6 +----- .../canister_methods/methods/query.ts | 6 +----- .../canister_methods/methods/update.ts | 6 +----- .../canister_methods/types/callback.ts | 6 +----- .../types/canister_method_info.ts | 6 +----- .../canister_methods/types/index.ts | 6 +----- .../canister_methods/types/method_args.ts | 6 +----- src/lib/experimental/experimental.ts | 20 ++++++++++++++++++- src/lib/experimental/fetch/file.ts | 6 +----- src/lib/experimental/fetch/headers.ts | 6 +----- src/lib/experimental/fetch/http.ts | 6 +----- src/lib/experimental/fetch/icp.ts | 6 +----- src/lib/experimental/fetch/index.ts | 7 +------ src/lib/experimental/fetch/response.ts | 7 +------ src/lib/experimental/fetch/url.ts | 6 +----- src/lib/experimental/globals.ts | 6 +----- src/lib/experimental/ic/accept_message.ts | 6 +----- src/lib/experimental/ic/arg_data_raw.ts | 6 +----- src/lib/experimental/ic/call.ts | 6 +----- src/lib/experimental/ic/call_raw.ts | 6 +----- src/lib/experimental/ic/caller.ts | 6 +----- src/lib/experimental/ic/candid_compiler.ts | 6 +----- src/lib/experimental/ic/candid_decode.ts | 6 +----- src/lib/experimental/ic/candid_encode.ts | 6 +----- src/lib/experimental/ic/canister_balance.ts | 6 +----- src/lib/experimental/ic/canister_version.ts | 6 +----- src/lib/experimental/ic/chunk.ts | 6 +----- src/lib/experimental/ic/clear_timer.ts | 6 +----- src/lib/experimental/ic/data_certificate.ts | 6 +----- src/lib/experimental/ic/id.ts | 6 +----- src/lib/experimental/ic/index.ts | 6 +----- .../experimental/ic/instruction_counter.ts | 6 +----- src/lib/experimental/ic/is_controller.ts | 6 +----- src/lib/experimental/ic/method_name.ts | 6 +----- src/lib/experimental/ic/msg_cycles_accept.ts | 6 +----- .../experimental/ic/msg_cycles_available.ts | 6 +----- .../experimental/ic/msg_cycles_refunded.ts | 6 +----- src/lib/experimental/ic/notify.ts | 6 +----- src/lib/experimental/ic/notify_raw.ts | 6 +----- .../experimental/ic/performance_counter.ts | 6 +----- src/lib/experimental/ic/print.ts | 6 +----- src/lib/experimental/ic/reject.ts | 6 +----- src/lib/experimental/ic/reject_code.ts | 6 +----- src/lib/experimental/ic/reject_message.ts | 6 +----- src/lib/experimental/ic/reply.ts | 6 +----- src/lib/experimental/ic/set_certified_data.ts | 6 +----- .../ic/set_outgoing_http_options.ts | 6 +----- src/lib/experimental/ic/set_timer.ts | 6 +----- src/lib/experimental/ic/set_timer_interval.ts | 6 +----- src/lib/experimental/ic/time.ts | 6 +----- src/lib/experimental/ic/trap.ts | 6 +----- src/lib/experimental/ic/types/args_type.ts | 6 +----- src/lib/experimental/ic/types/index.ts | 6 +----- .../experimental/ic/types/return_type_of.ts | 6 +----- src/lib/experimental/index.ts | 7 +------ src/lib/experimental/json.ts | 6 +----- src/lib/experimental/server.ts | 6 +----- src/lib/experimental/system_types/index.ts | 6 +----- .../system_types/rejection_code.ts | 6 +----- src/lib/experimental/system_types/result.ts | 6 +----- .../calculate_rsv_for_tecdsa.ts | 6 +----- .../threshold_wallet/ecdsa_public_key.ts | 6 +----- .../experimental/threshold_wallet/index.ts | 6 +----- .../threshold_wallet/register_get_url.ts | 7 +------ .../threshold_wallet/sign_with_ecdsa.ts | 6 +----- .../experimental/threshold_wallet/wallet.ts | 7 +------ 147 files changed, 184 insertions(+), 743 deletions(-) diff --git a/experimental/canisters/icrc/errors.ts b/experimental/canisters/icrc/errors.ts index 94c1c983f8..a572b26ff7 100644 --- a/experimental/canisters/icrc/errors.ts +++ b/experimental/canisters/icrc/errors.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { Record } from '../../../src/lib/experimental/candid/types/constructed/record'; import { nat } from '../../../src/lib/experimental/candid/types/primitive/nats/nat'; diff --git a/experimental/canisters/icrc/icrc_1.ts b/experimental/canisters/icrc/icrc_1.ts index 0d4b3a88eb..78792daecf 100644 --- a/experimental/canisters/icrc/icrc_1.ts +++ b/experimental/canisters/icrc/icrc_1.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob, diff --git a/experimental/canisters/icrc/icrc_2.ts b/experimental/canisters/icrc/icrc_2.ts index f35db9dc18..7fab326ff5 100644 --- a/experimental/canisters/icrc/icrc_2.ts +++ b/experimental/canisters/icrc/icrc_2.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob } from '../../../src/lib/experimental/candid/types/constructed/blob'; import { Opt } from '../../../src/lib/experimental/candid/types/constructed/opt'; diff --git a/experimental/canisters/icrc/index.ts b/experimental/canisters/icrc/index.ts index 832ed5eee3..492959d4f1 100644 --- a/experimental/canisters/icrc/index.ts +++ b/experimental/canisters/icrc/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { Canister, diff --git a/experimental/canisters/ledger/address/index.ts b/experimental/canisters/ledger/address/index.ts index e29fe6106d..ee4a92973d 100755 --- a/experimental/canisters/ledger/address/index.ts +++ b/experimental/canisters/ledger/address/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../src/lib/experimental/experimental'; import { Principal } from '@dfinity/principal'; import { getCrc32 } from '@dfinity/principal/lib/esm/utils/getCrc'; diff --git a/experimental/canisters/ledger/index.ts b/experimental/canisters/ledger/index.ts index 15a3dc5cbb..498c76594c 100644 --- a/experimental/canisters/ledger/index.ts +++ b/experimental/canisters/ledger/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; // Some JS docs licensed under: // @@ -11,7 +7,6 @@ if (globalThis._azleExperimental !== true) { // - https://github.com/dfinity/portal/blob/master/LICENSE // // Some documentation changed from original work. - import { blob, Canister, diff --git a/experimental/canisters/management/bitcoin.ts b/experimental/canisters/management/bitcoin.ts index 4724eac7b2..bd97bf4eb9 100644 --- a/experimental/canisters/management/bitcoin.ts +++ b/experimental/canisters/management/bitcoin.ts @@ -1,11 +1,6 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; // TODO I am thinking we should use the same names as ic-btc-types - import { blob, nat32, diff --git a/experimental/canisters/management/canister_info.ts b/experimental/canisters/management/canister_info.ts index 8835311618..3f3e491ae1 100644 --- a/experimental/canisters/management/canister_info.ts +++ b/experimental/canisters/management/canister_info.ts @@ -1,15 +1,10 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; // JS docs licensed under: // // - https://github.com/dfinity/cdk-rs/blob/main/LICENSE // // Some documentation changed from original work. - import { Opt } from '../../../src/lib/experimental/candid/types/constructed/opt'; import { Record } from '../../../src/lib/experimental/candid/types/constructed/record'; import { Variant } from '../../../src/lib/experimental/candid/types/constructed/variant'; diff --git a/experimental/canisters/management/canister_management.ts b/experimental/canisters/management/canister_management.ts index 1887e58f29..b7ba309906 100644 --- a/experimental/canisters/management/canister_management.ts +++ b/experimental/canisters/management/canister_management.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob, diff --git a/experimental/canisters/management/http_request.ts b/experimental/canisters/management/http_request.ts index f1936d0d8a..02a2c2aa22 100644 --- a/experimental/canisters/management/http_request.ts +++ b/experimental/canisters/management/http_request.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob, diff --git a/experimental/canisters/management/index.ts b/experimental/canisters/management/index.ts index 883ceb92ef..4889773658 100644 --- a/experimental/canisters/management/index.ts +++ b/experimental/canisters/management/index.ts @@ -1,15 +1,10 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; // Some JS docs licensed under: // // - https://github.com/dfinity/cdk-rs/blob/main/LICENSE // // Some documentation changed from original work. - import { blob } from '../../../src/lib/experimental/candid/types/constructed/blob'; import { Vec } from '../../../src/lib/experimental/candid/types/constructed/vec'; import { Void } from '../../../src/lib/experimental/candid/types/primitive/void'; diff --git a/experimental/canisters/management/t_ecdsa.ts b/experimental/canisters/management/t_ecdsa.ts index 2669ddc4e6..5d8bafcb9c 100644 --- a/experimental/canisters/management/t_ecdsa.ts +++ b/experimental/canisters/management/t_ecdsa.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob } from '../../../src/lib/experimental/candid/types/constructed/blob'; import { Opt } from '../../../src/lib/experimental/candid/types/constructed/opt'; diff --git a/experimental/index.ts b/experimental/index.ts index 858cfbda56..d16e8ab06d 100644 --- a/experimental/index.ts +++ b/experimental/index.ts @@ -1,7 +1,3 @@ -import { experimentalMessage } from '../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../src/lib/experimental/experimental'; export * from '../src/lib/experimental'; diff --git a/src/build/experimental/commands/compile/file_watcher/file_watcher.ts b/src/build/experimental/commands/compile/file_watcher/file_watcher.ts index 8a9846d863..41dac72daa 100644 --- a/src/build/experimental/commands/compile/file_watcher/file_watcher.ts +++ b/src/build/experimental/commands/compile/file_watcher/file_watcher.ts @@ -21,11 +21,10 @@ let actor: ActorReloadJs | undefined; const reloadedJsPath = process.argv[2]; const canisterId = process.argv[3]; const mainPath = process.argv[4]; -const wasmedgeQuickJsPath = process.argv[5]; -const esmAliases = JSON.parse(process.argv[6]); -const esmExternals = JSON.parse(process.argv[7]); -const canisterName = process.argv[8]; -const postUpgradeIndex = Number(process.argv[9]); +const esmAliases = JSON.parse(process.argv[5]); +const esmExternals = JSON.parse(process.argv[6]); +const canisterName = process.argv[7]; +const postUpgradeIndex = Number(process.argv[8]); // TODO https://github.com/demergent-labs/azle/issues/1664 const watcher = watch([`**/*.ts`, `**/*.js`], { @@ -44,12 +43,7 @@ watcher.on('all', async (event, path) => { if (event === 'change') { try { - await reloadJs( - actor, - reloadedJsPath, - mainPath, - wasmedgeQuickJsPath - ); + await reloadJs(actor, reloadedJsPath, mainPath); } catch (error) { console.error(error); } @@ -59,12 +53,10 @@ watcher.on('all', async (event, path) => { async function reloadJs( actor: ActorReloadJs, reloadedJsPath: string, - mainPath: string, - wasmedgeQuickJsPath: string + mainPath: string ): Promise { const javaScript = await compileJavaScript( mainPath, - wasmedgeQuickJsPath, esmAliases, esmExternals ); diff --git a/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts b/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts index 9e87cd87d8..56d228c877 100644 --- a/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts +++ b/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts @@ -3,7 +3,6 @@ import { join } from 'path'; import { execSyncPretty } from '../../../../stable/utils/exec_sync_pretty'; import { AZLE_PACKAGE_PATH } from '../../../../stable/utils/global_paths'; -import { WASMEDGE_QUICKJS_PATH } from '../../../utils/global_paths'; export function setupFileWatcher( reloadedJsPath: string, @@ -45,7 +44,6 @@ export function setupFileWatcher( reloadedJsPath, canisterId, mainPath, - WASMEDGE_QUICKJS_PATH, JSON.stringify(esmAliases), JSON.stringify(esmExternals), canisterName, diff --git a/src/build/stable/commands/compile/javascript.ts b/src/build/stable/commands/compile/javascript.ts index b59a5088f9..a232601778 100644 --- a/src/build/stable/commands/compile/javascript.ts +++ b/src/build/stable/commands/compile/javascript.ts @@ -1,8 +1,6 @@ import { build, BuildOptions } from 'esbuild'; import esbuildPluginTsc from 'esbuild-plugin-tsc'; -import { experimentalMessage } from '../../../../lib/experimental/experimental'; - export async function compile(main: string): Promise { const prelude = getPrelude(main); const buildOptions = getBuildOptions(prelude); @@ -93,3 +91,19 @@ export function getBuildOptions(ts: string): BuildOptions { ] }; } + +function experimentalMessage(importName: string): string { + return `Azle: experimental mode must be enabled to import from ${importName}. You can enable experimental mode in your dfx.json file like this: +{ + "canisters": { + "canisterName": { + "type": "azle", + "main": "index.ts", + "custom": { + "experimental": true + } + } + } +} +`; +} diff --git a/src/lib/experimental/candid/candid_type.ts b/src/lib/experimental/candid/candid_type.ts index 8be7684373..1b1fecf9bb 100644 --- a/src/lib/experimental/candid/candid_type.ts +++ b/src/lib/experimental/candid/candid_type.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/index.ts b/src/lib/experimental/candid/index.ts index a9c6d49f3e..7eef5cd175 100644 --- a/src/lib/experimental/candid/index.ts +++ b/src/lib/experimental/candid/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export * from './candid_type'; export * from './manual'; diff --git a/src/lib/experimental/candid/manual.ts b/src/lib/experimental/candid/manual.ts index 418d179a8d..15626c1609 100644 --- a/src/lib/experimental/candid/manual.ts +++ b/src/lib/experimental/candid/manual.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { CandidType } from './candid_type'; import { AzleVoid } from './types/primitive/void'; diff --git a/src/lib/experimental/candid/recursive.ts b/src/lib/experimental/candid/recursive.ts index d704aa2de6..4efeeb0d65 100644 --- a/src/lib/experimental/candid/recursive.ts +++ b/src/lib/experimental/candid/recursive.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; import { v4 } from 'uuid'; diff --git a/src/lib/experimental/candid/serde/decode.ts b/src/lib/experimental/candid/serde/decode.ts index 92de8c4e95..622682579e 100644 --- a/src/lib/experimental/candid/serde/decode.ts +++ b/src/lib/experimental/candid/serde/decode.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/encode.ts b/src/lib/experimental/candid/serde/encode.ts index 0a3a9e6872..1e3550af69 100644 --- a/src/lib/experimental/candid/serde/encode.ts +++ b/src/lib/experimental/candid/serde/encode.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/index.ts b/src/lib/experimental/candid/serde/index.ts index f637c19987..dc6b8caf9b 100644 --- a/src/lib/experimental/candid/serde/index.ts +++ b/src/lib/experimental/candid/serde/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export { decode } from './decode'; export { encode } from './encode'; diff --git a/src/lib/experimental/candid/serde/visitors/decode_visitor.ts b/src/lib/experimental/candid/serde/visitors/decode_visitor.ts index 3af9881391..969dada1c6 100644 --- a/src/lib/experimental/candid/serde/visitors/decode_visitor.ts +++ b/src/lib/experimental/candid/serde/visitors/decode_visitor.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/encode_visitor.ts b/src/lib/experimental/candid/serde/visitors/encode_visitor.ts index e57008d040..9e6291b295 100644 --- a/src/lib/experimental/candid/serde/visitors/encode_visitor.ts +++ b/src/lib/experimental/candid/serde/visitors/encode_visitor.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/index.ts b/src/lib/experimental/candid/serde/visitors/index.ts index d728302cb2..15cb9febfb 100644 --- a/src/lib/experimental/candid/serde/visitors/index.ts +++ b/src/lib/experimental/candid/serde/visitors/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; export { DecodeVisitor } from './decode_visitor'; export { EncodeVisitor } from './encode_visitor'; diff --git a/src/lib/experimental/candid/serde/visitors/types.ts b/src/lib/experimental/candid/serde/visitors/types.ts index a5783806ef..5dc108f889 100644 --- a/src/lib/experimental/candid/serde/visitors/types.ts +++ b/src/lib/experimental/candid/serde/visitors/types.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; /* * The VisitorData gives us js_data which is the data that is about to be diff --git a/src/lib/experimental/candid/serde/visitors/visit/record.ts b/src/lib/experimental/candid/serde/visitors/visit/record.ts index fe5db972b8..948cbfe030 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/record.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/record.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/recursive.ts b/src/lib/experimental/candid/serde/visitors/visit/recursive.ts index 8d9982f0fe..fc4d1d54c6 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/recursive.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/recursive.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/tuple.ts b/src/lib/experimental/candid/serde/visitors/visit/tuple.ts index 8a8cb07cd1..3a49ddfcdf 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/tuple.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/tuple.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/variant/azle_result.ts b/src/lib/experimental/candid/serde/visitors/visit/variant/azle_result.ts index 4dbb7597b5..e1b4aa7b18 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/variant/azle_result.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/variant/azle_result.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/variant/azle_variant.ts b/src/lib/experimental/candid/serde/visitors/visit/variant/azle_variant.ts index 46ae87ac32..fc9366754d 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/variant/azle_variant.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/variant/azle_variant.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/variant/index.ts b/src/lib/experimental/candid/serde/visitors/visit/variant/index.ts index 0ffed5e2ea..8af89f69cd 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/variant/index.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/variant/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/vec.ts b/src/lib/experimental/candid/serde/visitors/visit/vec.ts index c1edbcac63..8bc090a350 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/vec.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/vec.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/to_idl_type.ts b/src/lib/experimental/candid/to_idl_type.ts index 8c773a13bb..0269cb4424 100644 --- a/src/lib/experimental/candid/to_idl_type.ts +++ b/src/lib/experimental/candid/to_idl_type.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/type_mapping.ts b/src/lib/experimental/candid/type_mapping.ts index 06a5422092..ef20bd1bfe 100644 --- a/src/lib/experimental/candid/type_mapping.ts +++ b/src/lib/experimental/candid/type_mapping.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { AzleResult, Result } from '../system_types'; import { AzleBlob, blob } from './types/constructed/blob'; diff --git a/src/lib/experimental/candid/types/constructed/blob.ts b/src/lib/experimental/candid/types/constructed/blob.ts index 58bb394b92..f8578f3b09 100644 --- a/src/lib/experimental/candid/types/constructed/blob.ts +++ b/src/lib/experimental/candid/types/constructed/blob.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/index.ts b/src/lib/experimental/candid/types/constructed/index.ts index b0cb5ad3a1..0efb622473 100644 --- a/src/lib/experimental/candid/types/constructed/index.ts +++ b/src/lib/experimental/candid/types/constructed/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; export * from './blob'; export * from './opt'; diff --git a/src/lib/experimental/candid/types/constructed/opt.ts b/src/lib/experimental/candid/types/constructed/opt.ts index b84e55132c..185c86f43c 100644 --- a/src/lib/experimental/candid/types/constructed/opt.ts +++ b/src/lib/experimental/candid/types/constructed/opt.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/record.ts b/src/lib/experimental/candid/types/constructed/record.ts index 5099064d3a..7dd0611c58 100644 --- a/src/lib/experimental/candid/types/constructed/record.ts +++ b/src/lib/experimental/candid/types/constructed/record.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/to_idl_map.ts b/src/lib/experimental/candid/types/constructed/to_idl_map.ts index e76e652b1a..f6822197dc 100644 --- a/src/lib/experimental/candid/types/constructed/to_idl_map.ts +++ b/src/lib/experimental/candid/types/constructed/to_idl_map.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/tuple.ts b/src/lib/experimental/candid/types/constructed/tuple.ts index 5d6ce68268..203318d1d3 100644 --- a/src/lib/experimental/candid/types/constructed/tuple.ts +++ b/src/lib/experimental/candid/types/constructed/tuple.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/variant.ts b/src/lib/experimental/candid/types/constructed/variant.ts index 0b48201c26..0cc1d50c8c 100644 --- a/src/lib/experimental/candid/types/constructed/variant.ts +++ b/src/lib/experimental/candid/types/constructed/variant.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/vec.ts b/src/lib/experimental/candid/types/constructed/vec.ts index 08eca40ad6..17ef84fae5 100644 --- a/src/lib/experimental/candid/types/constructed/vec.ts +++ b/src/lib/experimental/candid/types/constructed/vec.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/bool.ts b/src/lib/experimental/candid/types/primitive/bool.ts index 6c769e96f6..7a13e7472f 100644 --- a/src/lib/experimental/candid/types/primitive/bool.ts +++ b/src/lib/experimental/candid/types/primitive/bool.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/empty.ts b/src/lib/experimental/candid/types/primitive/empty.ts index 7e776fb089..13f46a3f44 100644 --- a/src/lib/experimental/candid/types/primitive/empty.ts +++ b/src/lib/experimental/candid/types/primitive/empty.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/floats/float32.ts b/src/lib/experimental/candid/types/primitive/floats/float32.ts index 65a208e16b..1323bd52cd 100644 --- a/src/lib/experimental/candid/types/primitive/floats/float32.ts +++ b/src/lib/experimental/candid/types/primitive/floats/float32.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/floats/float64.ts b/src/lib/experimental/candid/types/primitive/floats/float64.ts index acf2a94b9b..3b8b4c9858 100644 --- a/src/lib/experimental/candid/types/primitive/floats/float64.ts +++ b/src/lib/experimental/candid/types/primitive/floats/float64.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/floats/index.ts b/src/lib/experimental/candid/types/primitive/floats/index.ts index 2e8e220f3f..1a26110b02 100644 --- a/src/lib/experimental/candid/types/primitive/floats/index.ts +++ b/src/lib/experimental/candid/types/primitive/floats/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; export * from './float32'; export * from './float64'; diff --git a/src/lib/experimental/candid/types/primitive/index.ts b/src/lib/experimental/candid/types/primitive/index.ts index bcae8ac504..bc505e0e81 100644 --- a/src/lib/experimental/candid/types/primitive/index.ts +++ b/src/lib/experimental/candid/types/primitive/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; export * from './bool'; export * from './empty'; diff --git a/src/lib/experimental/candid/types/primitive/ints/index.ts b/src/lib/experimental/candid/types/primitive/ints/index.ts index 8b36b28c99..23ac5cdc96 100644 --- a/src/lib/experimental/candid/types/primitive/ints/index.ts +++ b/src/lib/experimental/candid/types/primitive/ints/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; export * from './int'; export * from './int8'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int.ts b/src/lib/experimental/candid/types/primitive/ints/int.ts index ad7e8f4e5d..b78c5a557e 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int16.ts b/src/lib/experimental/candid/types/primitive/ints/int16.ts index e278de7af8..52f5ed8645 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int16.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int16.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int32.ts b/src/lib/experimental/candid/types/primitive/ints/int32.ts index b5f759fef6..6bd43f4964 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int32.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int32.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int64.ts b/src/lib/experimental/candid/types/primitive/ints/int64.ts index 7154f7c0ce..79c54cfeb0 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int64.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int64.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int8.ts b/src/lib/experimental/candid/types/primitive/ints/int8.ts index e5d320011c..49b5497969 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int8.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int8.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/index.ts b/src/lib/experimental/candid/types/primitive/nats/index.ts index 948f25a17e..09c9340d88 100644 --- a/src/lib/experimental/candid/types/primitive/nats/index.ts +++ b/src/lib/experimental/candid/types/primitive/nats/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; export * from './nat'; export * from './nat8'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat.ts b/src/lib/experimental/candid/types/primitive/nats/nat.ts index fdc4d5274d..5c1170b500 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat16.ts b/src/lib/experimental/candid/types/primitive/nats/nat16.ts index ca99bd20d8..826fac5999 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat16.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat16.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat32.ts b/src/lib/experimental/candid/types/primitive/nats/nat32.ts index 89077a95a5..7b1973b527 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat32.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat32.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat64.ts b/src/lib/experimental/candid/types/primitive/nats/nat64.ts index 5fd0143e8d..e2460dbafc 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat64.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat64.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat8.ts b/src/lib/experimental/candid/types/primitive/nats/nat8.ts index c2c4362642..739b4090b8 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat8.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat8.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/null.ts b/src/lib/experimental/candid/types/primitive/null.ts index 4db308679a..cc78656b9c 100644 --- a/src/lib/experimental/candid/types/primitive/null.ts +++ b/src/lib/experimental/candid/types/primitive/null.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/reserved.ts b/src/lib/experimental/candid/types/primitive/reserved.ts index 78da5d8b5c..3a4a9fa286 100644 --- a/src/lib/experimental/candid/types/primitive/reserved.ts +++ b/src/lib/experimental/candid/types/primitive/reserved.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/text.ts b/src/lib/experimental/candid/types/primitive/text.ts index 911ffee837..be590037a5 100644 --- a/src/lib/experimental/candid/types/primitive/text.ts +++ b/src/lib/experimental/candid/types/primitive/text.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/void.ts b/src/lib/experimental/candid/types/primitive/void.ts index 3065f2acd6..47988ca8c1 100644 --- a/src/lib/experimental/candid/types/primitive/void.ts +++ b/src/lib/experimental/candid/types/primitive/void.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/reference/func.ts b/src/lib/experimental/candid/types/reference/func.ts index b4dbecbe83..e2e875b901 100644 --- a/src/lib/experimental/candid/types/reference/func.ts +++ b/src/lib/experimental/candid/types/reference/func.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/reference/index.ts b/src/lib/experimental/candid/types/reference/index.ts index a75cc9770a..0412587be9 100644 --- a/src/lib/experimental/candid/types/reference/index.ts +++ b/src/lib/experimental/candid/types/reference/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; export * from './func'; export * from './principal'; diff --git a/src/lib/experimental/candid/types/reference/principal.ts b/src/lib/experimental/candid/types/reference/principal.ts index fd07ee709f..6bcfc2ba83 100644 --- a/src/lib/experimental/candid/types/reference/principal.ts +++ b/src/lib/experimental/candid/types/reference/principal.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; import { Principal as DfinityPrincipal } from '@dfinity/principal'; diff --git a/src/lib/experimental/candid/types/reference/service/canister_function/index.ts b/src/lib/experimental/candid/types/reference/service/canister_function/index.ts index 7bb4734580..e878fe521c 100644 --- a/src/lib/experimental/candid/types/reference/service/canister_function/index.ts +++ b/src/lib/experimental/candid/types/reference/service/canister_function/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/reference/service/canister_function/query_update.ts b/src/lib/experimental/candid/types/reference/service/canister_function/query_update.ts index 5a3476d54a..2ab0853336 100644 --- a/src/lib/experimental/candid/types/reference/service/canister_function/query_update.ts +++ b/src/lib/experimental/candid/types/reference/service/canister_function/query_update.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { CanisterOptions } from '.'; diff --git a/src/lib/experimental/candid/types/reference/service/canister_function/system_methods.ts b/src/lib/experimental/candid/types/reference/service/canister_function/system_methods.ts index 2ca450ed73..099cbad56e 100644 --- a/src/lib/experimental/candid/types/reference/service/canister_function/system_methods.ts +++ b/src/lib/experimental/candid/types/reference/service/canister_function/system_methods.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/reference/service/index.ts b/src/lib/experimental/candid/types/reference/service/index.ts index 3feb6f8fce..e970a05630 100644 --- a/src/lib/experimental/candid/types/reference/service/index.ts +++ b/src/lib/experimental/candid/types/reference/service/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { CanisterMethodInfo } from '../../../../canister_methods/types/canister_method_info'; import { CandidType, TypeMapping } from '../../../index'; diff --git a/src/lib/experimental/canister_methods/execute_method.ts b/src/lib/experimental/canister_methods/execute_method.ts index 1755d09800..73bd2796ac 100644 --- a/src/lib/experimental/canister_methods/execute_method.ts +++ b/src/lib/experimental/canister_methods/execute_method.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { handleUncaughtError } from '../../stable/error'; import { CandidType } from '../candid/candid_type'; diff --git a/src/lib/experimental/canister_methods/index.ts b/src/lib/experimental/canister_methods/index.ts index 55b91fbdca..23bd7e26ea 100644 --- a/src/lib/experimental/canister_methods/index.ts +++ b/src/lib/experimental/canister_methods/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export * from './methods'; export * from './types'; diff --git a/src/lib/experimental/canister_methods/is_async.ts b/src/lib/experimental/canister_methods/is_async.ts index f561e63546..f63741e080 100644 --- a/src/lib/experimental/canister_methods/is_async.ts +++ b/src/lib/experimental/canister_methods/is_async.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export function isAsync(originalFunction: any): boolean { if (originalFunction[Symbol.toStringTag] === 'AsyncFunction') { diff --git a/src/lib/experimental/canister_methods/methods/heartbeat.ts b/src/lib/experimental/canister_methods/methods/heartbeat.ts index a66e5c7b89..1f20d4ebf9 100644 --- a/src/lib/experimental/canister_methods/methods/heartbeat.ts +++ b/src/lib/experimental/canister_methods/methods/heartbeat.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { Void } from '../../candid/types/primitive/void'; import { ic } from '../../ic'; diff --git a/src/lib/experimental/canister_methods/methods/index.ts b/src/lib/experimental/canister_methods/methods/index.ts index d742c928ea..198287f31a 100644 --- a/src/lib/experimental/canister_methods/methods/index.ts +++ b/src/lib/experimental/canister_methods/methods/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export * from './heartbeat'; export * from './init'; diff --git a/src/lib/experimental/canister_methods/methods/init.ts b/src/lib/experimental/canister_methods/methods/init.ts index da44ee1523..552284240c 100644 --- a/src/lib/experimental/canister_methods/methods/init.ts +++ b/src/lib/experimental/canister_methods/methods/init.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/methods/inspect_message.ts b/src/lib/experimental/canister_methods/methods/inspect_message.ts index 661708c350..526061f9ba 100644 --- a/src/lib/experimental/canister_methods/methods/inspect_message.ts +++ b/src/lib/experimental/canister_methods/methods/inspect_message.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { Void } from '../../candid/types/primitive/void'; import { executeMethod } from '../execute_method'; diff --git a/src/lib/experimental/canister_methods/methods/post_upgrade.ts b/src/lib/experimental/canister_methods/methods/post_upgrade.ts index 3e06e415ea..71b317bfd1 100644 --- a/src/lib/experimental/canister_methods/methods/post_upgrade.ts +++ b/src/lib/experimental/canister_methods/methods/post_upgrade.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/methods/pre_upgrade.ts b/src/lib/experimental/canister_methods/methods/pre_upgrade.ts index 866b188726..58acf554f8 100644 --- a/src/lib/experimental/canister_methods/methods/pre_upgrade.ts +++ b/src/lib/experimental/canister_methods/methods/pre_upgrade.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { Void } from '../../candid/types/primitive/void'; import { isAsync } from '../is_async'; diff --git a/src/lib/experimental/canister_methods/methods/query.ts b/src/lib/experimental/canister_methods/methods/query.ts index 98f05a2773..a63de7d97e 100644 --- a/src/lib/experimental/canister_methods/methods/query.ts +++ b/src/lib/experimental/canister_methods/methods/query.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/methods/update.ts b/src/lib/experimental/canister_methods/methods/update.ts index c598e791c9..04c0d758e0 100644 --- a/src/lib/experimental/canister_methods/methods/update.ts +++ b/src/lib/experimental/canister_methods/methods/update.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/types/callback.ts b/src/lib/experimental/canister_methods/types/callback.ts index fbf801a7b8..39072bd57e 100644 --- a/src/lib/experimental/canister_methods/types/callback.ts +++ b/src/lib/experimental/canister_methods/types/callback.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/types/canister_method_info.ts b/src/lib/experimental/canister_methods/types/canister_method_info.ts index 0abb82fd67..7edb34c88a 100644 --- a/src/lib/experimental/canister_methods/types/canister_method_info.ts +++ b/src/lib/experimental/canister_methods/types/canister_method_info.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; // To achieve the developer facing type inference API we often introduce type // parameters that are used by the consumer of the function but not by the diff --git a/src/lib/experimental/canister_methods/types/index.ts b/src/lib/experimental/canister_methods/types/index.ts index ffdfd2987a..9bcc8806bf 100644 --- a/src/lib/experimental/canister_methods/types/index.ts +++ b/src/lib/experimental/canister_methods/types/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export * from './callback'; export * from './canister_method_info'; diff --git a/src/lib/experimental/canister_methods/types/method_args.ts b/src/lib/experimental/canister_methods/types/method_args.ts index 90f3b3047e..a5c630821f 100644 --- a/src/lib/experimental/canister_methods/types/method_args.ts +++ b/src/lib/experimental/canister_methods/types/method_args.ts @@ -1,7 +1,3 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export type MethodArgs = { manual?: boolean }; diff --git a/src/lib/experimental/experimental.ts b/src/lib/experimental/experimental.ts index aa20fa1e74..51e66dedcf 100644 --- a/src/lib/experimental/experimental.ts +++ b/src/lib/experimental/experimental.ts @@ -1,4 +1,22 @@ -export function experimentalMessage(importName: string): string { +if (globalThis._azleExperimental !== true) { + const importName = getImportName(); + + throw new Error(experimentalMessage(importName)); +} + +function getImportName(): string { + if (import.meta.url.includes('azle/src/lib/experimental')) { + return 'azle/experimental'; + } + + throw new Error( + `Azle: Experimental import name for module path ${ + import.meta.url + } has not been created` + ); +} + +function experimentalMessage(importName: string): string { return `Azle: experimental mode must be enabled to import from ${importName}. You can enable experimental mode in your dfx.json file like this: { "canisters": { diff --git a/src/lib/experimental/fetch/file.ts b/src/lib/experimental/fetch/file.ts index 563e47cc10..53b527ac5a 100644 --- a/src/lib/experimental/fetch/file.ts +++ b/src/lib/experimental/fetch/file.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { readFile } from 'fs/promises'; diff --git a/src/lib/experimental/fetch/headers.ts b/src/lib/experimental/fetch/headers.ts index d5a72d49af..a8ca8d67ca 100644 --- a/src/lib/experimental/fetch/headers.ts +++ b/src/lib/experimental/fetch/headers.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO this is meant to be basic for now export class AzleFetchHeaders { diff --git a/src/lib/experimental/fetch/http.ts b/src/lib/experimental/fetch/http.ts index 6d95ce62ab..7dde7f7574 100644 --- a/src/lib/experimental/fetch/http.ts +++ b/src/lib/experimental/fetch/http.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { inflate } from 'pako'; diff --git a/src/lib/experimental/fetch/icp.ts b/src/lib/experimental/fetch/icp.ts index 262245dc8e..204410ffad 100644 --- a/src/lib/experimental/fetch/icp.ts +++ b/src/lib/experimental/fetch/icp.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; import { Principal } from '@dfinity/principal'; diff --git a/src/lib/experimental/fetch/index.ts b/src/lib/experimental/fetch/index.ts index b1935d186d..971ab199da 100644 --- a/src/lib/experimental/fetch/index.ts +++ b/src/lib/experimental/fetch/index.ts @@ -1,14 +1,9 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO what happens if you have a bunch of fetches in your dependencies, all in a row? // TODO how would you set options for each individually? // TODO it seems like you might not be able to do that // TODO we have got to get rid of the need to set all of these custom things - import { fetchFile } from './file'; import { fetchHttp } from './http'; import { fetchIcp } from './icp'; diff --git a/src/lib/experimental/fetch/response.ts b/src/lib/experimental/fetch/response.ts index f9db422523..21184c1445 100644 --- a/src/lib/experimental/fetch/response.ts +++ b/src/lib/experimental/fetch/response.ts @@ -1,12 +1,7 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO We currently do not have an implementation of ReadableStream // TODO thus our body is done with Uint8Array or Buffer - import { AzleFetchHeaders } from './headers'; // Using Response from wasmedge-quickjs doesn't seem ideal for the time being diff --git a/src/lib/experimental/fetch/url.ts b/src/lib/experimental/fetch/url.ts index 7c0fc3ebfe..ffd88ac65d 100644 --- a/src/lib/experimental/fetch/url.ts +++ b/src/lib/experimental/fetch/url.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO we do not support Request yet, same as the frontend fetch // TODO we probably could as wasmedge-quickjs has a Request class in http diff --git a/src/lib/experimental/globals.ts b/src/lib/experimental/globals.ts index 89b12609e0..bf4661a95e 100644 --- a/src/lib/experimental/globals.ts +++ b/src/lib/experimental/globals.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from './experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import './experimental'; import { Buffer } from 'buffer'; import * as process from 'process'; diff --git a/src/lib/experimental/ic/accept_message.ts b/src/lib/experimental/ic/accept_message.ts index fd8d357589..361a703dd9 100644 --- a/src/lib/experimental/ic/accept_message.ts +++ b/src/lib/experimental/ic/accept_message.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Void } from '../candid/types/primitive/void'; // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/src/lib/experimental/ic/arg_data_raw.ts b/src/lib/experimental/ic/arg_data_raw.ts index 7e4c5e9d79..7e453d2b46 100644 --- a/src/lib/experimental/ic/arg_data_raw.ts +++ b/src/lib/experimental/ic/arg_data_raw.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; diff --git a/src/lib/experimental/ic/call.ts b/src/lib/experimental/ic/call.ts index 46b6b90448..16c977d3ba 100644 --- a/src/lib/experimental/ic/call.ts +++ b/src/lib/experimental/ic/call.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat } from '../candid/types/primitive/nats/nat'; import { callRaw } from './call_raw'; diff --git a/src/lib/experimental/ic/call_raw.ts b/src/lib/experimental/ic/call_raw.ts index 25b22c4545..f7108aca99 100644 --- a/src/lib/experimental/ic/call_raw.ts +++ b/src/lib/experimental/ic/call_raw.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Principal } from '@dfinity/principal'; import { v4 } from 'uuid'; diff --git a/src/lib/experimental/ic/caller.ts b/src/lib/experimental/ic/caller.ts index 7a13be78cb..19ba47ba7d 100644 --- a/src/lib/experimental/ic/caller.ts +++ b/src/lib/experimental/ic/caller.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Principal } from '../candid/types/reference/principal'; diff --git a/src/lib/experimental/ic/candid_compiler.ts b/src/lib/experimental/ic/candid_compiler.ts index 03c950d143..05d0f4734c 100644 --- a/src/lib/experimental/ic/candid_compiler.ts +++ b/src/lib/experimental/ic/candid_compiler.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/candid_decode.ts b/src/lib/experimental/ic/candid_decode.ts index 2772f53417..fd94735524 100644 --- a/src/lib/experimental/ic/candid_decode.ts +++ b/src/lib/experimental/ic/candid_decode.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/candid_encode.ts b/src/lib/experimental/ic/candid_encode.ts index ef03f8126b..0efdfbba1e 100644 --- a/src/lib/experimental/ic/candid_encode.ts +++ b/src/lib/experimental/ic/candid_encode.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/canister_balance.ts b/src/lib/experimental/ic/canister_balance.ts index d8a959ed6a..12d1a963e9 100644 --- a/src/lib/experimental/ic/canister_balance.ts +++ b/src/lib/experimental/ic/canister_balance.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/canister_version.ts b/src/lib/experimental/ic/canister_version.ts index 3ba8d3a581..35950c193e 100644 --- a/src/lib/experimental/ic/canister_version.ts +++ b/src/lib/experimental/ic/canister_version.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/chunk.ts b/src/lib/experimental/ic/chunk.ts index 47523ddf7d..6860bbdf39 100644 --- a/src/lib/experimental/ic/chunk.ts +++ b/src/lib/experimental/ic/chunk.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { ic } from './'; diff --git a/src/lib/experimental/ic/clear_timer.ts b/src/lib/experimental/ic/clear_timer.ts index 91fb99b5f0..e0251ae0b5 100644 --- a/src/lib/experimental/ic/clear_timer.ts +++ b/src/lib/experimental/ic/clear_timer.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/data_certificate.ts b/src/lib/experimental/ic/data_certificate.ts index 949ba0bf31..77a02d7658 100644 --- a/src/lib/experimental/ic/data_certificate.ts +++ b/src/lib/experimental/ic/data_certificate.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { None, Opt, Some } from '../candid/types/constructed/opt'; diff --git a/src/lib/experimental/ic/id.ts b/src/lib/experimental/ic/id.ts index a53c2a6977..426a5f4333 100644 --- a/src/lib/experimental/ic/id.ts +++ b/src/lib/experimental/ic/id.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Principal } from '../candid/types/reference/principal'; diff --git a/src/lib/experimental/ic/index.ts b/src/lib/experimental/ic/index.ts index 7836632caa..335037c838 100644 --- a/src/lib/experimental/ic/index.ts +++ b/src/lib/experimental/ic/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { acceptMessage } from './accept_message'; import { argDataRaw } from './arg_data_raw'; diff --git a/src/lib/experimental/ic/instruction_counter.ts b/src/lib/experimental/ic/instruction_counter.ts index c310d7056b..57ae63c289 100644 --- a/src/lib/experimental/ic/instruction_counter.ts +++ b/src/lib/experimental/ic/instruction_counter.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/is_controller.ts b/src/lib/experimental/ic/is_controller.ts index 22ea8dbf7b..f010a4f8d9 100644 --- a/src/lib/experimental/ic/is_controller.ts +++ b/src/lib/experimental/ic/is_controller.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { bool } from '../candid/types/primitive/bool'; import { Principal } from '../candid/types/reference/principal'; diff --git a/src/lib/experimental/ic/method_name.ts b/src/lib/experimental/ic/method_name.ts index bb3d368875..9fb7e5d873 100644 --- a/src/lib/experimental/ic/method_name.ts +++ b/src/lib/experimental/ic/method_name.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/msg_cycles_accept.ts b/src/lib/experimental/ic/msg_cycles_accept.ts index 433b2beae4..68b6bb5b83 100644 --- a/src/lib/experimental/ic/msg_cycles_accept.ts +++ b/src/lib/experimental/ic/msg_cycles_accept.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/msg_cycles_available.ts b/src/lib/experimental/ic/msg_cycles_available.ts index 476ab54bf6..338c882f1e 100644 --- a/src/lib/experimental/ic/msg_cycles_available.ts +++ b/src/lib/experimental/ic/msg_cycles_available.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/msg_cycles_refunded.ts b/src/lib/experimental/ic/msg_cycles_refunded.ts index 713bfcfc4d..8de30a1cdd 100644 --- a/src/lib/experimental/ic/msg_cycles_refunded.ts +++ b/src/lib/experimental/ic/msg_cycles_refunded.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/notify.ts b/src/lib/experimental/ic/notify.ts index f900b62604..af668ad8e2 100644 --- a/src/lib/experimental/ic/notify.ts +++ b/src/lib/experimental/ic/notify.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat } from '../candid/types/primitive/nats/nat'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/notify_raw.ts b/src/lib/experimental/ic/notify_raw.ts index 7778c4185b..a731ad01b2 100644 --- a/src/lib/experimental/ic/notify_raw.ts +++ b/src/lib/experimental/ic/notify_raw.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { nat } from '../candid/types/primitive/nats/nat'; diff --git a/src/lib/experimental/ic/performance_counter.ts b/src/lib/experimental/ic/performance_counter.ts index c796ff1515..2645b8ed6a 100644 --- a/src/lib/experimental/ic/performance_counter.ts +++ b/src/lib/experimental/ic/performance_counter.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat32 } from '../candid/types/primitive/nats/nat32'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/print.ts b/src/lib/experimental/ic/print.ts index 299f637a04..56d4c0cda8 100644 --- a/src/lib/experimental/ic/print.ts +++ b/src/lib/experimental/ic/print.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/reject.ts b/src/lib/experimental/ic/reject.ts index 1397c34fcb..93be1250c9 100644 --- a/src/lib/experimental/ic/reject.ts +++ b/src/lib/experimental/ic/reject.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { text } from '../candid/types/primitive/text'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/reject_code.ts b/src/lib/experimental/ic/reject_code.ts index 916dcaa789..d17eeb2e11 100644 --- a/src/lib/experimental/ic/reject_code.ts +++ b/src/lib/experimental/ic/reject_code.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { RejectionCode } from '../system_types'; diff --git a/src/lib/experimental/ic/reject_message.ts b/src/lib/experimental/ic/reject_message.ts index 36a0d478a8..e3c822647e 100644 --- a/src/lib/experimental/ic/reject_message.ts +++ b/src/lib/experimental/ic/reject_message.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { text } from '../candid/types/primitive/text'; // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/src/lib/experimental/ic/reply.ts b/src/lib/experimental/ic/reply.ts index 775687bcd1..d5895ed91a 100644 --- a/src/lib/experimental/ic/reply.ts +++ b/src/lib/experimental/ic/reply.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { CandidType } from '../candid/candid_type'; import { encode } from '../candid/serde/encode'; diff --git a/src/lib/experimental/ic/set_certified_data.ts b/src/lib/experimental/ic/set_certified_data.ts index 87ad79559a..4a0913f772 100644 --- a/src/lib/experimental/ic/set_certified_data.ts +++ b/src/lib/experimental/ic/set_certified_data.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/set_outgoing_http_options.ts b/src/lib/experimental/ic/set_outgoing_http_options.ts index e906cc96ce..7d0c34cfa6 100644 --- a/src/lib/experimental/ic/set_outgoing_http_options.ts +++ b/src/lib/experimental/ic/set_outgoing_http_options.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export function setOutgoingHttpOptions(options: { maxResponseBytes?: bigint; diff --git a/src/lib/experimental/ic/set_timer.ts b/src/lib/experimental/ic/set_timer.ts index 40285ff248..a0535e44e4 100644 --- a/src/lib/experimental/ic/set_timer.ts +++ b/src/lib/experimental/ic/set_timer.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { v4 } from 'uuid'; diff --git a/src/lib/experimental/ic/set_timer_interval.ts b/src/lib/experimental/ic/set_timer_interval.ts index 65f9c4ccf7..8e6fe633dc 100644 --- a/src/lib/experimental/ic/set_timer_interval.ts +++ b/src/lib/experimental/ic/set_timer_interval.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { v4 } from 'uuid'; diff --git a/src/lib/experimental/ic/time.ts b/src/lib/experimental/ic/time.ts index def4846cfc..1bbad14f94 100644 --- a/src/lib/experimental/ic/time.ts +++ b/src/lib/experimental/ic/time.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/trap.ts b/src/lib/experimental/ic/trap.ts index 595fb669fe..4e46c8c370 100644 --- a/src/lib/experimental/ic/trap.ts +++ b/src/lib/experimental/ic/trap.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { empty } from '../candid/types/primitive/empty'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/types/args_type.ts b/src/lib/experimental/ic/types/args_type.ts index eb2f5bbbde..78198c59ed 100644 --- a/src/lib/experimental/ic/types/args_type.ts +++ b/src/lib/experimental/ic/types/args_type.ts @@ -1,7 +1,3 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export type ArgsType = T extends (...args: infer U) => any ? U : any; diff --git a/src/lib/experimental/ic/types/index.ts b/src/lib/experimental/ic/types/index.ts index ffd770e60d..9f3664f98f 100644 --- a/src/lib/experimental/ic/types/index.ts +++ b/src/lib/experimental/ic/types/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export * from './args_type'; export * from './return_type_of'; diff --git a/src/lib/experimental/ic/types/return_type_of.ts b/src/lib/experimental/ic/types/return_type_of.ts index f3068a15fd..3c2647fc52 100644 --- a/src/lib/experimental/ic/types/return_type_of.ts +++ b/src/lib/experimental/ic/types/return_type_of.ts @@ -1,7 +1,3 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export type ReturnTypeOf = T extends (...args: any[]) => infer R ? R : any; diff --git a/src/lib/experimental/index.ts b/src/lib/experimental/index.ts index 40365af76b..d56f3f26f6 100644 --- a/src/lib/experimental/index.ts +++ b/src/lib/experimental/index.ts @@ -1,9 +1,4 @@ -import { experimentalMessage } from './experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} - +import './experimental'; import './globals'; import '../../../type_tests'; diff --git a/src/lib/experimental/json.ts b/src/lib/experimental/json.ts index 0e196e8f56..36612c55d7 100644 --- a/src/lib/experimental/json.ts +++ b/src/lib/experimental/json.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from './experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import './experimental'; import { jsonReplacer, diff --git a/src/lib/experimental/server.ts b/src/lib/experimental/server.ts index 33ca569e09..b8deb0c7c4 100644 --- a/src/lib/experimental/server.ts +++ b/src/lib/experimental/server.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from './experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import './experimental'; // TODO make this function's return type explicit https://github.com/demergent-labs/azle/issues/1860 /* eslint-disable @typescript-eslint/explicit-function-return-type */ diff --git a/src/lib/experimental/system_types/index.ts b/src/lib/experimental/system_types/index.ts index d74eeee39b..4da117fafd 100644 --- a/src/lib/experimental/system_types/index.ts +++ b/src/lib/experimental/system_types/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export * from './rejection_code'; export * from './result'; diff --git a/src/lib/experimental/system_types/rejection_code.ts b/src/lib/experimental/system_types/rejection_code.ts index d91b23fb52..7afc4132f6 100644 --- a/src/lib/experimental/system_types/rejection_code.ts +++ b/src/lib/experimental/system_types/rejection_code.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Variant } from '../candid/types/constructed/variant'; import { Null } from '../candid/types/primitive/null'; diff --git a/src/lib/experimental/system_types/result.ts b/src/lib/experimental/system_types/result.ts index 0cc2b54276..8fcc3491a4 100644 --- a/src/lib/experimental/system_types/result.ts +++ b/src/lib/experimental/system_types/result.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/threshold_wallet/calculate_rsv_for_tecdsa.ts b/src/lib/experimental/threshold_wallet/calculate_rsv_for_tecdsa.ts index be80b83fac..033b484c3b 100644 --- a/src/lib/experimental/threshold_wallet/calculate_rsv_for_tecdsa.ts +++ b/src/lib/experimental/threshold_wallet/calculate_rsv_for_tecdsa.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { ethers } from 'ethers'; diff --git a/src/lib/experimental/threshold_wallet/ecdsa_public_key.ts b/src/lib/experimental/threshold_wallet/ecdsa_public_key.ts index ce5bf1ea86..129f63104b 100644 --- a/src/lib/experimental/threshold_wallet/ecdsa_public_key.ts +++ b/src/lib/experimental/threshold_wallet/ecdsa_public_key.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Principal } from '@dfinity/principal'; diff --git a/src/lib/experimental/threshold_wallet/index.ts b/src/lib/experimental/threshold_wallet/index.ts index c929e94827..22de6e261a 100644 --- a/src/lib/experimental/threshold_wallet/index.ts +++ b/src/lib/experimental/threshold_wallet/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export * from './calculate_rsv_for_tecdsa'; export * from './ecdsa_public_key'; diff --git a/src/lib/experimental/threshold_wallet/register_get_url.ts b/src/lib/experimental/threshold_wallet/register_get_url.ts index 992e8c11d7..21f7bad886 100644 --- a/src/lib/experimental/threshold_wallet/register_get_url.ts +++ b/src/lib/experimental/threshold_wallet/register_get_url.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO unfortunately this is highly unlikely to work in production because // TODO of the headers...we need a good transform @@ -12,7 +8,6 @@ if (globalThis._azleExperimental !== true) { // TODO and then the response can say what was wrong, instead of an error // TODO what if the developer installs a different version of ethers? // TODO should we use a peer dependency? - import { ethers } from 'ethers'; export async function ethersGetUrl( diff --git a/src/lib/experimental/threshold_wallet/sign_with_ecdsa.ts b/src/lib/experimental/threshold_wallet/sign_with_ecdsa.ts index f33b5d0104..3be93d07aa 100644 --- a/src/lib/experimental/threshold_wallet/sign_with_ecdsa.ts +++ b/src/lib/experimental/threshold_wallet/sign_with_ecdsa.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { serialize } from '../fetch'; import { ThresholdKeyInfo } from './wallet'; diff --git a/src/lib/experimental/threshold_wallet/wallet.ts b/src/lib/experimental/threshold_wallet/wallet.ts index f2749568f3..31ce661e56 100644 --- a/src/lib/experimental/threshold_wallet/wallet.ts +++ b/src/lib/experimental/threshold_wallet/wallet.ts @@ -1,9 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} - +import '../experimental'; import './register_get_url'; import { Principal } from '@dfinity/principal'; From 82c9215253da467cb66d268aafa51643796d9773 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 28 Aug 2024 17:47:19 -0500 Subject: [PATCH 04/12] update property test tsconfig.json files --- tests/property/candid_rpc/class_api/blob/tsconfig.json | 1 + tests/property/candid_rpc/class_api/bool/tsconfig.json | 2 +- .../class_api/canister_methods/http_request/tsconfig.json | 1 + .../canister_methods/http_request_update/tsconfig.json | 1 + .../candid_rpc/class_api/canister_methods/init/tsconfig.json | 1 + .../class_api/canister_methods/inspect_message/tsconfig.json | 1 + .../class_api/canister_methods/post_upgrade/tsconfig.json | 1 + .../class_api/canister_methods/pre_upgrade/tsconfig.json | 1 + .../candid_rpc/class_api/canister_methods/query/tsconfig.json | 1 + .../candid_rpc/class_api/canister_methods/update/tsconfig.json | 1 + tests/property/candid_rpc/class_api/float32/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/float64/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/func/tsconfig.json | 1 + tests/property/candid_rpc/class_api/int/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/int16/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/int32/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/int64/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/int8/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/nat/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/nat16/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/nat32/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/nat64/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/nat8/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/null/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/opt/tsconfig.json | 1 + tests/property/candid_rpc/class_api/principal/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/record/tsconfig.json | 1 + tests/property/candid_rpc/class_api/recursive/tsconfig.json | 1 + tests/property/candid_rpc/class_api/service/tsconfig.json | 1 + .../candid_rpc/class_api/stable_b_tree_map/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/text/tsconfig.json | 2 +- tests/property/candid_rpc/class_api/tuple/tsconfig.json | 1 + tests/property/candid_rpc/class_api/variant/tsconfig.json | 1 + tests/property/candid_rpc/class_api/vec/tsconfig.json | 1 + tests/property/candid_rpc/functional_api/blob/tsconfig.json | 1 + tests/property/candid_rpc/functional_api/bool/tsconfig.json | 2 +- .../functional_api/canister_methods/http_request/tsconfig.json | 1 + .../canister_methods/http_request_update/tsconfig.json | 1 + .../functional_api/canister_methods/init/tsconfig.json | 1 + .../canister_methods/inspect_message/tsconfig.json | 1 + .../functional_api/canister_methods/post_upgrade/tsconfig.json | 1 + .../functional_api/canister_methods/pre_upgrade/tsconfig.json | 1 + .../functional_api/canister_methods/query/tsconfig.json | 1 + .../functional_api/canister_methods/update/tsconfig.json | 1 + tests/property/candid_rpc/functional_api/float32/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/float64/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/func/tsconfig.json | 1 + tests/property/candid_rpc/functional_api/int/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/int16/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/int32/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/int64/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/int8/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/nat/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/nat16/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/nat32/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/nat64/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/nat8/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/null/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/opt/tsconfig.json | 1 + .../property/candid_rpc/functional_api/principal/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/record/tsconfig.json | 1 + .../property/candid_rpc/functional_api/recursive/tsconfig.json | 1 + tests/property/candid_rpc/functional_api/service/tsconfig.json | 1 + .../candid_rpc/functional_api/stable_b_tree_map/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/text/tsconfig.json | 2 +- tests/property/candid_rpc/functional_api/tuple/tsconfig.json | 1 + tests/property/candid_rpc/functional_api/variant/tsconfig.json | 1 + tests/property/candid_rpc/functional_api/vec/tsconfig.json | 1 + 68 files changed, 68 insertions(+), 34 deletions(-) diff --git a/tests/property/candid_rpc/class_api/blob/tsconfig.json b/tests/property/candid_rpc/class_api/blob/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/blob/tsconfig.json +++ b/tests/property/candid_rpc/class_api/blob/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/bool/tsconfig.json b/tests/property/candid_rpc/class_api/bool/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/bool/tsconfig.json +++ b/tests/property/candid_rpc/class_api/bool/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/canister_methods/http_request/tsconfig.json b/tests/property/candid_rpc/class_api/canister_methods/http_request/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/canister_methods/http_request/tsconfig.json +++ b/tests/property/candid_rpc/class_api/canister_methods/http_request/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/canister_methods/http_request_update/tsconfig.json b/tests/property/candid_rpc/class_api/canister_methods/http_request_update/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/canister_methods/http_request_update/tsconfig.json +++ b/tests/property/candid_rpc/class_api/canister_methods/http_request_update/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/canister_methods/init/tsconfig.json b/tests/property/candid_rpc/class_api/canister_methods/init/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/canister_methods/init/tsconfig.json +++ b/tests/property/candid_rpc/class_api/canister_methods/init/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/canister_methods/inspect_message/tsconfig.json b/tests/property/candid_rpc/class_api/canister_methods/inspect_message/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/canister_methods/inspect_message/tsconfig.json +++ b/tests/property/candid_rpc/class_api/canister_methods/inspect_message/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/canister_methods/post_upgrade/tsconfig.json b/tests/property/candid_rpc/class_api/canister_methods/post_upgrade/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/canister_methods/post_upgrade/tsconfig.json +++ b/tests/property/candid_rpc/class_api/canister_methods/post_upgrade/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/canister_methods/pre_upgrade/tsconfig.json b/tests/property/candid_rpc/class_api/canister_methods/pre_upgrade/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/canister_methods/pre_upgrade/tsconfig.json +++ b/tests/property/candid_rpc/class_api/canister_methods/pre_upgrade/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/canister_methods/query/tsconfig.json b/tests/property/candid_rpc/class_api/canister_methods/query/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/canister_methods/query/tsconfig.json +++ b/tests/property/candid_rpc/class_api/canister_methods/query/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/canister_methods/update/tsconfig.json b/tests/property/candid_rpc/class_api/canister_methods/update/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/canister_methods/update/tsconfig.json +++ b/tests/property/candid_rpc/class_api/canister_methods/update/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/float32/tsconfig.json b/tests/property/candid_rpc/class_api/float32/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/float32/tsconfig.json +++ b/tests/property/candid_rpc/class_api/float32/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/float64/tsconfig.json b/tests/property/candid_rpc/class_api/float64/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/float64/tsconfig.json +++ b/tests/property/candid_rpc/class_api/float64/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/func/tsconfig.json b/tests/property/candid_rpc/class_api/func/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/func/tsconfig.json +++ b/tests/property/candid_rpc/class_api/func/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/int/tsconfig.json b/tests/property/candid_rpc/class_api/int/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/int/tsconfig.json +++ b/tests/property/candid_rpc/class_api/int/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/int16/tsconfig.json b/tests/property/candid_rpc/class_api/int16/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/int16/tsconfig.json +++ b/tests/property/candid_rpc/class_api/int16/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/int32/tsconfig.json b/tests/property/candid_rpc/class_api/int32/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/int32/tsconfig.json +++ b/tests/property/candid_rpc/class_api/int32/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/int64/tsconfig.json b/tests/property/candid_rpc/class_api/int64/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/int64/tsconfig.json +++ b/tests/property/candid_rpc/class_api/int64/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/int8/tsconfig.json b/tests/property/candid_rpc/class_api/int8/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/int8/tsconfig.json +++ b/tests/property/candid_rpc/class_api/int8/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/nat/tsconfig.json b/tests/property/candid_rpc/class_api/nat/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/nat/tsconfig.json +++ b/tests/property/candid_rpc/class_api/nat/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/nat16/tsconfig.json b/tests/property/candid_rpc/class_api/nat16/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/nat16/tsconfig.json +++ b/tests/property/candid_rpc/class_api/nat16/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/nat32/tsconfig.json b/tests/property/candid_rpc/class_api/nat32/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/nat32/tsconfig.json +++ b/tests/property/candid_rpc/class_api/nat32/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/nat64/tsconfig.json b/tests/property/candid_rpc/class_api/nat64/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/nat64/tsconfig.json +++ b/tests/property/candid_rpc/class_api/nat64/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/nat8/tsconfig.json b/tests/property/candid_rpc/class_api/nat8/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/nat8/tsconfig.json +++ b/tests/property/candid_rpc/class_api/nat8/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/null/tsconfig.json b/tests/property/candid_rpc/class_api/null/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/null/tsconfig.json +++ b/tests/property/candid_rpc/class_api/null/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/opt/tsconfig.json b/tests/property/candid_rpc/class_api/opt/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/opt/tsconfig.json +++ b/tests/property/candid_rpc/class_api/opt/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/principal/tsconfig.json b/tests/property/candid_rpc/class_api/principal/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/principal/tsconfig.json +++ b/tests/property/candid_rpc/class_api/principal/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/record/tsconfig.json b/tests/property/candid_rpc/class_api/record/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/record/tsconfig.json +++ b/tests/property/candid_rpc/class_api/record/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/recursive/tsconfig.json b/tests/property/candid_rpc/class_api/recursive/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/recursive/tsconfig.json +++ b/tests/property/candid_rpc/class_api/recursive/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/service/tsconfig.json b/tests/property/candid_rpc/class_api/service/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/service/tsconfig.json +++ b/tests/property/candid_rpc/class_api/service/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/stable_b_tree_map/tsconfig.json b/tests/property/candid_rpc/class_api/stable_b_tree_map/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/stable_b_tree_map/tsconfig.json +++ b/tests/property/candid_rpc/class_api/stable_b_tree_map/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/text/tsconfig.json b/tests/property/candid_rpc/class_api/text/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/text/tsconfig.json +++ b/tests/property/candid_rpc/class_api/text/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/tuple/tsconfig.json b/tests/property/candid_rpc/class_api/tuple/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/tuple/tsconfig.json +++ b/tests/property/candid_rpc/class_api/tuple/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/variant/tsconfig.json b/tests/property/candid_rpc/class_api/variant/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/variant/tsconfig.json +++ b/tests/property/candid_rpc/class_api/variant/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/class_api/vec/tsconfig.json b/tests/property/candid_rpc/class_api/vec/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/class_api/vec/tsconfig.json +++ b/tests/property/candid_rpc/class_api/vec/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/blob/tsconfig.json b/tests/property/candid_rpc/functional_api/blob/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/blob/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/blob/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/bool/tsconfig.json b/tests/property/candid_rpc/functional_api/bool/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/bool/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/bool/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/canister_methods/http_request/tsconfig.json b/tests/property/candid_rpc/functional_api/canister_methods/http_request/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/canister_methods/http_request/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/canister_methods/http_request/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/canister_methods/http_request_update/tsconfig.json b/tests/property/candid_rpc/functional_api/canister_methods/http_request_update/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/canister_methods/http_request_update/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/canister_methods/http_request_update/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/canister_methods/init/tsconfig.json b/tests/property/candid_rpc/functional_api/canister_methods/init/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/canister_methods/init/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/canister_methods/init/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/canister_methods/inspect_message/tsconfig.json b/tests/property/candid_rpc/functional_api/canister_methods/inspect_message/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/canister_methods/inspect_message/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/canister_methods/inspect_message/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/canister_methods/post_upgrade/tsconfig.json b/tests/property/candid_rpc/functional_api/canister_methods/post_upgrade/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/canister_methods/post_upgrade/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/canister_methods/post_upgrade/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/canister_methods/pre_upgrade/tsconfig.json b/tests/property/candid_rpc/functional_api/canister_methods/pre_upgrade/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/canister_methods/pre_upgrade/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/canister_methods/pre_upgrade/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/canister_methods/query/tsconfig.json b/tests/property/candid_rpc/functional_api/canister_methods/query/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/canister_methods/query/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/canister_methods/query/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/canister_methods/update/tsconfig.json b/tests/property/candid_rpc/functional_api/canister_methods/update/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/canister_methods/update/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/canister_methods/update/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/float32/tsconfig.json b/tests/property/candid_rpc/functional_api/float32/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/float32/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/float32/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/float64/tsconfig.json b/tests/property/candid_rpc/functional_api/float64/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/float64/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/float64/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/func/tsconfig.json b/tests/property/candid_rpc/functional_api/func/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/func/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/func/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/int/tsconfig.json b/tests/property/candid_rpc/functional_api/int/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/int/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/int/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/int16/tsconfig.json b/tests/property/candid_rpc/functional_api/int16/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/int16/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/int16/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/int32/tsconfig.json b/tests/property/candid_rpc/functional_api/int32/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/int32/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/int32/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/int64/tsconfig.json b/tests/property/candid_rpc/functional_api/int64/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/int64/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/int64/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/int8/tsconfig.json b/tests/property/candid_rpc/functional_api/int8/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/int8/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/int8/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/nat/tsconfig.json b/tests/property/candid_rpc/functional_api/nat/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/nat/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/nat/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/nat16/tsconfig.json b/tests/property/candid_rpc/functional_api/nat16/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/nat16/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/nat16/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/nat32/tsconfig.json b/tests/property/candid_rpc/functional_api/nat32/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/nat32/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/nat32/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/nat64/tsconfig.json b/tests/property/candid_rpc/functional_api/nat64/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/nat64/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/nat64/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/nat8/tsconfig.json b/tests/property/candid_rpc/functional_api/nat8/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/nat8/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/nat8/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/null/tsconfig.json b/tests/property/candid_rpc/functional_api/null/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/null/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/null/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/opt/tsconfig.json b/tests/property/candid_rpc/functional_api/opt/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/opt/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/opt/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/principal/tsconfig.json b/tests/property/candid_rpc/functional_api/principal/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/principal/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/principal/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/record/tsconfig.json b/tests/property/candid_rpc/functional_api/record/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/record/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/record/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/recursive/tsconfig.json b/tests/property/candid_rpc/functional_api/recursive/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/recursive/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/recursive/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/service/tsconfig.json b/tests/property/candid_rpc/functional_api/service/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/service/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/service/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/stable_b_tree_map/tsconfig.json b/tests/property/candid_rpc/functional_api/stable_b_tree_map/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/stable_b_tree_map/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/stable_b_tree_map/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/text/tsconfig.json b/tests/property/candid_rpc/functional_api/text/tsconfig.json index 17e4bcea23..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/text/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/text/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/tuple/tsconfig.json b/tests/property/candid_rpc/functional_api/tuple/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/tuple/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/tuple/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/variant/tsconfig.json b/tests/property/candid_rpc/functional_api/variant/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/variant/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/variant/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", diff --git a/tests/property/candid_rpc/functional_api/vec/tsconfig.json b/tests/property/candid_rpc/functional_api/vec/tsconfig.json index d20bea88d9..d338ea48d0 100644 --- a/tests/property/candid_rpc/functional_api/vec/tsconfig.json +++ b/tests/property/candid_rpc/functional_api/vec/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "strict": true, "target": "ES2020", + "module": "ES2020", "moduleResolution": "node", "allowJs": true, "outDir": "HACK_BECAUSE_OF_ALLOW_JS", From ddb82e86b10f3dd2a0fc7ac7939b954ba9bb9bd6 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 28 Aug 2024 17:58:04 -0500 Subject: [PATCH 05/12] fix a couple --- .../functional_syntax/motoko_examples/phone-book/tsconfig.json | 2 +- .../functional_syntax/motoko_examples/superheroes/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/end_to_end/candid_rpc/functional_syntax/motoko_examples/phone-book/tsconfig.json b/tests/end_to_end/candid_rpc/functional_syntax/motoko_examples/phone-book/tsconfig.json index 31d2dd4a88..665f1cfea3 100644 --- a/tests/end_to_end/candid_rpc/functional_syntax/motoko_examples/phone-book/tsconfig.json +++ b/tests/end_to_end/candid_rpc/functional_syntax/motoko_examples/phone-book/tsconfig.json @@ -4,7 +4,7 @@ "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "jsx": "react", - "module": "commonjs", + "module": "ES2020", "strict": true, "target": "ES2020", "outDir": "HACK_BECAUSE_OF_ALLOW_JS" diff --git a/tests/end_to_end/candid_rpc/functional_syntax/motoko_examples/superheroes/tsconfig.json b/tests/end_to_end/candid_rpc/functional_syntax/motoko_examples/superheroes/tsconfig.json index 31d2dd4a88..665f1cfea3 100644 --- a/tests/end_to_end/candid_rpc/functional_syntax/motoko_examples/superheroes/tsconfig.json +++ b/tests/end_to_end/candid_rpc/functional_syntax/motoko_examples/superheroes/tsconfig.json @@ -4,7 +4,7 @@ "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "jsx": "react", - "module": "commonjs", + "module": "ES2020", "strict": true, "target": "ES2020", "outDir": "HACK_BECAUSE_OF_ALLOW_JS" From ea3a382c427ca995999dc82c0706ef4fa988bdbd Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 28 Aug 2024 18:18:49 -0500 Subject: [PATCH 06/12] remove import.meta.url to solve test compatability issues --- .../stable/commands/compile/javascript.ts | 2 +- src/lib/experimental/experimental.ts | 20 +++---------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/build/stable/commands/compile/javascript.ts b/src/build/stable/commands/compile/javascript.ts index a232601778..63072d9252 100644 --- a/src/build/stable/commands/compile/javascript.ts +++ b/src/build/stable/commands/compile/javascript.ts @@ -79,7 +79,7 @@ export function getBuildOptions(ts: string): BuildOptions { setup(build): void { build.onResolve( { - filter: /^internal$|^util$|^fs$|^fmt$|^assert$|^buffer$|^path$|^stream$|^process$|^url$|^events$|^string_decoder$|^punycode$|^querystring$|^whatwg_url$|^encoding$|^http$|^os$|^crypto$|^zlib$|^internal\/deps\/acorn\/acorn\/dist\/acorn$|^internal\/deps\/acorn\/acorn-walk\/dist\/walk$|^perf_hooks$|^async_hooks$|^https$|^_node:fs$|^_node:os$|^_node:crypto$|^qjs:os$|^_encoding$|^wasi_net$|^wasi_http$/ + filter: /^internal$|^util$|^fs$|^fs\/promises$|^fmt$|^assert$|^buffer$|^path$|^stream$|^process$|^url$|^events$|^string_decoder$|^punycode$|^querystring$|^whatwg_url$|^encoding$|^http$|^os$|^crypto$|^zlib$|^internal\/deps\/acorn\/acorn\/dist\/acorn$|^internal\/deps\/acorn\/acorn-walk\/dist\/walk$|^perf_hooks$|^async_hooks$|^https$|^_node:fs$|^_node:os$|^_node:crypto$|^qjs:os$|^_encoding$|^wasi_net$|^wasi_http$/ }, (args) => { throw new Error(experimentalMessage(args.path)); diff --git a/src/lib/experimental/experimental.ts b/src/lib/experimental/experimental.ts index 51e66dedcf..7d5504eb89 100644 --- a/src/lib/experimental/experimental.ts +++ b/src/lib/experimental/experimental.ts @@ -1,23 +1,9 @@ if (globalThis._azleExperimental !== true) { - const importName = getImportName(); - - throw new Error(experimentalMessage(importName)); -} - -function getImportName(): string { - if (import.meta.url.includes('azle/src/lib/experimental')) { - return 'azle/experimental'; - } - - throw new Error( - `Azle: Experimental import name for module path ${ - import.meta.url - } has not been created` - ); + throw new Error(experimentalMessage()); } -function experimentalMessage(importName: string): string { - return `Azle: experimental mode must be enabled to import from ${importName}. You can enable experimental mode in your dfx.json file like this: +function experimentalMessage(): string { + return `Azle: experimental mode must be enabled to import from azle/experimental. You can enable experimental mode in your dfx.json file like this: { "canisters": { "canisterName": { From 62e2f93a5f95ebce39b9eb9b75cf8199852cd160 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 28 Aug 2024 18:52:27 -0500 Subject: [PATCH 07/12] attempt to use ssh --- install_wasmedge_quickjs.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/install_wasmedge_quickjs.sh b/install_wasmedge_quickjs.sh index 8b823de07b..f94d37c6ef 100755 --- a/install_wasmedge_quickjs.sh +++ b/install_wasmedge_quickjs.sh @@ -2,9 +2,11 @@ WASMEDGE_REPO_PATH="./wasmedge_quickjs" rm -rf "$WASMEDGE_REPO_PATH" -git clone --depth 1 --filter=blob:none --sparse https://github.com/demergent-labs/wasmedge-quickjs "$WASMEDGE_REPO_PATH" +git clone --depth 1 --filter=blob:none --sparse git@github.com:demergent-labs/wasmedge-quickjs.git "$WASMEDGE_REPO_PATH" cd "$WASMEDGE_REPO_PATH" -git sparse-checkout set modules -git sparse-checkout add LICENSE -git sparse-checkout add LICENSE-QuickJS.txt +git sparse-checkout set modules LICENSE LICENSE-QuickJS.txt +# git sparse-checkout init +# git sparse-checkout add modules +# git sparse-checkout add LICENSE +# git sparse-checkout add LICENSE-QuickJS.txt git checkout c21ff69f442998e4cda4619166e23a9bc91418be From 537699c224cb4492498fcf2f8286bed3348c55e2 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 29 Aug 2024 12:35:39 -0500 Subject: [PATCH 08/12] add dependencies.json and switch back to http for wasmedge-quickjs installation --- dfx_extension/dependencies.json | 1 + install_wasmedge_quickjs.sh | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) create mode 100644 dfx_extension/dependencies.json diff --git a/dfx_extension/dependencies.json b/dfx_extension/dependencies.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/dfx_extension/dependencies.json @@ -0,0 +1 @@ +{} diff --git a/install_wasmedge_quickjs.sh b/install_wasmedge_quickjs.sh index f94d37c6ef..441d27c7e9 100755 --- a/install_wasmedge_quickjs.sh +++ b/install_wasmedge_quickjs.sh @@ -2,11 +2,7 @@ WASMEDGE_REPO_PATH="./wasmedge_quickjs" rm -rf "$WASMEDGE_REPO_PATH" -git clone --depth 1 --filter=blob:none --sparse git@github.com:demergent-labs/wasmedge-quickjs.git "$WASMEDGE_REPO_PATH" +git clone --depth 1 --filter=blob:none --sparse https://github.com/demergent-labs/wasmedge-quickjs.git "$WASMEDGE_REPO_PATH" cd "$WASMEDGE_REPO_PATH" git sparse-checkout set modules LICENSE LICENSE-QuickJS.txt -# git sparse-checkout init -# git sparse-checkout add modules -# git sparse-checkout add LICENSE -# git sparse-checkout add LICENSE-QuickJS.txt git checkout c21ff69f442998e4cda4619166e23a9bc91418be From 8029ff283ba0e86b30621787c88d45c5cbcaab7f Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 29 Aug 2024 12:45:20 -0500 Subject: [PATCH 09/12] try --skip-checks --- dfx_extension/dependencies.json | 8 +++++++- install_wasmedge_quickjs.sh | 2 +- publish-github-action.sh | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dfx_extension/dependencies.json b/dfx_extension/dependencies.json index 0967ef424b..5997c67ae8 100644 --- a/dfx_extension/dependencies.json +++ b/dfx_extension/dependencies.json @@ -1 +1,7 @@ -{} +{ + "0.23.0": { + "dfx": { + "version": ">=0.0.0" + } + } +} diff --git a/install_wasmedge_quickjs.sh b/install_wasmedge_quickjs.sh index 441d27c7e9..295891bd9d 100755 --- a/install_wasmedge_quickjs.sh +++ b/install_wasmedge_quickjs.sh @@ -4,5 +4,5 @@ rm -rf "$WASMEDGE_REPO_PATH" git clone --depth 1 --filter=blob:none --sparse https://github.com/demergent-labs/wasmedge-quickjs.git "$WASMEDGE_REPO_PATH" cd "$WASMEDGE_REPO_PATH" -git sparse-checkout set modules LICENSE LICENSE-QuickJS.txt +git sparse-checkout set --skip-checks modules LICENSE LICENSE-QuickJS.txt git checkout c21ff69f442998e4cda4619166e23a9bc91418be diff --git a/publish-github-action.sh b/publish-github-action.sh index 7972b53127..95f6aad775 100755 --- a/publish-github-action.sh +++ b/publish-github-action.sh @@ -12,6 +12,7 @@ directories=$(echo "$directories_json_string" | jq -c -r '.[]') sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json +# TODO we need to keep the dependencies.json file up-to-date as well npm install if [[ "$VERSION" == *"-rc."* ]]; From 0a4e315ce52046f19840ff2f6fa16ccae3f42a56 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 29 Aug 2024 14:48:09 -0500 Subject: [PATCH 10/12] remove install-dfx-extension --- .github/workflows/test.yml | 3 --- dfx_extension/dependencies.json | 7 ------- package-lock.json | 1 + package.json | 1 + src/lib/stable/globals.ts | 4 +++- 5 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 dfx_extension/dependencies.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 86d549f07d..923e2c219d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -376,9 +376,6 @@ jobs: shell: bash -l {0} working-directory: ${{ matrix.example_directories }} run: npm link azle - - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} - working-directory: ${{ matrix.example_directories }} - run: npx azle install-dfx-extension - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} working-directory: ${{ matrix.example_directories }} run: dfx start --clean --background --host 127.0.0.1:8000 diff --git a/dfx_extension/dependencies.json b/dfx_extension/dependencies.json deleted file mode 100644 index 5997c67ae8..0000000000 --- a/dfx_extension/dependencies.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "0.23.0": { - "dfx": { - "version": ">=0.0.0" - } - } -} diff --git a/package-lock.json b/package-lock.json index fbd276256a..d8dbc80ff9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "azle", "version": "0.23.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { "@dfinity/agent": "^1.1.0", diff --git a/package.json b/package.json index a7da1d6e89..f6d5d34831 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "typecheck": "tsc --noEmit", "lint": "if [ \"$npm_config_fix\" ]; then eslint . --ext .js,.ts --cache --fix; else eslint . --ext .js,.ts --cache; fi", "prepare": "./install_wasmedge_quickjs.sh && husky install", + "install": "cd dfx_extension && ./install.sh", "test": "test/test.sh" }, "type": "module", diff --git a/src/lib/stable/globals.ts b/src/lib/stable/globals.ts index f087cf22a2..b997697fee 100644 --- a/src/lib/stable/globals.ts +++ b/src/lib/stable/globals.ts @@ -117,7 +117,9 @@ if (globalThis._azleInsideCanister === true) { info: log }; - (globalThis as any).Buffer = createExperimentalWarningProxy('Buffer'); + if (globalThis._azleExperimental === false) { + (globalThis as any).Buffer = createExperimentalWarningProxy('Buffer'); + } } function createExperimentalWarningProxy(name: string): object { From 90b3360fe5c2df29c956067d55fecf06b0d6e80b Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 29 Aug 2024 15:43:23 -0500 Subject: [PATCH 11/12] install wasmedge_quickjs from github as an npm package --- install_wasmedge_quickjs.sh | 8 -------- package-lock.json | 8 +++++++- package.json | 5 +++-- src/build/experimental/utils/global_paths.ts | 1 + 4 files changed, 11 insertions(+), 11 deletions(-) delete mode 100755 install_wasmedge_quickjs.sh diff --git a/install_wasmedge_quickjs.sh b/install_wasmedge_quickjs.sh deleted file mode 100755 index 295891bd9d..0000000000 --- a/install_wasmedge_quickjs.sh +++ /dev/null @@ -1,8 +0,0 @@ -WASMEDGE_REPO_PATH="./wasmedge_quickjs" - -rm -rf "$WASMEDGE_REPO_PATH" - -git clone --depth 1 --filter=blob:none --sparse https://github.com/demergent-labs/wasmedge-quickjs.git "$WASMEDGE_REPO_PATH" -cd "$WASMEDGE_REPO_PATH" -git sparse-checkout set --skip-checks modules LICENSE LICENSE-QuickJS.txt -git checkout c21ff69f442998e4cda4619166e23a9bc91418be diff --git a/package-lock.json b/package-lock.json index d8dbc80ff9..56bb0ab610 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,8 @@ "text-encoding": "0.7.0", "tsx": "^4.15.7", "typescript": "^5.2.2", - "uuid": "^9.0.1" + "uuid": "^9.0.1", + "wasmedge_quickjs": "github:demergent-labs/wasmedge-quickjs#3b3b0ee91248ccf9cd954ffafbac7e024648af92" }, "bin": { "azle": "src/build/index.ts" @@ -8225,6 +8226,11 @@ "makeerror": "1.0.12" } }, + "node_modules/wasmedge_quickjs": { + "version": "0.0.0", + "resolved": "git+ssh://git@github.com/demergent-labs/wasmedge-quickjs.git#3b3b0ee91248ccf9cd954ffafbac7e024648af92", + "integrity": "sha512-YJ6XmvCtoMOF5/W00su0j6K0mkiDNWVbAGeVj12DhbeEdz0Z2Pr84Mz6rcTfFl8Oa1RQOGb6cWv/Pb5/UJ7/ug==" + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index f6d5d34831..c3936730a3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "typecheck": "tsc --noEmit", "lint": "if [ \"$npm_config_fix\" ]; then eslint . --ext .js,.ts --cache --fix; else eslint . --ext .js,.ts --cache; fi", - "prepare": "./install_wasmedge_quickjs.sh && husky install", + "prepare": "husky install", "install": "cd dfx_extension && ./install.sh", "test": "test/test.sh" }, @@ -52,7 +52,8 @@ "text-encoding": "0.7.0", "tsx": "^4.15.7", "typescript": "^5.2.2", - "uuid": "^9.0.1" + "uuid": "^9.0.1", + "wasmedge_quickjs": "github:demergent-labs/wasmedge-quickjs#3b3b0ee91248ccf9cd954ffafbac7e024648af92" }, "devDependencies": { "@types/deep-equal": "^1.0.4", diff --git a/src/build/experimental/utils/global_paths.ts b/src/build/experimental/utils/global_paths.ts index b603f5433f..bc2183e577 100644 --- a/src/build/experimental/utils/global_paths.ts +++ b/src/build/experimental/utils/global_paths.ts @@ -10,5 +10,6 @@ export const EXPERIMENTAL_CANISTER_TEMPLATE_PATH = join( export const WASMEDGE_QUICKJS_PATH = join( AZLE_PACKAGE_PATH, + 'node_modules', 'wasmedge_quickjs' ); From 9b152f4d5a05f1ee613a94665fddeb92880507b4 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 29 Aug 2024 18:34:28 -0500 Subject: [PATCH 12/12] get the wasmedge_quickjs directory in a universal way --- src/build/experimental/utils/global_paths.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/build/experimental/utils/global_paths.ts b/src/build/experimental/utils/global_paths.ts index bc2183e577..014169b4fb 100644 --- a/src/build/experimental/utils/global_paths.ts +++ b/src/build/experimental/utils/global_paths.ts @@ -1,4 +1,5 @@ -import { join } from 'path'; +import { createRequire } from 'module'; +import { dirname, join } from 'path'; import { AZLE_PACKAGE_PATH } from '../../stable/utils/global_paths'; @@ -8,8 +9,6 @@ export const EXPERIMENTAL_CANISTER_TEMPLATE_PATH = join( 'experimental.wasm' ); -export const WASMEDGE_QUICKJS_PATH = join( - AZLE_PACKAGE_PATH, - 'node_modules', - 'wasmedge_quickjs' +export const WASMEDGE_QUICKJS_PATH = dirname( + createRequire(import.meta.url).resolve('wasmedge_quickjs/package.json') );