From 58edcda609d5cad80f821f7b6b98a93d4e7af0a3 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Mon, 13 Jan 2025 08:45:32 +0100 Subject: [PATCH] feat: tree-shakable zod --- scripts/i18n.mjs | 2 +- src/types/blob.ts | 2 +- src/types/i18n.ts | 2 +- src/types/icrc-accounts.ts | 2 +- src/types/icrc-requests.ts | 2 +- src/types/icrc-responses.ts | 2 +- src/types/icrc-standards.ts | 2 +- src/types/post-message.ts | 2 +- src/types/principal.ts | 2 +- src/types/relying-party-options.ts | 2 +- src/types/relying-party-requests.ts | 2 +- src/types/relying-party.ts | 2 +- src/types/rpc.spec.ts | 2 +- src/types/rpc.ts | 2 +- src/types/signer-handlers.ts | 2 +- src/types/signer-options.ts | 2 +- src/types/signer-prompts.ts | 2 +- src/types/signer-sessions.ts | 2 +- src/types/signer.ts | 2 +- src/types/url.ts | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/i18n.mjs b/scripts/i18n.mjs index 367631f6..5f109520 100644 --- a/scripts/i18n.mjs +++ b/scripts/i18n.mjs @@ -38,7 +38,7 @@ const generateTypes = async () => { ) .join('\n\n'); - const schema = `import { z } from 'zod'; + const schema = `import * as z from 'zod'; ${schemas} diff --git a/src/types/blob.ts b/src/types/blob.ts index 24e680e4..ebabeab6 100644 --- a/src/types/blob.ts +++ b/src/types/blob.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; export const IcrcBlobSchema = z.string().refine( (val) => { diff --git a/src/types/i18n.ts b/src/types/i18n.ts index b52138d5..d059b6f2 100644 --- a/src/types/i18n.ts +++ b/src/types/i18n.ts @@ -1,5 +1,5 @@ // Auto-generated definitions file ("npm run i18n") -import {z} from 'zod'; +import * as z from 'zod'; export const i18nCoreSchema = z .object({ diff --git a/src/types/icrc-accounts.ts b/src/types/icrc-accounts.ts index 7af4b92b..af1240f8 100644 --- a/src/types/icrc-accounts.ts +++ b/src/types/icrc-accounts.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import {base64ToUint8Array} from '../utils/base64.utils'; import {IcrcBlobSchema} from './blob'; import {PrincipalTextSchema} from './principal'; diff --git a/src/types/icrc-requests.ts b/src/types/icrc-requests.ts index 76968ef0..2af86d77 100644 --- a/src/types/icrc-requests.ts +++ b/src/types/icrc-requests.ts @@ -1,5 +1,5 @@ import {isNullish} from '@dfinity/utils'; -import {z} from 'zod'; +import * as z from 'zod'; import { ICRC25_PERMISSIONS, ICRC25_REQUEST_PERMISSIONS, diff --git a/src/types/icrc-responses.ts b/src/types/icrc-responses.ts index 13903036..4bb1def1 100644 --- a/src/types/icrc-responses.ts +++ b/src/types/icrc-responses.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import {IcrcBlobSchema} from './blob'; import {IcrcAccountsSchema} from './icrc-accounts'; import { diff --git a/src/types/icrc-standards.ts b/src/types/icrc-standards.ts index 9ca0a6ce..2df716ba 100644 --- a/src/types/icrc-standards.ts +++ b/src/types/icrc-standards.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import { ICRC21, ICRC21_CALL_CONSENT_MESSAGE, diff --git a/src/types/post-message.ts b/src/types/post-message.ts index 72efe9e5..ebddb27d 100644 --- a/src/types/post-message.ts +++ b/src/types/post-message.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import {UrlSchema} from './url'; export const OriginSchema = UrlSchema; diff --git a/src/types/principal.ts b/src/types/principal.ts index 178c25b6..251ad320 100644 --- a/src/types/principal.ts +++ b/src/types/principal.ts @@ -1,5 +1,5 @@ import {Principal} from '@dfinity/principal'; -import {z} from 'zod'; +import * as z from 'zod'; export const PrincipalTextSchema = z.string().refine( (principal) => { diff --git a/src/types/relying-party-options.ts b/src/types/relying-party-options.ts index 7d65a5ec..98dd11b5 100644 --- a/src/types/relying-party-options.ts +++ b/src/types/relying-party-options.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import {UrlSchema} from './url'; const ConnectionOptionsSchema = z.object({ diff --git a/src/types/relying-party-requests.ts b/src/types/relying-party-requests.ts index 712cb878..39451789 100644 --- a/src/types/relying-party-requests.ts +++ b/src/types/relying-party-requests.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import {RpcIdSchema} from './rpc'; export const RelyingPartyRequestOptionsTimeoutSchema = z.object({ diff --git a/src/types/relying-party.ts b/src/types/relying-party.ts index 85392a94..b2123f04 100644 --- a/src/types/relying-party.ts +++ b/src/types/relying-party.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import {IcrcScopesSchema, IcrcSupportedStandardsSchema} from './icrc-responses'; const RelyingPartyMessageEventDataSchema = z diff --git a/src/types/rpc.spec.ts b/src/types/rpc.spec.ts index 686dfb49..0f453c1f 100644 --- a/src/types/rpc.spec.ts +++ b/src/types/rpc.spec.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import { JSON_RPC_VERSION_2, RpcErrorCode, diff --git a/src/types/rpc.ts b/src/types/rpc.ts index ff7af610..93a6b38f 100644 --- a/src/types/rpc.ts +++ b/src/types/rpc.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; // JSON-RPC 2.0 Specification // https://www.jsonrpc.org/specification diff --git a/src/types/signer-handlers.ts b/src/types/signer-handlers.ts index 43e0107e..6b1dde1e 100644 --- a/src/types/signer-handlers.ts +++ b/src/types/signer-handlers.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import {RpcIdSchema} from './rpc'; const NotifySchema = z.object({ diff --git a/src/types/signer-options.ts b/src/types/signer-options.ts index 2adc0f92..90920571 100644 --- a/src/types/signer-options.ts +++ b/src/types/signer-options.ts @@ -1,6 +1,6 @@ import {type Identity} from '@dfinity/agent'; import {isNullish} from '@dfinity/utils'; -import {z} from 'zod'; +import * as z from 'zod'; import {UrlSchema} from './url'; const IdentitySchema = z.custom((value: unknown): boolean => { diff --git a/src/types/signer-prompts.ts b/src/types/signer-prompts.ts index 632b5c36..10228a86 100644 --- a/src/types/signer-prompts.ts +++ b/src/types/signer-prompts.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import { ICRC21_CALL_CONSENT_MESSAGE, ICRC25_REQUEST_PERMISSIONS, diff --git a/src/types/signer-sessions.ts b/src/types/signer-sessions.ts index c3fe1558..8fbd5ab9 100644 --- a/src/types/signer-sessions.ts +++ b/src/types/signer-sessions.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import {IcrcScopeSchema} from './icrc-responses'; export const SessionTimestampsSchema = z.object({ diff --git a/src/types/signer.ts b/src/types/signer.ts index 01ff618b..dc99e630 100644 --- a/src/types/signer.ts +++ b/src/types/signer.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; import { IcrcAccountsRequestSchema, IcrcPermissionsRequestSchema, diff --git a/src/types/url.ts b/src/types/url.ts index eedd90c7..7e61b5fb 100644 --- a/src/types/url.ts +++ b/src/types/url.ts @@ -1,4 +1,4 @@ -import {z} from 'zod'; +import * as z from 'zod'; export const UrlSchema = z .string()