@arkenv/nextjs 0.0.1
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/LICENSE +21 -0
- package/dist/create-env-NTGNQN-0.cjs +2 -0
- package/dist/create-env-NTGNQN-0.cjs.map +1 -0
- package/dist/create-env-u3WlRe7_.js +2 -0
- package/dist/create-env-u3WlRe7_.js.map +1 -0
- package/dist/index-Bu2HxG6d.d.cts +90 -0
- package/dist/index-Bu2HxG6d.d.cts.map +1 -0
- package/dist/index-DLivsH0-.d.ts +90 -0
- package/dist/index-DLivsH0-.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +28 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/react-server.cjs +2 -0
- package/dist/react-server.cjs.map +1 -0
- package/dist/react-server.d.cts +28 -0
- package/dist/react-server.d.cts.map +1 -0
- package/dist/react-server.d.ts +28 -0
- package/dist/react-server.d.ts.map +1 -0
- package/dist/react-server.js +2 -0
- package/dist/react-server.js.map +1 -0
- package/package.json +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Yam Borodetsky <https://yam.codes/>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e=require(`arkenv`);function t(t,n){let r=t.server||{},i=t.client||{},a=t.shared||{},o=t.runtimeEnv;for(let e of Object.keys(i))if(!e.startsWith(`NEXT_PUBLIC_`))throw Error(`Client-side environment variables must be prefixed with 'NEXT_PUBLIC_'. Found invalid key: ${e}`);let s=[...Object.keys(i),...Object.keys(a)];for(let e of s)if(!(e in o))throw Error(`Missing key in runtimeEnv: ${e}. All client and shared environment variables must be explicitly destructured in runtimeEnv.`);let c={};for(let e of Object.keys(o))o[e]!==void 0&&(c[e]=o[e]);if(n)for(let e of Object.keys(r))c[e]===void 0&&process.env[e]!==void 0&&(c[e]=process.env[e]);let l=(0,e.createEnv)(n?{...r,...i,...a}:{...i,...a},{env:c});return new Proxy(l,{get(e,t,o){if(typeof t==`string`&&t in r&&!(t in i)&&!(t in a)&&!n)throw Error(`Accessing server-side environment variable '${t}' on the client is not allowed.`);return Reflect.get(e,t,o)}})}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
2
|
+
//# sourceMappingURL=create-env-NTGNQN-0.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-env-NTGNQN-0.cjs","names":[],"sources":["../src/create-env.ts"],"sourcesContent":["import type { SchemaShape } from \"@repo/types\";\nimport { createEnv as coreCreateEnv } from \"arkenv\";\n\n/**\n * Validate and wrap environment variables in a security proxy.\n *\n * @internal\n *\n * @remarks\n * This internal module contains the core Next.js environment validation logic. It is split from\n * the public entry points to separate execution paths (RSC vs. SSR/Client) at the bundler layer.\n *\n * **Trade-offs & Design Decisions:**\n * 1. **Bundler Resolution (isServer)**: The `isServer` flag is statically hardcoded by the respective\n * entry points (`src/index.ts` and `src/react-server.ts`) resolved via package conditional exports\n * (`react-server` vs `default`). This resolves client component SSR environment poisoning without\n * relying on fragile runtime heuristics.\n * 2. **Type Circuit Breaker (unknown return)**: This function returns `unknown` rather than the complex,\n * recursive ArkType validation types. This prevents TypeScript's compiler from recursively evaluating\n * type mapping depths inside the internal implementation, bypassing `TS2589` instantiation limits.\n *\n * @param options The environment validation configuration options\n * @param isServer Whether the code is running in a server component (RSC) context\n * @returns A validated, readonly environment variables object wrapped in a security proxy\n * @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`\n * @throws An error if any client or shared variable is missing from `runtimeEnv`\n */\nexport function createEnvInternal(\n\toptions: {\n\t\tserver?: SchemaShape;\n\t\tclient?: Record<string, unknown>;\n\t\tshared?: SchemaShape;\n\t\truntimeEnv: Record<string, unknown>;\n\t},\n\tisServer: boolean,\n): unknown {\n\tconst server = options.server || {};\n\tconst client = options.client || {};\n\tconst shared = options.shared || {};\n\tconst runtimeEnv = options.runtimeEnv;\n\n\t// Validate options\n\t// For client keys, check prefix\n\tfor (const key of Object.keys(client)) {\n\t\tif (!key.startsWith(\"NEXT_PUBLIC_\")) {\n\t\t\tthrow new Error(\n\t\t\t\t`Client-side environment variables must be prefixed with 'NEXT_PUBLIC_'. Found invalid key: ${key}`,\n\t\t\t);\n\t\t}\n\t}\n\n\t// Check runtimeEnv has all client and shared keys\n\tconst requiredKeys = [...Object.keys(client), ...Object.keys(shared)];\n\tfor (const key of requiredKeys) {\n\t\tif (!(key in runtimeEnv)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Missing key in runtimeEnv: ${key}. All client and shared environment variables must be explicitly destructured in runtimeEnv.`,\n\t\t\t);\n\t\t}\n\t}\n\n\t// Prepare combined environment for core validation\n\tconst combinedEnv: Record<string, string | undefined> = {};\n\n\tfor (const key of Object.keys(runtimeEnv)) {\n\t\tif (runtimeEnv[key] !== undefined) {\n\t\t\tcombinedEnv[key] = runtimeEnv[key] as string;\n\t\t}\n\t}\n\n\tif (isServer) {\n\t\t// Fallback server keys to process.env if omitted or undefined\n\t\tfor (const key of Object.keys(server)) {\n\t\t\tif (combinedEnv[key] === undefined && process.env[key] !== undefined) {\n\t\t\t\tcombinedEnv[key] = process.env[key];\n\t\t\t}\n\t\t}\n\t}\n\n\t// Select schema based on environment\n\tconst schema = isServer\n\t\t? { ...server, ...client, ...shared }\n\t\t: { ...client, ...shared };\n\n\t// Run core validation\n\t// Note: We cast schema to `any` here to avoid a compilation TS2589 error\n\t// (Type instantiation is excessively deep and possibly infinite).\n\t// Evaluating the full generic intersection schema under `EnvSchema<T>`\n\t// exceeds TypeScript's instantiation limits for generic components.\n\tconst validated = coreCreateEnv(schema as any, { env: combinedEnv });\n\n\t// Return a Proxy wrapper\n\treturn new Proxy(validated, {\n\t\tget(target, prop, receiver) {\n\t\t\tif (typeof prop === \"string\") {\n\t\t\t\tconst isServerOnlyKey =\n\t\t\t\t\tprop in server && !(prop in client) && !(prop in shared);\n\t\t\t\tif (isServerOnlyKey && !isServer) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Accessing server-side environment variable '${prop}' on the client is not allowed.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn Reflect.get(target, prop, receiver);\n\t\t},\n\t});\n}\n"],"mappings":"wBA2BA,SAAgB,EACf,EAMA,EACU,CACV,IAAM,EAAS,EAAQ,QAAU,EAAE,CAC7B,EAAS,EAAQ,QAAU,EAAE,CAC7B,EAAS,EAAQ,QAAU,EAAE,CAC7B,EAAa,EAAQ,WAI3B,IAAK,IAAM,KAAO,OAAO,KAAK,EAAO,CACpC,GAAI,CAAC,EAAI,WAAW,eAAe,CAClC,MAAU,MACT,8FAA8F,IAC9F,CAKH,IAAM,EAAe,CAAC,GAAG,OAAO,KAAK,EAAO,CAAE,GAAG,OAAO,KAAK,EAAO,CAAC,CACrE,IAAK,IAAM,KAAO,EACjB,GAAI,EAAE,KAAO,GACZ,MAAU,MACT,8BAA8B,EAAI,8FAClC,CAKH,IAAM,EAAkD,EAAE,CAE1D,IAAK,IAAM,KAAO,OAAO,KAAK,EAAW,CACpC,EAAW,KAAS,IAAA,KACvB,EAAY,GAAO,EAAW,IAIhC,GAAI,MAEE,IAAM,KAAO,OAAO,KAAK,EAAO,CAChC,EAAY,KAAS,IAAA,IAAa,QAAQ,IAAI,KAAS,IAAA,KAC1D,EAAY,GAAO,QAAQ,IAAI,IAelC,IAAM,GAAA,EAAA,EAAA,WATS,EACZ,CAAE,GAAG,EAAQ,GAAG,EAAQ,GAAG,EAAQ,CACnC,CAAE,GAAG,EAAQ,GAAG,EAAQ,CAOoB,CAAE,IAAK,EAAa,CAAC,CAGpE,OAAO,IAAI,MAAM,EAAW,CAC3B,IAAI,EAAQ,EAAM,EAAU,CAC3B,GAAI,OAAO,GAAS,UAElB,KAAQ,GAAU,EAAE,KAAQ,IAAW,EAAE,KAAQ,IAC3B,CAAC,EACvB,MAAU,MACT,+CAA+C,EAAK,iCACpD,CAGH,OAAO,QAAQ,IAAI,EAAQ,EAAM,EAAS,EAE3C,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createEnv as e}from"arkenv";function t(t,n){let r=t.server||{},i=t.client||{},a=t.shared||{},o=t.runtimeEnv;for(let e of Object.keys(i))if(!e.startsWith(`NEXT_PUBLIC_`))throw Error(`Client-side environment variables must be prefixed with 'NEXT_PUBLIC_'. Found invalid key: ${e}`);let s=[...Object.keys(i),...Object.keys(a)];for(let e of s)if(!(e in o))throw Error(`Missing key in runtimeEnv: ${e}. All client and shared environment variables must be explicitly destructured in runtimeEnv.`);let c={};for(let e of Object.keys(o))o[e]!==void 0&&(c[e]=o[e]);if(n)for(let e of Object.keys(r))c[e]===void 0&&process.env[e]!==void 0&&(c[e]=process.env[e]);let l=e(n?{...r,...i,...a}:{...i,...a},{env:c});return new Proxy(l,{get(e,t,o){if(typeof t==`string`&&t in r&&!(t in i)&&!(t in a)&&!n)throw Error(`Accessing server-side environment variable '${t}' on the client is not allowed.`);return Reflect.get(e,t,o)}})}export{t};
|
|
2
|
+
//# sourceMappingURL=create-env-u3WlRe7_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-env-u3WlRe7_.js","names":["coreCreateEnv"],"sources":["../src/create-env.ts"],"sourcesContent":["import type { SchemaShape } from \"@repo/types\";\nimport { createEnv as coreCreateEnv } from \"arkenv\";\n\n/**\n * Validate and wrap environment variables in a security proxy.\n *\n * @internal\n *\n * @remarks\n * This internal module contains the core Next.js environment validation logic. It is split from\n * the public entry points to separate execution paths (RSC vs. SSR/Client) at the bundler layer.\n *\n * **Trade-offs & Design Decisions:**\n * 1. **Bundler Resolution (isServer)**: The `isServer` flag is statically hardcoded by the respective\n * entry points (`src/index.ts` and `src/react-server.ts`) resolved via package conditional exports\n * (`react-server` vs `default`). This resolves client component SSR environment poisoning without\n * relying on fragile runtime heuristics.\n * 2. **Type Circuit Breaker (unknown return)**: This function returns `unknown` rather than the complex,\n * recursive ArkType validation types. This prevents TypeScript's compiler from recursively evaluating\n * type mapping depths inside the internal implementation, bypassing `TS2589` instantiation limits.\n *\n * @param options The environment validation configuration options\n * @param isServer Whether the code is running in a server component (RSC) context\n * @returns A validated, readonly environment variables object wrapped in a security proxy\n * @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`\n * @throws An error if any client or shared variable is missing from `runtimeEnv`\n */\nexport function createEnvInternal(\n\toptions: {\n\t\tserver?: SchemaShape;\n\t\tclient?: Record<string, unknown>;\n\t\tshared?: SchemaShape;\n\t\truntimeEnv: Record<string, unknown>;\n\t},\n\tisServer: boolean,\n): unknown {\n\tconst server = options.server || {};\n\tconst client = options.client || {};\n\tconst shared = options.shared || {};\n\tconst runtimeEnv = options.runtimeEnv;\n\n\t// Validate options\n\t// For client keys, check prefix\n\tfor (const key of Object.keys(client)) {\n\t\tif (!key.startsWith(\"NEXT_PUBLIC_\")) {\n\t\t\tthrow new Error(\n\t\t\t\t`Client-side environment variables must be prefixed with 'NEXT_PUBLIC_'. Found invalid key: ${key}`,\n\t\t\t);\n\t\t}\n\t}\n\n\t// Check runtimeEnv has all client and shared keys\n\tconst requiredKeys = [...Object.keys(client), ...Object.keys(shared)];\n\tfor (const key of requiredKeys) {\n\t\tif (!(key in runtimeEnv)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Missing key in runtimeEnv: ${key}. All client and shared environment variables must be explicitly destructured in runtimeEnv.`,\n\t\t\t);\n\t\t}\n\t}\n\n\t// Prepare combined environment for core validation\n\tconst combinedEnv: Record<string, string | undefined> = {};\n\n\tfor (const key of Object.keys(runtimeEnv)) {\n\t\tif (runtimeEnv[key] !== undefined) {\n\t\t\tcombinedEnv[key] = runtimeEnv[key] as string;\n\t\t}\n\t}\n\n\tif (isServer) {\n\t\t// Fallback server keys to process.env if omitted or undefined\n\t\tfor (const key of Object.keys(server)) {\n\t\t\tif (combinedEnv[key] === undefined && process.env[key] !== undefined) {\n\t\t\t\tcombinedEnv[key] = process.env[key];\n\t\t\t}\n\t\t}\n\t}\n\n\t// Select schema based on environment\n\tconst schema = isServer\n\t\t? { ...server, ...client, ...shared }\n\t\t: { ...client, ...shared };\n\n\t// Run core validation\n\t// Note: We cast schema to `any` here to avoid a compilation TS2589 error\n\t// (Type instantiation is excessively deep and possibly infinite).\n\t// Evaluating the full generic intersection schema under `EnvSchema<T>`\n\t// exceeds TypeScript's instantiation limits for generic components.\n\tconst validated = coreCreateEnv(schema as any, { env: combinedEnv });\n\n\t// Return a Proxy wrapper\n\treturn new Proxy(validated, {\n\t\tget(target, prop, receiver) {\n\t\t\tif (typeof prop === \"string\") {\n\t\t\t\tconst isServerOnlyKey =\n\t\t\t\t\tprop in server && !(prop in client) && !(prop in shared);\n\t\t\t\tif (isServerOnlyKey && !isServer) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Accessing server-side environment variable '${prop}' on the client is not allowed.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn Reflect.get(target, prop, receiver);\n\t\t},\n\t});\n}\n"],"mappings":"mCA2BA,SAAgB,EACf,EAMA,EACU,CACV,IAAM,EAAS,EAAQ,QAAU,EAAE,CAC7B,EAAS,EAAQ,QAAU,EAAE,CAC7B,EAAS,EAAQ,QAAU,EAAE,CAC7B,EAAa,EAAQ,WAI3B,IAAK,IAAM,KAAO,OAAO,KAAK,EAAO,CACpC,GAAI,CAAC,EAAI,WAAW,eAAe,CAClC,MAAU,MACT,8FAA8F,IAC9F,CAKH,IAAM,EAAe,CAAC,GAAG,OAAO,KAAK,EAAO,CAAE,GAAG,OAAO,KAAK,EAAO,CAAC,CACrE,IAAK,IAAM,KAAO,EACjB,GAAI,EAAE,KAAO,GACZ,MAAU,MACT,8BAA8B,EAAI,8FAClC,CAKH,IAAM,EAAkD,EAAE,CAE1D,IAAK,IAAM,KAAO,OAAO,KAAK,EAAW,CACpC,EAAW,KAAS,IAAA,KACvB,EAAY,GAAO,EAAW,IAIhC,GAAI,MAEE,IAAM,KAAO,OAAO,KAAK,EAAO,CAChC,EAAY,KAAS,IAAA,IAAa,QAAQ,IAAI,KAAS,IAAA,KAC1D,EAAY,GAAO,QAAQ,IAAI,IAelC,IAAM,EAAYA,EATH,EACZ,CAAE,GAAG,EAAQ,GAAG,EAAQ,GAAG,EAAQ,CACnC,CAAE,GAAG,EAAQ,GAAG,EAAQ,CAOoB,CAAE,IAAK,EAAa,CAAC,CAGpE,OAAO,IAAI,MAAM,EAAW,CAC3B,IAAI,EAAQ,EAAM,EAAU,CAC3B,GAAI,OAAO,GAAS,UAElB,KAAQ,GAAU,EAAE,KAAQ,IAAW,EAAE,KAAQ,IAC3B,CAAC,EACvB,MAAU,MACT,+CAA+C,EAAK,iCACpD,CAGH,OAAO,QAAQ,IAAI,EAAQ,EAAM,EAAS,EAE3C,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as _$arktype from "arktype";
|
|
2
|
+
import { type } from "arktype";
|
|
3
|
+
import * as _$arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
|
|
4
|
+
import * as _$arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
|
|
5
|
+
|
|
6
|
+
//#region ../internal/scope/dist/index.d.ts
|
|
7
|
+
//#region src/root.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* The root scope for the ArkEnv library,
|
|
10
|
+
* containing extensions to the ArkType scopes with ArkEnv-specific types
|
|
11
|
+
* like `string.host` and `number.port`.
|
|
12
|
+
*/
|
|
13
|
+
declare const $: _$arktype.Scope<{
|
|
14
|
+
string: _$arktype.Submodule<{
|
|
15
|
+
trim: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.trim.$ & {
|
|
16
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
17
|
+
}>;
|
|
18
|
+
normalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
19
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
20
|
+
}>;
|
|
21
|
+
root: string;
|
|
22
|
+
alpha: string;
|
|
23
|
+
alphanumeric: string;
|
|
24
|
+
hex: string;
|
|
25
|
+
base64: _$arktype.Submodule<{
|
|
26
|
+
root: string;
|
|
27
|
+
url: string;
|
|
28
|
+
} & {
|
|
29
|
+
" arkInferred": string;
|
|
30
|
+
}>;
|
|
31
|
+
capitalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
32
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
33
|
+
}>;
|
|
34
|
+
creditCard: string;
|
|
35
|
+
date: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
36
|
+
" arkInferred": string;
|
|
37
|
+
}>;
|
|
38
|
+
digits: string;
|
|
39
|
+
email: string;
|
|
40
|
+
integer: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
41
|
+
" arkInferred": string;
|
|
42
|
+
}>;
|
|
43
|
+
ip: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.ip.$ & {
|
|
44
|
+
" arkInferred": string;
|
|
45
|
+
}>;
|
|
46
|
+
json: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
47
|
+
" arkInferred": string;
|
|
48
|
+
}>;
|
|
49
|
+
lower: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.lower.$ & {
|
|
50
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
51
|
+
}>;
|
|
52
|
+
numeric: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
53
|
+
" arkInferred": string;
|
|
54
|
+
}>;
|
|
55
|
+
regex: string;
|
|
56
|
+
semver: string;
|
|
57
|
+
upper: _$arktype.Submodule<{
|
|
58
|
+
root: (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
59
|
+
preformatted: string;
|
|
60
|
+
} & {
|
|
61
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
62
|
+
}>;
|
|
63
|
+
url: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.url.$ & {
|
|
64
|
+
" arkInferred": string;
|
|
65
|
+
}>;
|
|
66
|
+
uuid: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
67
|
+
" arkInferred": string;
|
|
68
|
+
}>;
|
|
69
|
+
" arkInferred": string;
|
|
70
|
+
host: string;
|
|
71
|
+
}>;
|
|
72
|
+
number: _$arktype.Submodule<{
|
|
73
|
+
NaN: number;
|
|
74
|
+
Infinity: number;
|
|
75
|
+
root: number;
|
|
76
|
+
integer: number;
|
|
77
|
+
" arkInferred": number;
|
|
78
|
+
epoch: number;
|
|
79
|
+
safe: number;
|
|
80
|
+
NegativeInfinity: number;
|
|
81
|
+
port: number;
|
|
82
|
+
}>;
|
|
83
|
+
}>;
|
|
84
|
+
type $ = (typeof $)["t"]; //#endregion
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region ../internal/types/dist/schema.d.ts
|
|
87
|
+
type SchemaShape = Record<string, unknown>;
|
|
88
|
+
//#endregion
|
|
89
|
+
export { $ as n, SchemaShape as t };
|
|
90
|
+
//# sourceMappingURL=index-Bu2HxG6d.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Bu2HxG6d.d.cts","names":["_$arktype","_$arktype_internal_keywords_string_ts0","_$arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","string","In","root","alpha","alphanumeric","hex","base64","creditCard","date","digits","email","integer","json","numeric","regex","semver","upper","preformatted","host","number","NaN","Infinity","epoch","safe","NegativeInfinity","port","$","Type","SchemaShape","Record","CompiledEnvSchema"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/schema.d.ts"],"mappings":";;;;;;;;AAEoF;;;;cAQtEG,CAAAA,EAAGH,SAAAA,CAAUiB,KAAAA;EACzBC,MAAAA,EAAQlB,SAAAA,CAAUM,SAAAA;IAChBF,IAAAA,EAAMJ,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCG,IAAAA,CAAKD,CAAAA;MACpE,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEE,SAAAA,EAAWP,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCM,SAAAA,CAAUJ,CAAAA;MAC9E,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEe,IAAAA;IACAC,KAAAA;IACAC,YAAAA;IACAC,GAAAA;IACAC,MAAAA,EAAQxB,SAAAA,CAAUM,SAAAA;MAChBc,IAAAA;MACAL,GAAAA;IAAAA;MAEA,cAAA;IAAA;IAEFP,UAAAA,EAAYR,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCO,UAAAA,CAAWL,CAAAA;MAChF,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEoB,UAAAA;IACAC,IAAAA,EAAM1B,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCQ,UAAAA,CAAWN,CAAAA;MAC1E,cAAA;IAAA;IAEFwB,MAAAA;IACAC,KAAAA;IACAC,OAAAA,EAAS7B,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCS,aAAAA,CAAcP,CAAAA;MAChF,cAAA;IAAA;IAEFQ,EAAAA,EAAIX,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCU,EAAAA,CAAGR,CAAAA;MAChE,cAAA;IAAA;IAEF2B,IAAAA,EAAM9B,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCW,UAAAA,CAAWT,CAAAA;MAC1E,cAAA;IAAA;IAEFU,KAAAA,EAAOb,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCY,KAAAA,CAAMV,CAAAA;MACtE,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpE0B,OAAAA,EAAS/B,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCa,aAAAA,CAAcX,CAAAA;MAChF,cAAA;IAAA;IAEF6B,KAAAA;IACAC,MAAAA;IACAC,KAAAA,EAAOlC,SAAAA,CAAUM,SAAAA;MACfc,IAAAA,GAAOD,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;MACxD8B,YAAAA;IAAAA;MAEA,cAAA,GAAiBhB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEU,GAAAA,EAAKf,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCc,GAAAA,CAAIZ,CAAAA;MAClE,cAAA;IAAA;IAEFa,IAAAA,EAAMhB,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCe,IAAAA,CAAKb,CAAAA;MACpE,cAAA;IAAA;IAEF,cAAA;IACAiC,IAAAA;EAAAA;EAEFC,MAAAA,EAAQrC,SAAAA,CAAUM,SAAAA;IAChBgC,GAAAA;IACAC,QAAAA;IACAnB,IAAAA;IACAS,OAAAA;IACA,cAAA;IACAW,KAAAA;IACAC,IAAAA;IACAC,gBAAAA;IACAC,IAAAA;EAAAA;AAAAA;AAAAA,KAGCxC,CAAAA,WAAYA,CAAAA;;;KC/EL2C,WAAAA,GAAcC,MAAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as _$arktype from "arktype";
|
|
2
|
+
import { type } from "arktype";
|
|
3
|
+
import * as _$arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
|
|
4
|
+
import * as _$arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
|
|
5
|
+
|
|
6
|
+
//#region ../internal/scope/dist/index.d.ts
|
|
7
|
+
//#region src/root.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* The root scope for the ArkEnv library,
|
|
10
|
+
* containing extensions to the ArkType scopes with ArkEnv-specific types
|
|
11
|
+
* like `string.host` and `number.port`.
|
|
12
|
+
*/
|
|
13
|
+
declare const $: _$arktype.Scope<{
|
|
14
|
+
string: _$arktype.Submodule<{
|
|
15
|
+
trim: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.trim.$ & {
|
|
16
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
17
|
+
}>;
|
|
18
|
+
normalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.normalize.$ & {
|
|
19
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
20
|
+
}>;
|
|
21
|
+
root: string;
|
|
22
|
+
alpha: string;
|
|
23
|
+
alphanumeric: string;
|
|
24
|
+
hex: string;
|
|
25
|
+
base64: _$arktype.Submodule<{
|
|
26
|
+
root: string;
|
|
27
|
+
url: string;
|
|
28
|
+
} & {
|
|
29
|
+
" arkInferred": string;
|
|
30
|
+
}>;
|
|
31
|
+
capitalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.capitalize.$ & {
|
|
32
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
33
|
+
}>;
|
|
34
|
+
creditCard: string;
|
|
35
|
+
date: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringDate.$ & {
|
|
36
|
+
" arkInferred": string;
|
|
37
|
+
}>;
|
|
38
|
+
digits: string;
|
|
39
|
+
email: string;
|
|
40
|
+
integer: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringInteger.$ & {
|
|
41
|
+
" arkInferred": string;
|
|
42
|
+
}>;
|
|
43
|
+
ip: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.ip.$ & {
|
|
44
|
+
" arkInferred": string;
|
|
45
|
+
}>;
|
|
46
|
+
json: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringJson.$ & {
|
|
47
|
+
" arkInferred": string;
|
|
48
|
+
}>;
|
|
49
|
+
lower: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.lower.$ & {
|
|
50
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
51
|
+
}>;
|
|
52
|
+
numeric: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringNumeric.$ & {
|
|
53
|
+
" arkInferred": string;
|
|
54
|
+
}>;
|
|
55
|
+
regex: string;
|
|
56
|
+
semver: string;
|
|
57
|
+
upper: _$arktype.Submodule<{
|
|
58
|
+
root: (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
59
|
+
preformatted: string;
|
|
60
|
+
} & {
|
|
61
|
+
" arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
|
|
62
|
+
}>;
|
|
63
|
+
url: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.url.$ & {
|
|
64
|
+
" arkInferred": string;
|
|
65
|
+
}>;
|
|
66
|
+
uuid: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.uuid.$ & {
|
|
67
|
+
" arkInferred": string;
|
|
68
|
+
}>;
|
|
69
|
+
" arkInferred": string;
|
|
70
|
+
host: string;
|
|
71
|
+
}>;
|
|
72
|
+
number: _$arktype.Submodule<{
|
|
73
|
+
NaN: number;
|
|
74
|
+
Infinity: number;
|
|
75
|
+
root: number;
|
|
76
|
+
integer: number;
|
|
77
|
+
" arkInferred": number;
|
|
78
|
+
epoch: number;
|
|
79
|
+
safe: number;
|
|
80
|
+
NegativeInfinity: number;
|
|
81
|
+
port: number;
|
|
82
|
+
}>;
|
|
83
|
+
}>;
|
|
84
|
+
type $ = (typeof $)["t"]; //#endregion
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region ../internal/types/dist/schema.d.ts
|
|
87
|
+
type SchemaShape = Record<string, unknown>;
|
|
88
|
+
//#endregion
|
|
89
|
+
export { $ as n, SchemaShape as t };
|
|
90
|
+
//# sourceMappingURL=index-DLivsH0-.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DLivsH0-.d.ts","names":["_$arktype","_$arktype_internal_keywords_string_ts0","_$arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","string","In","root","alpha","alphanumeric","hex","base64","creditCard","date","digits","email","integer","json","numeric","regex","semver","upper","preformatted","host","number","NaN","Infinity","epoch","safe","NegativeInfinity","port","$","Type","SchemaShape","Record","CompiledEnvSchema"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/schema.d.ts"],"mappings":";;;;;;;;AAEoF;;;;cAQtEG,CAAAA,EAAGH,SAAAA,CAAUiB,KAAAA;EACzBC,MAAAA,EAAQlB,SAAAA,CAAUM,SAAAA;IAChBF,IAAAA,EAAMJ,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCG,IAAAA,CAAKD,CAAAA;MACpE,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEE,SAAAA,EAAWP,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCM,SAAAA,CAAUJ,CAAAA;MAC9E,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEe,IAAAA;IACAC,KAAAA;IACAC,YAAAA;IACAC,GAAAA;IACAC,MAAAA,EAAQxB,SAAAA,CAAUM,SAAAA;MAChBc,IAAAA;MACAL,GAAAA;IAAAA;MAEA,cAAA;IAAA;IAEFP,UAAAA,EAAYR,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCO,UAAAA,CAAWL,CAAAA;MAChF,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEoB,UAAAA;IACAC,IAAAA,EAAM1B,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCQ,UAAAA,CAAWN,CAAAA;MAC1E,cAAA;IAAA;IAEFwB,MAAAA;IACAC,KAAAA;IACAC,OAAAA,EAAS7B,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCS,aAAAA,CAAcP,CAAAA;MAChF,cAAA;IAAA;IAEFQ,EAAAA,EAAIX,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCU,EAAAA,CAAGR,CAAAA;MAChE,cAAA;IAAA;IAEF2B,IAAAA,EAAM9B,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCW,UAAAA,CAAWT,CAAAA;MAC1E,cAAA;IAAA;IAEFU,KAAAA,EAAOb,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCY,KAAAA,CAAMV,CAAAA;MACtE,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpE0B,OAAAA,EAAS/B,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCa,aAAAA,CAAcX,CAAAA;MAChF,cAAA;IAAA;IAEF6B,KAAAA;IACAC,MAAAA;IACAC,KAAAA,EAAOlC,SAAAA,CAAUM,SAAAA;MACfc,IAAAA,GAAOD,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;MACxD8B,YAAAA;IAAAA;MAEA,cAAA,GAAiBhB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEU,GAAAA,EAAKf,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCc,GAAAA,CAAIZ,CAAAA;MAClE,cAAA;IAAA;IAEFa,IAAAA,EAAMhB,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCe,IAAAA,CAAKb,CAAAA;MACpE,cAAA;IAAA;IAEF,cAAA;IACAiC,IAAAA;EAAAA;EAEFC,MAAAA,EAAQrC,SAAAA,CAAUM,SAAAA;IAChBgC,GAAAA;IACAC,QAAAA;IACAnB,IAAAA;IACAS,OAAAA;IACA,cAAA;IACAW,KAAAA;IACAC,IAAAA;IACAC,gBAAAA;IACAC,IAAAA;EAAAA;AAAAA;AAAAA,KAGCxC,CAAAA,WAAYA,CAAAA;;;KC/EL2C,WAAAA,GAAcC,MAAAA"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./create-env-NTGNQN-0.cjs`);let t=require(`arkenv`);function n(t){return e.t(t,!1)}const r=n;exports.createEnv=n,exports.default=r,Object.defineProperty(exports,`type`,{enumerable:!0,get:function(){return t.type}});
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["createEnvInternal","arkenv"],"sources":["../src/index.ts"],"sourcesContent":["import type { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { createEnvInternal } from \"./create-env\";\n\n/**\n * Create a validated, type-safe environment configuration for Next.js applications (Client-side / SSR entry point).\n *\n * @param options The environment validation configuration options\n * @returns A validated, readonly environment variables object wrapped in a security proxy\n * @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`\n * @throws An error if any client or shared variable is missing from `runtimeEnv`\n */\nexport function createEnv<\n\tconst TServer extends SchemaShape = {},\n\tconst TClient extends SchemaShape = {},\n\tconst TShared extends SchemaShape = {},\n>(options: {\n\tserver?: TServer;\n\tclient?: {\n\t\t[K in keyof TClient]: K extends `NEXT_PUBLIC_${string}`\n\t\t\t? TClient[K]\n\t\t\t: never;\n\t};\n\tshared?: TShared;\n\truntimeEnv: Record<keyof TClient | keyof TShared, unknown> &\n\t\tRecord<string, unknown>;\n}): Readonly<distill.Out<at.infer<TServer & TClient & TShared, $>>> {\n\ttype ReturnType = Readonly<\n\t\tdistill.Out<at.infer<TServer & TClient & TShared, $>>\n\t>;\n\treturn createEnvInternal(options, false) as ReturnType;\n}\n\nexport { type } from \"arkenv\";\n\n/**\n * ArkEnv's Next.js integration export, an alias for {@link createEnv}\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nconst arkenv = createEnv;\nexport default arkenv;\n"],"mappings":"oKAaA,SAAgB,EAId,EAUkE,CAInE,OAAOA,EAAAA,EAAkB,EAAS,GAAM,CAUzC,MAAMC,EAAS"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { n as $, t as SchemaShape } from "./index-Bu2HxG6d.cjs";
|
|
2
|
+
import { distill, type as type$1 } from "arktype";
|
|
3
|
+
import { type } from "arkenv";
|
|
4
|
+
|
|
5
|
+
//#region src/index.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create a validated, type-safe environment configuration for Next.js applications (Client-side / SSR entry point).
|
|
8
|
+
*
|
|
9
|
+
* @param options The environment validation configuration options
|
|
10
|
+
* @returns A validated, readonly environment variables object wrapped in a security proxy
|
|
11
|
+
* @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`
|
|
12
|
+
* @throws An error if any client or shared variable is missing from `runtimeEnv`
|
|
13
|
+
*/
|
|
14
|
+
declare function createEnv<const TServer extends SchemaShape = {}, const TClient extends SchemaShape = {}, const TShared extends SchemaShape = {}>(options: {
|
|
15
|
+
server?: TServer;
|
|
16
|
+
client?: { [K in keyof TClient]: K extends `NEXT_PUBLIC_${string}` ? TClient[K] : never };
|
|
17
|
+
shared?: TShared;
|
|
18
|
+
runtimeEnv: Record<keyof TClient | keyof TShared, unknown> & Record<string, unknown>;
|
|
19
|
+
}): Readonly<distill.Out<type$1.infer<TServer & TClient & TShared, $>>>;
|
|
20
|
+
/**
|
|
21
|
+
* ArkEnv's Next.js integration export, an alias for {@link createEnv}
|
|
22
|
+
*
|
|
23
|
+
* {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.
|
|
24
|
+
*/
|
|
25
|
+
declare const arkenv: typeof createEnv;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { createEnv, arkenv as default, type };
|
|
28
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;AAaA;;;;;;iBAAgB,SAAA,uBACO,WAAA,6BACA,WAAA,6BACA,WAAA,MAAA,CACrB,OAAA;EACD,MAAA,GAAS,OAAA;EACT,MAAA,iBACa,OAAA,GAAU,CAAA,mCACnB,OAAA,CAAQ,CAAA;EAGZ,MAAA,GAAS,OAAA;EACT,UAAA,EAAY,MAAA,OAAa,OAAA,SAAgB,OAAA,aACxC,MAAA;AAAA,IACE,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAG,KAAA,CAAM,OAAA,GAAU,OAAA,GAAU,OAAA,EAAS,CAAA;;;;;;cAczD,MAAA,SAAM,SAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { n as $, t as SchemaShape } from "./index-DLivsH0-.js";
|
|
2
|
+
import { type } from "arkenv";
|
|
3
|
+
import { distill, type as type$1 } from "arktype";
|
|
4
|
+
|
|
5
|
+
//#region src/index.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create a validated, type-safe environment configuration for Next.js applications (Client-side / SSR entry point).
|
|
8
|
+
*
|
|
9
|
+
* @param options The environment validation configuration options
|
|
10
|
+
* @returns A validated, readonly environment variables object wrapped in a security proxy
|
|
11
|
+
* @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`
|
|
12
|
+
* @throws An error if any client or shared variable is missing from `runtimeEnv`
|
|
13
|
+
*/
|
|
14
|
+
declare function createEnv<const TServer extends SchemaShape = {}, const TClient extends SchemaShape = {}, const TShared extends SchemaShape = {}>(options: {
|
|
15
|
+
server?: TServer;
|
|
16
|
+
client?: { [K in keyof TClient]: K extends `NEXT_PUBLIC_${string}` ? TClient[K] : never };
|
|
17
|
+
shared?: TShared;
|
|
18
|
+
runtimeEnv: Record<keyof TClient | keyof TShared, unknown> & Record<string, unknown>;
|
|
19
|
+
}): Readonly<distill.Out<type$1.infer<TServer & TClient & TShared, $>>>;
|
|
20
|
+
/**
|
|
21
|
+
* ArkEnv's Next.js integration export, an alias for {@link createEnv}
|
|
22
|
+
*
|
|
23
|
+
* {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.
|
|
24
|
+
*/
|
|
25
|
+
declare const arkenv: typeof createEnv;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { createEnv, arkenv as default, type };
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;AAaA;;;;;;iBAAgB,SAAA,uBACO,WAAA,6BACA,WAAA,6BACA,WAAA,MAAA,CACrB,OAAA;EACD,MAAA,GAAS,OAAA;EACT,MAAA,iBACa,OAAA,GAAU,CAAA,mCACnB,OAAA,CAAQ,CAAA;EAGZ,MAAA,GAAS,OAAA;EACT,UAAA,EAAY,MAAA,OAAa,OAAA,SAAgB,OAAA,aACxC,MAAA;AAAA,IACE,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAG,KAAA,CAAM,OAAA,GAAU,OAAA,GAAU,OAAA,EAAS,CAAA;;;;;;cAczD,MAAA,SAAM,SAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { createEnvInternal } from \"./create-env\";\n\n/**\n * Create a validated, type-safe environment configuration for Next.js applications (Client-side / SSR entry point).\n *\n * @param options The environment validation configuration options\n * @returns A validated, readonly environment variables object wrapped in a security proxy\n * @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`\n * @throws An error if any client or shared variable is missing from `runtimeEnv`\n */\nexport function createEnv<\n\tconst TServer extends SchemaShape = {},\n\tconst TClient extends SchemaShape = {},\n\tconst TShared extends SchemaShape = {},\n>(options: {\n\tserver?: TServer;\n\tclient?: {\n\t\t[K in keyof TClient]: K extends `NEXT_PUBLIC_${string}`\n\t\t\t? TClient[K]\n\t\t\t: never;\n\t};\n\tshared?: TShared;\n\truntimeEnv: Record<keyof TClient | keyof TShared, unknown> &\n\t\tRecord<string, unknown>;\n}): Readonly<distill.Out<at.infer<TServer & TClient & TShared, $>>> {\n\ttype ReturnType = Readonly<\n\t\tdistill.Out<at.infer<TServer & TClient & TShared, $>>\n\t>;\n\treturn createEnvInternal(options, false) as ReturnType;\n}\n\nexport { type } from \"arkenv\";\n\n/**\n * ArkEnv's Next.js integration export, an alias for {@link createEnv}\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nconst arkenv = createEnv;\nexport default arkenv;\n"],"mappings":"2EAaA,SAAgB,EAId,EAUkE,CAInE,OAAO,EAAkB,EAAS,GAAM,CAUzC,MAAM,EAAS"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./create-env-NTGNQN-0.cjs`);let t=require(`arkenv`);function n(t){return e.t(t,!0)}const r=n;exports.createEnv=n,exports.default=r,Object.defineProperty(exports,`type`,{enumerable:!0,get:function(){return t.type}});
|
|
2
|
+
//# sourceMappingURL=react-server.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-server.cjs","names":["createEnvInternal","arkenv"],"sources":["../src/react-server.ts"],"sourcesContent":["import type { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { createEnvInternal } from \"./create-env\";\n\n/**\n * Create a validated, type-safe environment configuration for Next.js applications (Server-side RSC entry point).\n *\n * @param options The environment validation configuration options\n * @returns A validated, readonly environment variables object wrapped in a security proxy\n * @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`\n * @throws An error if any client or shared variable is missing from `runtimeEnv`\n */\nexport function createEnv<\n\tconst TServer extends SchemaShape = {},\n\tconst TClient extends SchemaShape = {},\n\tconst TShared extends SchemaShape = {},\n>(options: {\n\tserver?: TServer;\n\tclient?: {\n\t\t[K in keyof TClient]: K extends `NEXT_PUBLIC_${string}`\n\t\t\t? TClient[K]\n\t\t\t: never;\n\t};\n\tshared?: TShared;\n\truntimeEnv: Record<keyof TClient | keyof TShared, unknown> &\n\t\tRecord<string, unknown>;\n}): Readonly<distill.Out<at.infer<TServer & TClient & TShared, $>>> {\n\ttype ReturnType = Readonly<\n\t\tdistill.Out<at.infer<TServer & TClient & TShared, $>>\n\t>;\n\treturn createEnvInternal(options, true) as ReturnType;\n}\n\nexport { type } from \"arkenv\";\n\n/**\n * ArkEnv's Next.js integration export, an alias for {@link createEnv}\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nconst arkenv = createEnv;\nexport default arkenv;\n"],"mappings":"oKAaA,SAAgB,EAId,EAUkE,CAInE,OAAOA,EAAAA,EAAkB,EAAS,GAAK,CAUxC,MAAMC,EAAS"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { n as $, t as SchemaShape } from "./index-Bu2HxG6d.cjs";
|
|
2
|
+
import { distill, type as type$1 } from "arktype";
|
|
3
|
+
import { type } from "arkenv";
|
|
4
|
+
|
|
5
|
+
//#region src/react-server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create a validated, type-safe environment configuration for Next.js applications (Server-side RSC entry point).
|
|
8
|
+
*
|
|
9
|
+
* @param options The environment validation configuration options
|
|
10
|
+
* @returns A validated, readonly environment variables object wrapped in a security proxy
|
|
11
|
+
* @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`
|
|
12
|
+
* @throws An error if any client or shared variable is missing from `runtimeEnv`
|
|
13
|
+
*/
|
|
14
|
+
declare function createEnv<const TServer extends SchemaShape = {}, const TClient extends SchemaShape = {}, const TShared extends SchemaShape = {}>(options: {
|
|
15
|
+
server?: TServer;
|
|
16
|
+
client?: { [K in keyof TClient]: K extends `NEXT_PUBLIC_${string}` ? TClient[K] : never };
|
|
17
|
+
shared?: TShared;
|
|
18
|
+
runtimeEnv: Record<keyof TClient | keyof TShared, unknown> & Record<string, unknown>;
|
|
19
|
+
}): Readonly<distill.Out<type$1.infer<TServer & TClient & TShared, $>>>;
|
|
20
|
+
/**
|
|
21
|
+
* ArkEnv's Next.js integration export, an alias for {@link createEnv}
|
|
22
|
+
*
|
|
23
|
+
* {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.
|
|
24
|
+
*/
|
|
25
|
+
declare const arkenv: typeof createEnv;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { createEnv, arkenv as default, type };
|
|
28
|
+
//# sourceMappingURL=react-server.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-server.d.cts","names":[],"sources":["../src/react-server.ts"],"mappings":";;;;;;;AAaA;;;;;;iBAAgB,SAAA,uBACO,WAAA,6BACA,WAAA,6BACA,WAAA,MAAA,CACrB,OAAA;EACD,MAAA,GAAS,OAAA;EACT,MAAA,iBACa,OAAA,GAAU,CAAA,mCACnB,OAAA,CAAQ,CAAA;EAGZ,MAAA,GAAS,OAAA;EACT,UAAA,EAAY,MAAA,OAAa,OAAA,SAAgB,OAAA,aACxC,MAAA;AAAA,IACE,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAG,KAAA,CAAM,OAAA,GAAU,OAAA,GAAU,OAAA,EAAS,CAAA;;;;;;cAczD,MAAA,SAAM,SAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { n as $, t as SchemaShape } from "./index-DLivsH0-.js";
|
|
2
|
+
import { type } from "arkenv";
|
|
3
|
+
import { distill, type as type$1 } from "arktype";
|
|
4
|
+
|
|
5
|
+
//#region src/react-server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create a validated, type-safe environment configuration for Next.js applications (Server-side RSC entry point).
|
|
8
|
+
*
|
|
9
|
+
* @param options The environment validation configuration options
|
|
10
|
+
* @returns A validated, readonly environment variables object wrapped in a security proxy
|
|
11
|
+
* @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`
|
|
12
|
+
* @throws An error if any client or shared variable is missing from `runtimeEnv`
|
|
13
|
+
*/
|
|
14
|
+
declare function createEnv<const TServer extends SchemaShape = {}, const TClient extends SchemaShape = {}, const TShared extends SchemaShape = {}>(options: {
|
|
15
|
+
server?: TServer;
|
|
16
|
+
client?: { [K in keyof TClient]: K extends `NEXT_PUBLIC_${string}` ? TClient[K] : never };
|
|
17
|
+
shared?: TShared;
|
|
18
|
+
runtimeEnv: Record<keyof TClient | keyof TShared, unknown> & Record<string, unknown>;
|
|
19
|
+
}): Readonly<distill.Out<type$1.infer<TServer & TClient & TShared, $>>>;
|
|
20
|
+
/**
|
|
21
|
+
* ArkEnv's Next.js integration export, an alias for {@link createEnv}
|
|
22
|
+
*
|
|
23
|
+
* {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.
|
|
24
|
+
*/
|
|
25
|
+
declare const arkenv: typeof createEnv;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { createEnv, arkenv as default, type };
|
|
28
|
+
//# sourceMappingURL=react-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-server.d.ts","names":[],"sources":["../src/react-server.ts"],"mappings":";;;;;;;AAaA;;;;;;iBAAgB,SAAA,uBACO,WAAA,6BACA,WAAA,6BACA,WAAA,MAAA,CACrB,OAAA;EACD,MAAA,GAAS,OAAA;EACT,MAAA,iBACa,OAAA,GAAU,CAAA,mCACnB,OAAA,CAAQ,CAAA;EAGZ,MAAA,GAAS,OAAA;EACT,UAAA,EAAY,MAAA,OAAa,OAAA,SAAgB,OAAA,aACxC,MAAA;AAAA,IACE,QAAA,CAAS,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAG,KAAA,CAAM,OAAA,GAAU,OAAA,GAAU,OAAA,EAAS,CAAA;;;;;;cAczD,MAAA,SAAM,SAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-server.js","names":[],"sources":["../src/react-server.ts"],"sourcesContent":["import type { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { createEnvInternal } from \"./create-env\";\n\n/**\n * Create a validated, type-safe environment configuration for Next.js applications (Server-side RSC entry point).\n *\n * @param options The environment validation configuration options\n * @returns A validated, readonly environment variables object wrapped in a security proxy\n * @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`\n * @throws An error if any client or shared variable is missing from `runtimeEnv`\n */\nexport function createEnv<\n\tconst TServer extends SchemaShape = {},\n\tconst TClient extends SchemaShape = {},\n\tconst TShared extends SchemaShape = {},\n>(options: {\n\tserver?: TServer;\n\tclient?: {\n\t\t[K in keyof TClient]: K extends `NEXT_PUBLIC_${string}`\n\t\t\t? TClient[K]\n\t\t\t: never;\n\t};\n\tshared?: TShared;\n\truntimeEnv: Record<keyof TClient | keyof TShared, unknown> &\n\t\tRecord<string, unknown>;\n}): Readonly<distill.Out<at.infer<TServer & TClient & TShared, $>>> {\n\ttype ReturnType = Readonly<\n\t\tdistill.Out<at.infer<TServer & TClient & TShared, $>>\n\t>;\n\treturn createEnvInternal(options, true) as ReturnType;\n}\n\nexport { type } from \"arkenv\";\n\n/**\n * ArkEnv's Next.js integration export, an alias for {@link createEnv}\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nconst arkenv = createEnv;\nexport default arkenv;\n"],"mappings":"2EAaA,SAAgB,EAId,EAUkE,CAInE,OAAO,EAAkB,EAAS,GAAK,CAUxC,MAAM,EAAS"}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arkenv/nextjs",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"author": "Yam Borodetsky <yam@yam.codes>",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/yamcodes/arkenv.git"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.cjs",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"arkenv": "0.11.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@size-limit/preset-small-lib": "12.1.0",
|
|
16
|
+
"arktype": "2.2.0",
|
|
17
|
+
"next": "16.2.6",
|
|
18
|
+
"rimraf": "6.1.3",
|
|
19
|
+
"size-limit": "12.1.0",
|
|
20
|
+
"tsdown": "0.21.10",
|
|
21
|
+
"typescript": "6.0.3",
|
|
22
|
+
"vitest": "4.1.5",
|
|
23
|
+
"@repo/types": "0.1.0",
|
|
24
|
+
"@repo/scope": "0.1.3"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"arktype": "^2.1.22",
|
|
28
|
+
"next": "^13.4.0 || ^14.0.0 || ^15.0.0 || ^16.0.0-0"
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"react-server": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/react-server.js",
|
|
35
|
+
"require": "./dist/react-server.cjs"
|
|
36
|
+
},
|
|
37
|
+
"default": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"require": "./dist/index.cjs"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"bugs": "https://github.com/yamcodes/arkenv/labels/%40arkenv%2Fnextjs",
|
|
45
|
+
"description": "ArkEnv integration for Next.js",
|
|
46
|
+
"files": [
|
|
47
|
+
"dist"
|
|
48
|
+
],
|
|
49
|
+
"homepage": "https://arkenv.js.org",
|
|
50
|
+
"keywords": [
|
|
51
|
+
"arktype",
|
|
52
|
+
"arkenv",
|
|
53
|
+
"environment",
|
|
54
|
+
"variables",
|
|
55
|
+
"next",
|
|
56
|
+
"nextjs"
|
|
57
|
+
],
|
|
58
|
+
"license": "MIT",
|
|
59
|
+
"type": "module",
|
|
60
|
+
"types": "./dist/index.d.ts",
|
|
61
|
+
"size-limit": [
|
|
62
|
+
{
|
|
63
|
+
"path": "dist/index.js",
|
|
64
|
+
"limit": "3 kB",
|
|
65
|
+
"import": "*",
|
|
66
|
+
"ignore": [
|
|
67
|
+
"next",
|
|
68
|
+
"arktype"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsdown",
|
|
74
|
+
"typecheck": "tsc --noEmit",
|
|
75
|
+
"clean": "rimraf dist node_modules",
|
|
76
|
+
"test": "vitest",
|
|
77
|
+
"fix": "pnpm -w run fix",
|
|
78
|
+
"changeset": "pnpm -w run changeset",
|
|
79
|
+
"size": "size-limit --json > .size-limit.json"
|
|
80
|
+
}
|
|
81
|
+
}
|