@vineforecast/next-public-env 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- import{a as S}from"../chunk-CPE4ZGRB.js";import{z as m}from"zod/v4";import*as h from"zod/v4/core";import{FlushConfig as T}from"./FlushConfig.js";import{jsx as g}from"react/jsx-runtime";var f=({config:e,nonce:r})=>{let t=S(e);return g("script",{dangerouslySetInnerHTML:{__html:t},type:"text/javascript",nonce:r})};import{PHASE_PRODUCTION_BUILD as O}from"next/constants";import{Suspense as _}from"react";import*as d from"next/server";import{unstable_noStore as P}from"next/cache";async function i(e){if(P(),e)return d.connection()}import{jsx as o}from"react/jsx-runtime";function C(e){return`\u274C Invalid environment variables found:
1
+ import{a as d}from"../chunk-CPE4ZGRB.js";import{z as E}from"zod/v4";import*as v from"zod/v4/core";import{jsx as g}from"react/jsx-runtime";var f=({config:e,nonce:r})=>{let t=d(e);return g("script",{dangerouslySetInnerHTML:{__html:t},type:"text/javascript",nonce:r})};import{PHASE_PRODUCTION_BUILD as T}from"next/constants";import{Suspense as O}from"react";import*as m from"next/server";import{unstable_noStore as P}from"next/cache";async function i(e){if(P(),e)return m.connection()}import{jsx as o}from"react/jsx-runtime";function _(e){return`\u274C Invalid environment variables found:
2
2
  ${e.issues.map(t=>`- Invalid variable [${t.path.join(".")||"configuration"}]: ${t.message}`).join(`
3
- `)}`}function E(){if(typeof window<"u")throw new Error("This wasn't supposed to happen. This file should only be resolved on the server.")}function H(e,r){let t=r?.schema,s=process.env.NEXT_PHASE===O,c=(()=>{if(!t||s&&!r?.validateAtBuildStep)return e;let n=t(m),b=m.object(n),a=h.safeParse(b,e);if(!a.success){let y=C(a.error);throw new Error(y)}return a.data})(),p=JSON.stringify(c),v=r?.dynamicRendering??"auto",u=process.env.__NEXT_CACHE_COMPONENTS==="true"||process.env.__NEXT_CACHE_COMPONENTS===!0,l=async({nonce:n})=>(v==="auto"&&await i(u),o(T,{config:p,nonce:n}));return{getPublicEnv(){return E(),i(),c},async getPublicEnvAsync(){return E(),await i(!0),c},async PublicEnv({nonce:n}){return u?o(_,{fallback:null,children:o(l,{nonce:n})}):o(l,{nonce:n})},PublicEnvScript({nonce:n}){return o(f,{config:p,nonce:n})}}}export{H as createPublicEnv};
3
+ `)}`}function h(){if(typeof window<"u")throw new Error("This wasn't supposed to happen. This file should only be resolved on the server.")}function I(e,r){let t=r?.schema,p=process.env.NEXT_PHASE===T,c=(()=>{if(!t||p&&!r?.validateAtBuildStep)return e;let n=t(E),a=E.object(n),s=v.safeParse(a,e);if(!s.success){let y=_(s.error);throw new Error(y)}return s.data})(),u=JSON.stringify(c),b=r?.dynamicRendering??"auto",l=process.env.__NEXT_CACHE_COMPONENTS==="true"||process.env.__NEXT_CACHE_COMPONENTS===!0,S=async({nonce:n})=>{b==="auto"&&await i(l);let{FlushConfig:a}=await import("./FlushConfig.js");return o(a,{config:u,nonce:n})};return{getPublicEnv(){return h(),i(),c},async getPublicEnvAsync(){return h(),await i(!0),c},async PublicEnv({nonce:n}){return l?o(O,{fallback:null,children:o(S,{nonce:n})}):o(S,{nonce:n})},PublicEnvScript({nonce:n}){return o(f,{config:u,nonce:n})}}}export{I as createPublicEnv};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vineforecast/next-public-env",
3
3
  "description": "Manage type-safe runtime environment variables in Next.js for both the server and the client.",
4
- "version": "1.3.0",
4
+ "version": "1.4.0",
5
5
  "author": "alizeait",
6
6
  "license": "MIT",
7
7
  "type": "module",