envin 1.1.9 → 1.1.10
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.
- package/dist/index.js +1 -1
- package/dist/presets/arktype.d.ts +1 -1
- package/dist/presets/zod.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function y(e,t){if(e instanceof Promise)throw new Error(t)}function O(e,t){let s={},c=[];for(let a in e){let o=e[a]?.["~standard"].validate(t[a]);if(y(o,`Validation must be synchronous, but ${a} returned a Promise.`),o?.issues){c.push(...o.issues.map(d=>({...d,path:[a,...d.path??[]]})));continue}s[a]=o?.value}return c.length?{issues:c}:{value:s}}var h=e=>["function","object"].includes(typeof e)&&!!e&&"~standard"in e&&typeof e["~standard"]=="object"&&!!e["~standard"]&&"validate"in e["~standard"],v=e=>{if(!(typeof e!="object"||e===null)){if("default"in e&&!["object","function"].includes(typeof e.default))return e.default;if("_def"in e&&typeof e._def=="object"&&e._def!==null&&"defaultValue"in e._def)return typeof e._def.defaultValue=="function"?e._def.defaultValue?.():e._def.defaultValue}},D=e=>Object.fromEntries(Object.entries(e).map(([t,s])=>[t,v(s)]));var V=e=>["__esModule","$$typeof"].includes(e),I=(e,t)=>({...e.shared&&e.shared,...e.server&&t&&e.server,...e.client&&e.client}),k=(e,t)=>{let s=a=>({...a.extends?.reduce((d,u)=>({...d,...s(u)}),{})??{},...I(a,t)});return{...e.extends?.reduce((a,o)=>({...a,...s(o)}),{})??{},...I(e,t)}},f=class extends Error{constructor(t){super(t),this.name="EnvError"}};function j(e){let t=e.envStrict??e.env??process.env;for(let[n,r]of Object.entries(t))r===""&&delete t[n];let s=e.isServer??(typeof window>"u"||"Deno"in window),c=e.onError??(n=>{throw console.error("\u274C Invalid environment variables:",n),new f("Invalid environment variables")}),a=e.onInvalidAccess??(n=>{throw new f(`\u274C Attempted to access a server-side environment variable on the client: ${n}`)}),o=!!e.skip,d=k(e,s),u=e.transform?.(d,s)??d,S=h(u)?v(u):D(u),P=Object.fromEntries(Object.entries(t).map(([n,r])=>r!==void 0?[n,r]:[n,S&&n in S?S[n]:void 0]));if(o)return{...S,...P,_schema:d};let l=h(u)?u["~standard"].validate(t):O(d,t);if(y(l,"Validation must be synchronous!"),l.issues)return c(l.issues);let g=n=>{let r=i=>{let p={keys:Object.keys(i.client??{}),prefix:i.clientPrefix},x=(i.extends??[]).flatMap(m=>r(m));return[p,...x]},F=i=>{let p=Object.keys(i.shared??{}),x=(i.extends??[]).flatMap(m=>F(m));return[...p,...x]},E=r(e).some(i=>i.keys.includes(n)&&(!i.prefix||n.startsWith(i.prefix)));return!F(e).includes(n)&&!E},b=n=>s||!g(n);return new Proxy("value"in l?l.value:{},{get(n,r){if(typeof r=="string"&&!V(r))return r==="_schema"?d:b(r)?Reflect.get(n,r):a(r)}})}export{j as defineEnv};
|
|
@@ -154,7 +154,7 @@ declare const netlify: {
|
|
|
154
154
|
readonly server: {
|
|
155
155
|
readonly NETLIFY: arktype.BaseType<string | undefined, {}>;
|
|
156
156
|
readonly BUILD_ID: arktype.BaseType<string | undefined, {}>;
|
|
157
|
-
readonly CONTEXT: arktype.BaseType<"production" | "deploy-preview" | "branch-deploy" |
|
|
157
|
+
readonly CONTEXT: arktype.BaseType<"dev" | "production" | "deploy-preview" | "branch-deploy" | undefined, {}>;
|
|
158
158
|
readonly REPOSITORY_URL: arktype.BaseType<string | undefined, {}>;
|
|
159
159
|
readonly BRANCH: arktype.BaseType<string | undefined, {}>;
|
|
160
160
|
readonly URL: arktype.BaseType<string | undefined, {}>;
|
package/dist/presets/zod.d.ts
CHANGED
|
@@ -169,10 +169,10 @@ declare const netlify: {
|
|
|
169
169
|
readonly NETLIFY: z.ZodOptional<z.ZodString>;
|
|
170
170
|
readonly BUILD_ID: z.ZodOptional<z.ZodString>;
|
|
171
171
|
readonly CONTEXT: z.ZodOptional<z.ZodEnum<{
|
|
172
|
+
dev: "dev";
|
|
172
173
|
production: "production";
|
|
173
174
|
"deploy-preview": "deploy-preview";
|
|
174
175
|
"branch-deploy": "branch-deploy";
|
|
175
|
-
dev: "dev";
|
|
176
176
|
}>>;
|
|
177
177
|
readonly REPOSITORY_URL: z.ZodOptional<z.ZodString>;
|
|
178
178
|
readonly BRANCH: z.ZodOptional<z.ZodString>;
|