Socket
Socket
Sign inDemoInstall

@t3-oss/env-core

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@t3-oss/env-core - npm Package Compare versions

Comparing version 0.2.3-canary.edd0ea5 to 0.3.1-canary.0371e4a

8

dist/index.d.ts

@@ -5,3 +5,3 @@ import z, { ZodType, ZodError, ZodObject } from 'zod';

type Simplify<T> = {
[TKey in keyof T]: T[TKey];
[P in keyof T]: T[P];
} & {};

@@ -21,3 +21,3 @@ interface BaseOptions<TPrefix extends string, TServer extends Record<string, ZodType>, TClient extends Record<string, ZodType>> {

runtimeEnvStrict?: never;
runtimeEnv: Record<string, string | undefined>;
runtimeEnv: Record<string, string | boolean | number | undefined>;
}

@@ -27,7 +27,7 @@ interface StrictOptions<TPrefix extends string, TServer extends Record<string, ZodType>, TClient extends Record<string, ZodType>> extends BaseOptions<TPrefix, TServer, TClient> {

[TKey in keyof TClient]: TKey extends `${TPrefix}${string}` ? TKey : never;
}[keyof TClient] | keyof TServer, string | undefined>;
}[keyof TClient] | keyof TServer, string | boolean | number | undefined>;
runtimeEnv?: never;
}
declare function createEnv<TPrefix extends string, TServer extends Record<string, ZodType> = NonNullable<unknown>, TClient extends Record<string, ZodType> = NonNullable<unknown>>(opts: LooseOptions<TPrefix, TServer, TClient> | StrictOptions<TPrefix, TServer, TClient>): Simplify<TClient extends Record<string, never> ? z.infer<ZodObject<TServer>> : TServer extends Record<string, never> ? z.infer<ZodObject<TClient>> : z.infer<ZodObject<TServer>> & z.infer<ZodObject<TClient>>>;
declare function createEnv<TPrefix extends string, TServer extends Record<string, ZodType> = NonNullable<unknown>, TClient extends Record<string, ZodType> = NonNullable<unknown>>(opts: LooseOptions<TPrefix, TServer, TClient> | StrictOptions<TPrefix, TServer, TClient>): Simplify<z.infer<ZodObject<TServer>> & z.infer<ZodObject<TClient>>>;
export { BaseOptions, ErrorMessage, LooseOptions, Simplify, StrictOptions, createEnv };

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);function g(e){let t=_nullishCoalesce(_nullishCoalesce(e.runtimeEnvStrict, () => (e.runtimeEnv)), () => (process.env));if(!!e.skipValidation)return t;let T=typeof e.client=="object"?e.client:{},o=_zod2.default.object(T),c=_zod2.default.object(e.server),s=_nullishCoalesce(e.isServer, () => (typeof window>"u")),a=c.merge(o),i=s?a.safeParse(t):o.safeParse(t),l=_nullishCoalesce(e.onValidationError, () => ((r=>{throw console.error("\u274C Invalid environment variables:",r.flatten().fieldErrors),new Error("Invalid environment variables")}))),v=_nullishCoalesce(e.onInvalidAccess, () => ((r=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")})));return i.success===!1?l(i.error):new Proxy(i.data,{get(r,n){if(typeof n=="string")return!s&&!n.startsWith(e.clientPrefix)?v(n):r[n]}})}exports.createEnv = g;
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);function g(e){let t=_nullishCoalesce(_nullishCoalesce(e.runtimeEnvStrict, () => (e.runtimeEnv)), () => (process.env));if(!!e.skipValidation)return t;let a=typeof e.client=="object"?e.client:{},o=_zod2.default.object(a),T=_zod2.default.object(e.server),s=_nullishCoalesce(e.isServer, () => (typeof window>"u")),c=T.merge(o),i=s?c.safeParse(t):o.safeParse(t),l=_nullishCoalesce(e.onValidationError, () => ((r=>{throw console.error("\u274C Invalid environment variables:",r.flatten().fieldErrors),new Error("Invalid environment variables")}))),v=_nullishCoalesce(e.onInvalidAccess, () => ((r=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")})));return i.success===!1?l(i.error):new Proxy(i.data,{get(r,n){if(typeof n=="string")return!s&&!n.startsWith(e.clientPrefix)?v(n):r[n]}})}exports.createEnv = g;
//# sourceMappingURL=index.js.map
{
"name": "@t3-oss/env-core",
"version": "0.2.3-canary.edd0ea5",
"version": "0.3.1-canary.0371e4a",
"keywords": [

@@ -34,2 +34,3 @@ "create-t3-app",

"peerDependencies": {
"typescript": ">=4.7.2",
"zod": "^3.0.0"

@@ -36,0 +37,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc