@t3-oss/env-nextjs
Advanced tools
Comparing version 0.2.2 to 0.2.3-canary.d741dde
@@ -28,4 +28,4 @@ import * as zod from 'zod'; | ||
} | ||
declare function createEnv<TServer extends Record<string, ZodType> = NonNullable<unknown>, TClient extends Record<`${ClientPrefix}${string}`, ZodType> = NonNullable<unknown>>({ runtimeEnv, ...opts }: Options<TServer, TClient>): (zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TServer>, (zod.baseObjectOutputType<TServer> extends infer T_2 extends object ? { [k_1 in keyof T_2]: undefined extends zod.baseObjectOutputType<TServer>[k_1] ? never : k_1; } : never)[keyof TServer]> extends infer T ? { [k in keyof T]: zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TServer>, (zod.baseObjectOutputType<TServer> extends infer T_1 extends object ? { [k_1 in keyof T_1]: undefined extends zod.baseObjectOutputType<TServer>[k_1] ? never : k_1; } : never)[keyof TServer]>[k]; } : never) & (zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TClient>, (zod.baseObjectOutputType<TClient> extends infer T_5 extends object ? { [k_3 in keyof T_5]: undefined extends zod.baseObjectOutputType<TClient>[k_3] ? never : k_3; } : never)[keyof TClient]> extends infer T_3 ? { [k_2 in keyof T_3]: zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TClient>, (zod.baseObjectOutputType<TClient> extends infer T_4 extends object ? { [k_3 in keyof T_4]: undefined extends zod.baseObjectOutputType<TClient>[k_3] ? never : k_3; } : never)[keyof TClient]>[k_2]; } : never); | ||
declare function createEnv<TServer extends Record<string, ZodType> = NonNullable<unknown>, TClient extends Record<`${ClientPrefix}${string}`, ZodType> = NonNullable<unknown>>({ runtimeEnv, ...opts }: Options<TServer, TClient>): (zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TServer>, (zod.baseObjectOutputType<TServer> extends infer T_9 extends object ? { [k_1 in keyof T_9]: undefined extends zod.baseObjectOutputType<TServer>[k_1] ? never : k_1; } : never)[keyof TServer]> extends infer T_7 ? { [k in keyof T_7]: zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TServer>, (zod.baseObjectOutputType<TServer> extends infer T_8 extends object ? { [k_1 in keyof T_8]: undefined extends zod.baseObjectOutputType<TServer>[k_1] ? never : k_1; } : never)[keyof TServer]>[k]; } : never) & (zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TClient>, (zod.baseObjectOutputType<TClient> extends infer T_12 extends object ? { [k_3 in keyof T_12]: undefined extends zod.baseObjectOutputType<TClient>[k_3] ? never : k_3; } : never)[keyof TClient]> extends infer T_10 ? { [k_2 in keyof T_10]: zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TClient>, (zod.baseObjectOutputType<TClient> extends infer T_11 extends object ? { [k_3 in keyof T_11]: undefined extends zod.baseObjectOutputType<TClient>[k_3] ? never : k_3; } : never)[keyof TClient]>[k_2]; } : never) extends infer T ? { [TKey in keyof T]: ((zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TServer>, (zod.baseObjectOutputType<TServer> extends infer T_3 extends object ? { [k_1 in keyof T_3]: undefined extends zod.baseObjectOutputType<TServer>[k_1] ? never : k_1; } : never)[keyof TServer]> extends infer T_1 ? { [k in keyof T_1]: zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TServer>, (zod.baseObjectOutputType<TServer> extends infer T_2 extends object ? { [k_1 in keyof T_2]: undefined extends zod.baseObjectOutputType<TServer>[k_1] ? never : k_1; } : never)[keyof TServer]>[k]; } : never) & (zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TClient>, (zod.baseObjectOutputType<TClient> extends infer T_6 extends object ? { [k_3 in keyof T_6]: undefined extends zod.baseObjectOutputType<TClient>[k_3] ? never : k_3; } : never)[keyof TClient]> extends infer T_4 ? { [k_2 in keyof T_4]: zod.objectUtil.addQuestionMarks<zod.baseObjectOutputType<TClient>, (zod.baseObjectOutputType<TClient> extends infer T_5 extends object ? { [k_3 in keyof T_5]: undefined extends zod.baseObjectOutputType<TClient>[k_3] ? never : k_3; } : never)[keyof TClient]>[k_2]; } : never))[TKey]; } : never; | ||
export { 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 l(e){let r=_nullishCoalesce(_nullishCoalesce(e.runtimeEnvStrict, () => (e.runtimeEnv)), () => (process.env));if(_nullishCoalesce(e.skipValidation, () => ((!!process.env.SKIP_ENV_VALIDATION&&process.env.SKIP_ENV_VALIDATION!=="false"&&process.env.SKIP_ENV_VALIDATION!=="0"))))return r;let a=typeof e.client=="object"?e.client:{},o=_zod2.default.object(a),v=_zod2.default.object(e.server),s=_nullishCoalesce(e.isServer, () => (typeof window>"u")),p=v.merge(o),i=s?p.safeParse(r):o.safeParse(r),f=_nullishCoalesce(e.onValidationError, () => ((t=>{throw console.error("\u274C Invalid environment variables:",t.flatten().fieldErrors),new Error("Invalid environment variables")}))),d=_nullishCoalesce(e.onInvalidAccess, () => ((t=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")})));return i.success===!1?f(i.error):new Proxy(i.data,{get(t,n){if(typeof n=="string")return!s&&!n.startsWith(e.clientPrefix)?d(n):t[n]}})}var T="NEXT_PUBLIC_";function C({runtimeEnv:e,...r}){return l({...r,clientPrefix:T,runtimeEnvStrict:e})}exports.createEnv = C; | ||
"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 l(e){let r=_nullishCoalesce(_nullishCoalesce(e.runtimeEnvStrict, () => (e.runtimeEnv)), () => (process.env));if(e.skipValidation)return r;let a=typeof e.client=="object"?e.client:{},o=_zod2.default.object(a),v=_zod2.default.object(e.server),s=_nullishCoalesce(e.isServer, () => (typeof window>"u")),d=v.merge(o),i=s?d.safeParse(r):o.safeParse(r),f=_nullishCoalesce(e.onValidationError, () => ((t=>{throw console.error("\u274C Invalid environment variables:",t.flatten().fieldErrors),new Error("Invalid environment variables")}))),p=_nullishCoalesce(e.onInvalidAccess, () => ((t=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")})));return i.success===!1?f(i.error):new Proxy(i.data,{get(t,n){if(typeof n=="string")return!s&&!n.startsWith(e.clientPrefix)?p(n):t[n]}})}var u="NEXT_PUBLIC_";function C({runtimeEnv:e,...r}){return l({...r,clientPrefix:u,runtimeEnvStrict:e})}exports.createEnv = C; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@t3-oss/env-nextjs", | ||
"version": "0.2.2", | ||
"version": "0.2.3-canary.d741dde", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "create-t3-app", |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
23441
45
2