@arkenv/nextjs 1.0.0-alpha.1 → 1.0.0-alpha.11

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.
Files changed (155) hide show
  1. package/LICENSE +3 -0
  2. package/README.md +3 -1
  3. package/dist/arkenv-internal-QxkUlA5J.cjs +2 -0
  4. package/dist/arkenv-internal-QxkUlA5J.cjs.map +1 -0
  5. package/dist/arkenv-internal-Ws3srax6.js +2 -0
  6. package/dist/arkenv-internal-Ws3srax6.js.map +1 -0
  7. package/dist/auto-extend-CYzZnEvT.cjs +2 -0
  8. package/dist/auto-extend-CYzZnEvT.cjs.map +1 -0
  9. package/dist/auto-extend-DjiqIbgM.js +2 -0
  10. package/dist/auto-extend-DjiqIbgM.js.map +1 -0
  11. package/dist/client.cjs +1 -1
  12. package/dist/client.cjs.map +1 -1
  13. package/dist/client.d.cts +12 -9
  14. package/dist/client.d.cts.map +1 -1
  15. package/dist/client.d.ts +12 -9
  16. package/dist/client.d.ts.map +1 -1
  17. package/dist/client.js +1 -1
  18. package/dist/client.js.map +1 -1
  19. package/dist/config/index.cjs +1 -0
  20. package/dist/config/index.d.cts +2 -0
  21. package/dist/config/index.d.ts +2 -0
  22. package/dist/config/index.js +1 -0
  23. package/dist/config-Bnir9dSk.js +97 -0
  24. package/dist/config-Bnir9dSk.js.map +1 -0
  25. package/dist/config-CU-9fwxw.cjs +97 -0
  26. package/dist/config-CU-9fwxw.cjs.map +1 -0
  27. package/dist/dist-Bof1Std7.cjs +2 -0
  28. package/dist/dist-Bof1Std7.cjs.map +1 -0
  29. package/dist/dist-DimRGXOV.js +2 -0
  30. package/dist/dist-DimRGXOV.js.map +1 -0
  31. package/dist/empty-client-env.cjs +2 -0
  32. package/dist/empty-client-env.cjs.map +1 -0
  33. package/dist/empty-client-env.d.cts +10 -0
  34. package/dist/empty-client-env.d.cts.map +1 -0
  35. package/dist/empty-client-env.d.ts +10 -0
  36. package/dist/empty-client-env.d.ts.map +1 -0
  37. package/dist/empty-client-env.js +2 -0
  38. package/dist/empty-client-env.js.map +1 -0
  39. package/dist/{index-C6bpQ5GU.d.cts → index-BS1wAitS.d.cts} +96 -33
  40. package/dist/index-BS1wAitS.d.cts.map +1 -0
  41. package/dist/index-CL9MPCBA.d.cts +169 -0
  42. package/dist/index-CL9MPCBA.d.cts.map +1 -0
  43. package/dist/{index-Bn3pRiJy.d.ts → index-Cq_qJ68V.d.ts} +96 -33
  44. package/dist/index-Cq_qJ68V.d.ts.map +1 -0
  45. package/dist/index-DLwzgCyF.d.ts +169 -0
  46. package/dist/index-DLwzgCyF.d.ts.map +1 -0
  47. package/dist/index.cjs +1 -1
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.cts +38 -10
  50. package/dist/index.d.cts.map +1 -1
  51. package/dist/index.d.ts +38 -10
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/index.js.map +1 -1
  55. package/dist/mock-server-only.cjs +2 -0
  56. package/dist/mock-server-only.cjs.map +1 -0
  57. package/dist/mock-server-only.d.cts +1 -0
  58. package/dist/mock-server-only.d.ts +1 -0
  59. package/dist/mock-server-only.js +2 -0
  60. package/dist/mock-server-only.js.map +1 -0
  61. package/dist/react-server.cjs +1 -1
  62. package/dist/react-server.cjs.map +1 -1
  63. package/dist/react-server.d.cts +31 -10
  64. package/dist/react-server.d.cts.map +1 -1
  65. package/dist/react-server.d.ts +31 -10
  66. package/dist/react-server.d.ts.map +1 -1
  67. package/dist/react-server.js +1 -1
  68. package/dist/react-server.js.map +1 -1
  69. package/dist/script-BBfmzIh4.cjs +2 -0
  70. package/dist/script-BBfmzIh4.cjs.map +1 -0
  71. package/dist/script-BHFJ0MU_.d.cts +21 -0
  72. package/dist/script-BHFJ0MU_.d.cts.map +1 -0
  73. package/dist/script-CZOPkAw3.js +2 -0
  74. package/dist/script-CZOPkAw3.js.map +1 -0
  75. package/dist/script-Cy9x6rp9.d.ts +21 -0
  76. package/dist/script-Cy9x6rp9.d.ts.map +1 -0
  77. package/dist/server.cjs +1 -1
  78. package/dist/server.cjs.map +1 -1
  79. package/dist/server.d.cts +34 -12
  80. package/dist/server.d.cts.map +1 -1
  81. package/dist/server.d.ts +34 -12
  82. package/dist/server.d.ts.map +1 -1
  83. package/dist/server.js +1 -1
  84. package/dist/server.js.map +1 -1
  85. package/dist/standard/client.cjs +2 -0
  86. package/dist/standard/client.cjs.map +1 -0
  87. package/dist/standard/client.d.cts +30 -0
  88. package/dist/standard/client.d.cts.map +1 -0
  89. package/dist/standard/client.d.ts +30 -0
  90. package/dist/standard/client.d.ts.map +1 -0
  91. package/dist/standard/client.js +2 -0
  92. package/dist/standard/client.js.map +1 -0
  93. package/dist/standard/config.cjs +2 -0
  94. package/dist/standard/config.cjs.map +1 -0
  95. package/dist/standard/config.d.cts +14 -0
  96. package/dist/standard/config.d.cts.map +1 -0
  97. package/dist/standard/config.d.ts +14 -0
  98. package/dist/standard/config.d.ts.map +1 -0
  99. package/dist/standard/config.js +2 -0
  100. package/dist/standard/config.js.map +1 -0
  101. package/dist/standard/index.cjs +2 -0
  102. package/dist/standard/index.cjs.map +1 -0
  103. package/dist/standard/index.d.cts +35 -0
  104. package/dist/standard/index.d.cts.map +1 -0
  105. package/dist/standard/index.d.ts +35 -0
  106. package/dist/standard/index.d.ts.map +1 -0
  107. package/dist/standard/index.js +2 -0
  108. package/dist/standard/index.js.map +1 -0
  109. package/dist/standard/server.cjs +2 -0
  110. package/dist/standard/server.cjs.map +1 -0
  111. package/dist/standard/server.d.cts +38 -0
  112. package/dist/standard/server.d.cts.map +1 -0
  113. package/dist/standard/server.d.ts +39 -0
  114. package/dist/standard/server.d.ts.map +1 -0
  115. package/dist/standard/server.js +2 -0
  116. package/dist/standard/server.js.map +1 -0
  117. package/dist/standard/shared.cjs +2 -0
  118. package/dist/standard/shared.cjs.map +1 -0
  119. package/dist/standard/shared.d.cts +13 -0
  120. package/dist/standard/shared.d.cts.map +1 -0
  121. package/dist/standard/shared.d.ts +13 -0
  122. package/dist/standard/shared.d.ts.map +1 -0
  123. package/dist/standard/shared.js +2 -0
  124. package/dist/standard/shared.js.map +1 -0
  125. package/dist/strict-client-env-CHDTZoLe.js +6 -0
  126. package/dist/strict-client-env-CHDTZoLe.js.map +1 -0
  127. package/dist/strict-client-env-MouPnkRr.cjs +6 -0
  128. package/dist/strict-client-env-MouPnkRr.cjs.map +1 -0
  129. package/dist/{types-BN4fEChy.d.ts → types-BfMBbrMm.d.ts} +2 -2
  130. package/dist/{types-BN4fEChy.d.ts.map → types-BfMBbrMm.d.ts.map} +1 -1
  131. package/dist/{types-DBqiLw5v.d.cts → types-BlRHnQwj.d.cts} +2 -2
  132. package/dist/{types-DBqiLw5v.d.cts.map → types-BlRHnQwj.d.cts.map} +1 -1
  133. package/package.json +74 -30
  134. package/dist/arkenv-internal-DA4LpI3t.cjs +0 -2
  135. package/dist/arkenv-internal-DA4LpI3t.cjs.map +0 -1
  136. package/dist/arkenv-internal-cagrxXTM.js +0 -2
  137. package/dist/arkenv-internal-cagrxXTM.js.map +0 -1
  138. package/dist/config.cjs +0 -76
  139. package/dist/config.cjs.map +0 -1
  140. package/dist/config.d.cts +0 -107
  141. package/dist/config.d.cts.map +0 -1
  142. package/dist/config.d.ts +0 -107
  143. package/dist/config.d.ts.map +0 -1
  144. package/dist/config.js +0 -76
  145. package/dist/config.js.map +0 -1
  146. package/dist/index-Bn3pRiJy.d.ts.map +0 -1
  147. package/dist/index-C6bpQ5GU.d.cts.map +0 -1
  148. package/dist/shared.cjs +0 -2
  149. package/dist/shared.cjs.map +0 -1
  150. package/dist/shared.d.cts +0 -16
  151. package/dist/shared.d.cts.map +0 -1
  152. package/dist/shared.d.ts +0 -16
  153. package/dist/shared.d.ts.map +0 -1
  154. package/dist/shared.js +0 -2
  155. package/dist/shared.js.map +0 -1
@@ -0,0 +1,169 @@
1
+ import { extractClientKeys, extractSharedKeys } from "@arkenv/build";
2
+
3
+ //#region ../internal/log/dist/index.d.ts
4
+ //#endregion
5
+ //#region src/types.d.ts
6
+ /**
7
+ * Supported log level thresholds, from most to least verbose.
8
+ */
9
+ type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
10
+ /**
11
+ * Shared logger interface for ArkEnv packages.
12
+ */
13
+ type Logger = {
14
+ debug: (message: string, ...optionalParams: unknown[]) => void;
15
+ info: (message: string, ...optionalParams: unknown[]) => void;
16
+ warn: (message: string, ...optionalParams: unknown[]) => void;
17
+ error: (message: string, ...optionalParams: unknown[]) => void;
18
+ };
19
+ /**
20
+ * Programmatic logger configuration. Takes precedence over `ARKENV_LOG_LEVEL`.
21
+ */
22
+ //#endregion
23
+ //#region src/config/types.d.ts
24
+ /**
25
+ * Configuration options for the ArkEnv Next.js integration.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const configOptions: ArkEnvConfigOptions = {
30
+ * schemaPath: "./src/env.ts",
31
+ * outputPath: "./src/generated/env.gen.ts"
32
+ * };
33
+ * ```
34
+ */
35
+ type ArkEnvConfigOptions = {
36
+ /**
37
+ * Specify the path to the schema definition file.
38
+ *
39
+ * Defaults to searching for `"src/env.ts"` or `"env.ts"` in the project root.
40
+ *
41
+ * @default "src/env.ts"
42
+ * @example
43
+ * ```ts
44
+ * export default withArkEnv(nextConfig, {
45
+ * schemaPath: "./src/env.ts"
46
+ * });
47
+ * ```
48
+ */
49
+ schemaPath?: string;
50
+ /**
51
+ * Specify the path where the generated file (`env.gen.ts`) should be written.
52
+ *
53
+ * Defaults to `"generated/env.gen.ts"` in the same directory as the schema file.
54
+ *
55
+ * @default "[schemaDirectory]/generated/env.gen.ts"
56
+ * @example
57
+ * ```ts
58
+ * export default withArkEnv(nextConfig, {
59
+ * outputPath: "./src/generated/env.gen.ts"
60
+ * });
61
+ * ```
62
+ */
63
+ outputPath?: string;
64
+ /**
65
+ * Specify the configuration layout.
66
+ *
67
+ * - `"flat"` (default): A single `env.ts` schema file.
68
+ * - `"strict"`: A split schema layout (`env/client.ts`, `env/server.ts`, and optionally `env/internal/shared.ts`).
69
+ *
70
+ * @default "flat"
71
+ */
72
+ layout?: "flat" | "strict"
73
+ /**
74
+ * @deprecated Use `"flat"` instead. `"simple"` will be removed in the next major version.
75
+ */
76
+ | "simple";
77
+ /**
78
+ * Force standard mode code generation.
79
+ *
80
+ * When `true`, the generated `env.gen.ts` imports from `@arkenv/nextjs/standard/*`
81
+ * instead of `@arkenv/nextjs/*`, ensuring the Standard Schema engine (`@arkenv/standard`)
82
+ * is used and `arktype` is never bundled. This is set automatically when importing from
83
+ * `@arkenv/nextjs/standard/config`, but can be toggled manually for custom setups.
84
+ *
85
+ * @default false
86
+ */
87
+ standard?: boolean;
88
+ /**
89
+ * Enable or disable build-time environment variable validation during build/dev startup.
90
+ *
91
+ * @default true
92
+ */
93
+ validate?: boolean;
94
+ /**
95
+ * Enable or disable automatic code generation of the `env.gen.ts` file.
96
+ *
97
+ * @default true
98
+ */
99
+ codegen?: boolean;
100
+ /**
101
+ * Custom logger instance for build-time messages.
102
+ *
103
+ * When omitted, ArkEnv uses a console logger respecting `ARKENV_LOG_LEVEL`.
104
+ */
105
+ logger?: Logger;
106
+ /**
107
+ * Minimum log level for build-time messages.
108
+ *
109
+ * Programmatic `logger` takes precedence over `logLevel`.
110
+ */
111
+ logLevel?: LogLevel;
112
+ };
113
+ //#endregion
114
+ //#region src/config/codegen.d.ts
115
+ /**
116
+ * Run code generation to read the schema file and generate the env.gen.ts factory.
117
+ *
118
+ * @param schemaPath The absolute path to the schema file or directory
119
+ * @param outputPath The absolute path to the generated output file
120
+ * @param layoutOption The explicit layout to use; auto-detected from the filesystem when omitted
121
+ * @param forceStandard Force standard mode code generation
122
+ * @throws An error if strict layout files are missing when `layoutOption` is `"strict"`
123
+ */
124
+ declare function runCodegen(schemaPath: string, outputPath: string, layoutOption?: ArkEnvConfigOptions["layout"], forceStandard?: boolean, logOptions?: Pick<ArkEnvConfigOptions, "logger" | "logLevel">): void;
125
+ //#endregion
126
+ //#region src/config/extract.d.ts
127
+ /**
128
+ * Statically extract client and shared keys from the schema content.
129
+ *
130
+ * @param content The schema file string content
131
+ * @returns An object containing the extracted client and shared keys
132
+ */
133
+ declare function extractKeys(content: string): {
134
+ clientKeys: string[];
135
+ sharedKeys: string[];
136
+ isLegacy?: boolean;
137
+ };
138
+ //#endregion
139
+ //#region src/config/setup.d.ts
140
+ type SetupResult = {
141
+ resolvedLayout: "flat" | "strict" | "simple";
142
+ baseDir: string | undefined;
143
+ clientEnvPath: string | undefined;
144
+ };
145
+ /**
146
+ * Run ArkEnv codegen and setup without wrapping nextConfig.
147
+ *
148
+ * @param options Optional configuration paths for schema and output files
149
+ * @param internalOptions Optional configuration for internal testing hooks
150
+ * @returns Resolved layout paths used by `withArkEnv` for alias registration
151
+ * @throws An error if the schema file cannot be found or if code generation fails
152
+ */
153
+ declare function setupArkEnv(options?: ArkEnvConfigOptions, internalOptions?: {
154
+ _jitiAliases?: Record<string, string>;
155
+ }): SetupResult;
156
+ /**
157
+ * Wrap a Next.js configuration object to automatically generate the `runtimeEnv`
158
+ * block in `env.gen.ts` and, in strict layout, register the `#arkenv/client-env`
159
+ * alias so `@arkenv/nextjs/server` can auto-extend the client env.
160
+ *
161
+ * @param nextConfig The Next.js configuration object (object-form only; function-form configs are not yet supported — see follow-up issue)
162
+ * @param options Optional configuration paths for schema and output files
163
+ * @returns The Next.js configuration object (with strict-layout aliases when applicable)
164
+ * @throws An error if the schema file cannot be found or if code generation fails
165
+ */
166
+ declare function withArkEnv<T>(nextConfig: T, options?: ArkEnvConfigOptions): T;
167
+ //#endregion
168
+ export { extractKeys as a, withArkEnv as i, extractSharedKeys as n, runCodegen as o, setupArkEnv as r, ArkEnvConfigOptions as s, extractClientKeys as t };
169
+ //# sourceMappingURL=index-CL9MPCBA.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CL9MPCBA.d.cts","names":["formatErrorCause","cause","logErrorWithCauseVia","message","log","header","LogLevel","Logger","debug","optionalParams","info","warn","error","LoggerConfig","level","BUILD_PREFIX","WATCHER_PREFIX","formatBuildError","BuildLogHelpers","logBuildWarning","logBuildError","logBuildErrorDetail","logBuildErrorBlankLine","logBuildErrorWithCause","logWatcherError","logWatcherErrorWithCause","createBuildLogHelpers","logger","resolveLogger","bindDefaultBuildLog","isNode","shouldDisableColors","createConsoleLogger","config","defaultLogger","configureDefaultLogger","ArkEnvLogOptions","logLevel","ArkEnvPluginConfig","T","Record","splitPluginConfig","pluginConfig","logOptions","resolveLoggerFromOptions","options","resolveBuildLog","parseLogLevel","value","readEnvLogLevel","resolveLogLevel","shouldLog","Exclude","configuredLevel","messageLevel"],"sources":["../../internal/log/dist/index.d.ts","../src/config/types.ts","../src/config/codegen.ts","../src/config/extract.ts","../src/config/setup.ts"],"mappings":";;;;;;;;KAgBKM,QAAAA;;;;KAIAC,MAAAA;EACHC,KAAAA,GAAQL,OAAAA,aAAoBM,cAAAA;EAC5BC,IAAAA,GAAOP,OAAAA,aAAoBM,cAAAA;EAC3BE,IAAAA,GAAOR,OAAAA,aAAoBM,cAAAA;EAC3BG,KAAAA,GAAQT,OAAAA,aAAoBM,cAAAA;AAAAA;;;;;;;;AAdsE;;;;;AAMvF;;;;KCHD,mBAAA;EDQFN;;;;;;;;;;;;;ECMT,UAAA;;;AAdD;;;;;;;;;;;EA6BC,UAAA;EAwDA;;;;;;;AChED;EDkBC,MAAA;;;;;ECbiB;;;;;;;;;;ED+BjB,QAAA;EC/B6D;;;;AC2F9D;EFrDC,QAAA;;;;;;EAOA,OAAA;EEiDQ;;;;;EF1CR,MAAA,GAAS,MAAA;EG3BM;;;;;EHkCf,QAAA,GAAW,QAAA;AAAA;;;;;ADxFwF;;;;;AAMvF;;iBEkBG,UAAA,CACf,UAAA,UACA,UAAA,UACA,YAAA,GAAe,mBAAA,YACf,aAAA,YACA,UAAA,GAAa,IAAA,CAAK,mBAAA;;;;;;AF7BiF;;;iBGwHpF,WAAA,CAAY,OAAA;EAC3B,UAAA;EACA,UAAA;EACA,QAAA;AAAA;;;KCrEI,WAAA;EACJ,cAAA;EACA,OAAA;EACA,aAAA;AAAA;;;AJnDY;;;;;;iBI8DG,WAAA,CACf,OAAA,GAAU,mBAAA,EACV,eAAA;EAAoB,YAAA,GAAe,MAAA;AAAA,IACjC,WAAA;;;;;;;;;;;iBA4Ka,UAAA,GAAA,CAAc,UAAA,EAAY,CAAA,EAAG,OAAA,GAAU,mBAAA,GAAsB,CAAA"}
@@ -83,6 +83,9 @@ declare const $: _$arktype.Scope<{
83
83
  }>;
84
84
  type $ = (typeof $)["t"]; //#endregion
85
85
  //#endregion
86
+ //#region ../internal/types/dist/helpers.d.ts
87
+ type Dict<T> = Record<string, T | undefined>;
88
+ //#endregion
86
89
  //#region ../internal/types/dist/standard-schema.d.ts
87
90
  /**
88
91
  * @see https://github.com/standard-schema/standard-schema/tree/3130ce43fdd848d9ab49dbb0458d04f18459961c/packages/spec
@@ -90,79 +93,139 @@ type $ = (typeof $)["t"]; //#endregion
90
93
  * Copied from standard-schema (MIT License)
91
94
  * Copyright (c) 2024 Colin McDannell
92
95
  */
93
- /** The Standard Typed interface. This is a base type extended by other specs. */
96
+ /**
97
+ * The Standard Typed interface. This is a base type extended by other specs.
98
+ */
94
99
  interface StandardTypedV1<Input = unknown, Output = Input> {
95
- /** The Standard properties. */
100
+ /**
101
+ * The Standard properties.
102
+ */
96
103
  readonly "~standard": StandardTypedV1.Props<Input, Output>;
97
104
  }
98
105
  declare namespace StandardTypedV1 {
99
- /** The Standard Typed properties interface. */
106
+ /**
107
+ * The Standard Typed properties interface.
108
+ */
100
109
  interface Props<Input = unknown, Output = Input> {
101
- /** The version number of the standard. */
110
+ /**
111
+ * The version number of the standard.
112
+ */
102
113
  readonly version: 1;
103
- /** The vendor name of the schema library. */
114
+ /**
115
+ * The vendor name of the schema library.
116
+ */
104
117
  readonly vendor: string;
105
- /** Inferred types associated with the schema. */
118
+ /**
119
+ * Inferred types associated with the schema.
120
+ */
106
121
  readonly types?: Types<Input, Output> | undefined;
107
122
  }
108
- /** The Standard Typed types interface. */
123
+ /**
124
+ * The Standard Typed types interface.
125
+ */
109
126
  interface Types<Input = unknown, Output = Input> {
110
- /** The input type of the schema. */
127
+ /**
128
+ * The input type of the schema.
129
+ */
111
130
  readonly input: Input;
112
- /** The output type of the schema. */
131
+ /**
132
+ * The output type of the schema.
133
+ */
113
134
  readonly output: Output;
114
135
  }
115
- /** Infers the input type of a Standard Typed. */
136
+ /**
137
+ * Infers the input type of a Standard Typed.
138
+ */
116
139
  type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
117
- /** Infers the output type of a Standard Typed. */
140
+ /**
141
+ * Infers the output type of a Standard Typed.
142
+ */
118
143
  type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
119
144
  }
120
- /** The Standard Schema interface. */
145
+ /**
146
+ * The Standard Schema interface.
147
+ */
121
148
  interface StandardSchemaV1<Input = unknown, Output = Input> {
122
- /** The Standard Schema properties. */
149
+ /**
150
+ * The Standard Schema properties.
151
+ */
123
152
  readonly "~standard": StandardSchemaV1.Props<Input, Output>;
124
153
  }
125
154
  declare namespace StandardSchemaV1 {
126
- /** The Standard Schema properties interface. */
155
+ /**
156
+ * The Standard Schema properties interface.
157
+ */
127
158
  interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
128
- /** Validates unknown input values. */
159
+ /**
160
+ * Validates unknown input values.
161
+ */
129
162
  readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
130
163
  }
131
- /** The result interface of the validate function. */
164
+ /**
165
+ * The result interface of the validate function.
166
+ */
132
167
  type Result<Output> = SuccessResult<Output> | FailureResult;
133
- /** The result interface if validation succeeds. */
168
+ /**
169
+ * The result interface if validation succeeds.
170
+ */
134
171
  interface SuccessResult<Output> {
135
- /** The typed output value. */
172
+ /**
173
+ * The typed output value.
174
+ */
136
175
  readonly value: Output;
137
- /** A falsy value for `issues` indicates success. */
176
+ /**
177
+ * A falsy value for `issues` indicates success.
178
+ */
138
179
  readonly issues?: undefined;
139
180
  }
140
181
  interface Options {
141
- /** Explicit support for additional vendor-specific parameters, if needed. */
182
+ /**
183
+ * Explicit support for additional vendor-specific parameters, if needed.
184
+ */
142
185
  readonly libraryOptions?: Record<string, unknown> | undefined;
143
186
  }
144
- /** The result interface if validation fails. */
187
+ /**
188
+ * The result interface if validation fails.
189
+ */
145
190
  interface FailureResult {
146
- /** The issues of failed validation. */
191
+ /**
192
+ * The issues of failed validation.
193
+ */
147
194
  readonly issues: ReadonlyArray<Issue>;
148
195
  }
149
- /** The issue interface of the failure output. */
196
+ /**
197
+ * The issue interface of the failure output.
198
+ */
150
199
  interface Issue {
151
- /** The error message of the issue. */
200
+ /**
201
+ * The error message of the issue.
202
+ */
152
203
  readonly message: string;
153
- /** The path of the issue, if any. */
204
+ /**
205
+ * The path of the issue, if any.
206
+ */
154
207
  readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
155
208
  }
156
- /** The path segment interface of the issue. */
209
+ /**
210
+ * The path segment interface of the issue.
211
+ */
157
212
  interface PathSegment {
158
- /** The key representing a path segment. */
213
+ /**
214
+ * The key representing a path segment.
215
+ */
159
216
  readonly key: PropertyKey;
160
217
  }
161
- /** The Standard types interface. */
218
+ /**
219
+ * The Standard types interface.
220
+ */
162
221
  interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
163
- /** Infers the input type of a Standard. */
222
+ /**
223
+ * Infers the input type of a Standard.
224
+ */
164
225
  type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
165
- /** Infers the output type of a Standard. */
226
+ /**
227
+ * Infers the output type of a Standard.
228
+ */
166
229
  type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
167
230
  }
168
231
  //#endregion
@@ -176,12 +239,12 @@ declare namespace StandardSchemaV1 {
176
239
  *
177
240
  * @template T - The schema definition to infer from
178
241
  */
179
- type InferType<T> = T extends StandardSchemaV1<infer _Input, infer Output> ? Output : T extends ((value: Record<string, string | undefined>) => infer R) ? R extends type.errors ? never : R : T extends {
242
+ type InferType<T> = T extends StandardSchemaV1<infer _Input, infer Output> ? Output : T extends ((value: Dict<string>) => infer R) ? R extends type.errors ? never : R : T extends {
180
243
  t: infer U;
181
244
  } ? U : T extends type.Any<infer U, infer _Scope> ? U : never;
182
245
  //#endregion
183
246
  //#region ../internal/types/dist/schema.d.ts
184
247
  type SchemaShape = Record<string, unknown>;
185
248
  //#endregion
186
- export { InferType as n, $ as r, SchemaShape as t };
187
- //# sourceMappingURL=index-Bn3pRiJy.d.ts.map
249
+ export { $ as a, Dict as i, InferType as n, StandardSchemaV1 as r, SchemaShape as t };
250
+ //# sourceMappingURL=index-Cq_qJ68V.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Cq_qJ68V.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","Dict","T","Record","StandardTypedV1","Input","Output","Props","Schema","Types","NonNullable","version","vendor","types","input","output","InferInput","InferOutput","StandardSchemaV1","Options","Result","Promise","SuccessResult","FailureResult","Record","Issue","ReadonlyArray","PropertyKey","PathSegment","validate","value","options","issues","libraryOptions","message","path","key","StandardJSONSchemaV1","Converter","Target","jsonSchema","target","type","Dict","StandardSchemaV1","InferType","T","errors","Any","_Input","Output","value","R","t","U","_Scope","$","Type","SchemaShape","Record","CompiledEnvSchema"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/helpers.d.ts","../../internal/types/dist/standard-schema.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/types/dist/schema.d.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BT,MAAAA;EAAAA;EF5D9BxC;;;EAAAA,UEiEUuC,aAAAA;IF/DS5D;;;IAAAA,SEmENqE,MAAAA,EAAQN,aAAAA,CAAcD,KAAAA;EAAAA;EFhEnCzD;;;EAAAA,UEqEUyD,KAAAA;IFrEqDzD;;;IAAAA,SEyElDkE,OAAAA;IFtEP7E;;;IAAAA,SE0EO8E,IAAAA,GAAOT,aAAAA,CAAcC,WAAAA,GAAcC,WAAAA;EAAAA;EFzE9C;;;EAAA,UE8EQA,WAAAA;IF5EiBtE;;;IAAAA,SEgFd8E,GAAAA,EAAKT,WAAAA;EAAAA;EF/EgBpE;;;EAAAA,UEoFxBkD,KAAAA,2BAAgCJ,KAAAA,UAAeD,eAAAA,CAAgBK,KAAAA,CAAMJ,KAAAA,EAAOC,MAAAA;EFlFzDhD;;;EAAAA,KEuFxB0D,UAAAA,gBAA0BZ,eAAAA,IAAmBA,eAAAA,CAAgBY,UAAAA,CAAWR,MAAAA;EFpF7EnB;;;EAAAA,KEwFK4B,WAAAA,gBAA2Bb,eAAAA,IAAmBA,eAAAA,CAAgBa,WAAAA,CAAYT,MAAAA;AAAAA;;;;;;AF1IC;;;;;;KGUxEqC,SAAAA,MAAeC,CAAAA,SAAUF,gBAAAA,+BAA+CM,MAAAA,GAASJ,CAAAA,WAAWK,KAAAA,EAAOR,IAAAA,wBAA2BS,CAAAA,SAAUV,IAAAA,CAAKK,MAAAA,WAAiBK,CAAAA,GAAIN,CAAAA;EAC1KO,CAAAA;AAAAA,IACAC,CAAAA,GAAIR,CAAAA,SAAUJ,IAAAA,CAAKM,GAAAA,0BAA6BM,CAAAA;;;KCZxCI,WAAAA,GAAcC,MAAAA"}
@@ -0,0 +1,169 @@
1
+ import { extractClientKeys as extractClientKeys$1, extractSharedKeys as extractSharedKeys$1 } from "@arkenv/build";
2
+
3
+ //#region ../internal/log/dist/index.d.ts
4
+ //#endregion
5
+ //#region src/types.d.ts
6
+ /**
7
+ * Supported log level thresholds, from most to least verbose.
8
+ */
9
+ type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
10
+ /**
11
+ * Shared logger interface for ArkEnv packages.
12
+ */
13
+ type Logger = {
14
+ debug: (message: string, ...optionalParams: unknown[]) => void;
15
+ info: (message: string, ...optionalParams: unknown[]) => void;
16
+ warn: (message: string, ...optionalParams: unknown[]) => void;
17
+ error: (message: string, ...optionalParams: unknown[]) => void;
18
+ };
19
+ /**
20
+ * Programmatic logger configuration. Takes precedence over `ARKENV_LOG_LEVEL`.
21
+ */
22
+ //#endregion
23
+ //#region src/config/types.d.ts
24
+ /**
25
+ * Configuration options for the ArkEnv Next.js integration.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const configOptions: ArkEnvConfigOptions = {
30
+ * schemaPath: "./src/env.ts",
31
+ * outputPath: "./src/generated/env.gen.ts"
32
+ * };
33
+ * ```
34
+ */
35
+ type ArkEnvConfigOptions = {
36
+ /**
37
+ * Specify the path to the schema definition file.
38
+ *
39
+ * Defaults to searching for `"src/env.ts"` or `"env.ts"` in the project root.
40
+ *
41
+ * @default "src/env.ts"
42
+ * @example
43
+ * ```ts
44
+ * export default withArkEnv(nextConfig, {
45
+ * schemaPath: "./src/env.ts"
46
+ * });
47
+ * ```
48
+ */
49
+ schemaPath?: string;
50
+ /**
51
+ * Specify the path where the generated file (`env.gen.ts`) should be written.
52
+ *
53
+ * Defaults to `"generated/env.gen.ts"` in the same directory as the schema file.
54
+ *
55
+ * @default "[schemaDirectory]/generated/env.gen.ts"
56
+ * @example
57
+ * ```ts
58
+ * export default withArkEnv(nextConfig, {
59
+ * outputPath: "./src/generated/env.gen.ts"
60
+ * });
61
+ * ```
62
+ */
63
+ outputPath?: string;
64
+ /**
65
+ * Specify the configuration layout.
66
+ *
67
+ * - `"flat"` (default): A single `env.ts` schema file.
68
+ * - `"strict"`: A split schema layout (`env/client.ts`, `env/server.ts`, and optionally `env/internal/shared.ts`).
69
+ *
70
+ * @default "flat"
71
+ */
72
+ layout?: "flat" | "strict"
73
+ /**
74
+ * @deprecated Use `"flat"` instead. `"simple"` will be removed in the next major version.
75
+ */
76
+ | "simple";
77
+ /**
78
+ * Force standard mode code generation.
79
+ *
80
+ * When `true`, the generated `env.gen.ts` imports from `@arkenv/nextjs/standard/*`
81
+ * instead of `@arkenv/nextjs/*`, ensuring the Standard Schema engine (`@arkenv/standard`)
82
+ * is used and `arktype` is never bundled. This is set automatically when importing from
83
+ * `@arkenv/nextjs/standard/config`, but can be toggled manually for custom setups.
84
+ *
85
+ * @default false
86
+ */
87
+ standard?: boolean;
88
+ /**
89
+ * Enable or disable build-time environment variable validation during build/dev startup.
90
+ *
91
+ * @default true
92
+ */
93
+ validate?: boolean;
94
+ /**
95
+ * Enable or disable automatic code generation of the `env.gen.ts` file.
96
+ *
97
+ * @default true
98
+ */
99
+ codegen?: boolean;
100
+ /**
101
+ * Custom logger instance for build-time messages.
102
+ *
103
+ * When omitted, ArkEnv uses a console logger respecting `ARKENV_LOG_LEVEL`.
104
+ */
105
+ logger?: Logger;
106
+ /**
107
+ * Minimum log level for build-time messages.
108
+ *
109
+ * Programmatic `logger` takes precedence over `logLevel`.
110
+ */
111
+ logLevel?: LogLevel;
112
+ };
113
+ //#endregion
114
+ //#region src/config/codegen.d.ts
115
+ /**
116
+ * Run code generation to read the schema file and generate the env.gen.ts factory.
117
+ *
118
+ * @param schemaPath The absolute path to the schema file or directory
119
+ * @param outputPath The absolute path to the generated output file
120
+ * @param layoutOption The explicit layout to use; auto-detected from the filesystem when omitted
121
+ * @param forceStandard Force standard mode code generation
122
+ * @throws An error if strict layout files are missing when `layoutOption` is `"strict"`
123
+ */
124
+ declare function runCodegen(schemaPath: string, outputPath: string, layoutOption?: ArkEnvConfigOptions["layout"], forceStandard?: boolean, logOptions?: Pick<ArkEnvConfigOptions, "logger" | "logLevel">): void;
125
+ //#endregion
126
+ //#region src/config/extract.d.ts
127
+ /**
128
+ * Statically extract client and shared keys from the schema content.
129
+ *
130
+ * @param content The schema file string content
131
+ * @returns An object containing the extracted client and shared keys
132
+ */
133
+ declare function extractKeys(content: string): {
134
+ clientKeys: string[];
135
+ sharedKeys: string[];
136
+ isLegacy?: boolean;
137
+ };
138
+ //#endregion
139
+ //#region src/config/setup.d.ts
140
+ type SetupResult = {
141
+ resolvedLayout: "flat" | "strict" | "simple";
142
+ baseDir: string | undefined;
143
+ clientEnvPath: string | undefined;
144
+ };
145
+ /**
146
+ * Run ArkEnv codegen and setup without wrapping nextConfig.
147
+ *
148
+ * @param options Optional configuration paths for schema and output files
149
+ * @param internalOptions Optional configuration for internal testing hooks
150
+ * @returns Resolved layout paths used by `withArkEnv` for alias registration
151
+ * @throws An error if the schema file cannot be found or if code generation fails
152
+ */
153
+ declare function setupArkEnv(options?: ArkEnvConfigOptions, internalOptions?: {
154
+ _jitiAliases?: Record<string, string>;
155
+ }): SetupResult;
156
+ /**
157
+ * Wrap a Next.js configuration object to automatically generate the `runtimeEnv`
158
+ * block in `env.gen.ts` and, in strict layout, register the `#arkenv/client-env`
159
+ * alias so `@arkenv/nextjs/server` can auto-extend the client env.
160
+ *
161
+ * @param nextConfig The Next.js configuration object (object-form only; function-form configs are not yet supported — see follow-up issue)
162
+ * @param options Optional configuration paths for schema and output files
163
+ * @returns The Next.js configuration object (with strict-layout aliases when applicable)
164
+ * @throws An error if the schema file cannot be found or if code generation fails
165
+ */
166
+ declare function withArkEnv<T>(nextConfig: T, options?: ArkEnvConfigOptions): T;
167
+ //#endregion
168
+ export { extractKeys as a, withArkEnv as i, extractSharedKeys$1 as n, runCodegen as o, setupArkEnv as r, ArkEnvConfigOptions as s, extractClientKeys$1 as t };
169
+ //# sourceMappingURL=index-DLwzgCyF.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DLwzgCyF.d.ts","names":["formatErrorCause","cause","logErrorWithCauseVia","message","log","header","LogLevel","Logger","debug","optionalParams","info","warn","error","LoggerConfig","level","BUILD_PREFIX","WATCHER_PREFIX","formatBuildError","BuildLogHelpers","logBuildWarning","logBuildError","logBuildErrorDetail","logBuildErrorBlankLine","logBuildErrorWithCause","logWatcherError","logWatcherErrorWithCause","createBuildLogHelpers","logger","resolveLogger","bindDefaultBuildLog","isNode","shouldDisableColors","createConsoleLogger","config","defaultLogger","configureDefaultLogger","ArkEnvLogOptions","logLevel","ArkEnvPluginConfig","T","Record","splitPluginConfig","pluginConfig","logOptions","resolveLoggerFromOptions","options","resolveBuildLog","parseLogLevel","value","readEnvLogLevel","resolveLogLevel","shouldLog","Exclude","configuredLevel","messageLevel"],"sources":["../../internal/log/dist/index.d.ts","../src/config/types.ts","../src/config/codegen.ts","../src/config/extract.ts","../src/config/setup.ts"],"mappings":";;;;;;;;KAgBKM,QAAAA;;;;KAIAC,MAAAA;EACHC,KAAAA,GAAQL,OAAAA,aAAoBM,cAAAA;EAC5BC,IAAAA,GAAOP,OAAAA,aAAoBM,cAAAA;EAC3BE,IAAAA,GAAOR,OAAAA,aAAoBM,cAAAA;EAC3BG,KAAAA,GAAQT,OAAAA,aAAoBM,cAAAA;AAAAA;;;;;;;;AAdsE;;;;;AAMvF;;;;KCHD,mBAAA;EDQFN;;;;;;;;;;;;;ECMT,UAAA;;;AAdD;;;;;;;;;;;EA6BC,UAAA;EAwDA;;;;;;;AChED;EDkBC,MAAA;;;;;ECbiB;;;;;;;;;;ED+BjB,QAAA;EC/B6D;;;;AC2F9D;EFrDC,QAAA;;;;;;EAOA,OAAA;EEiDQ;;;;;EF1CR,MAAA,GAAS,MAAA;EG3BM;;;;;EHkCf,QAAA,GAAW,QAAA;AAAA;;;;;ADxFwF;;;;;AAMvF;;iBEkBG,UAAA,CACf,UAAA,UACA,UAAA,UACA,YAAA,GAAe,mBAAA,YACf,aAAA,YACA,UAAA,GAAa,IAAA,CAAK,mBAAA;;;;;;AF7BiF;;;iBGwHpF,WAAA,CAAY,OAAA;EAC3B,UAAA;EACA,UAAA;EACA,QAAA;AAAA;;;KCrEI,WAAA;EACJ,cAAA;EACA,OAAA;EACA,aAAA;AAAA;;;AJnDY;;;;;;iBI8DG,WAAA,CACf,OAAA,GAAU,mBAAA,EACV,eAAA;EAAoB,YAAA,GAAe,MAAA;AAAA,IACjC,WAAA;;;;;;;;;;;iBA4Ka,UAAA,GAAA,CAAc,UAAA,EAAY,CAAA,EAAG,OAAA,GAAU,mBAAA,GAAsB,CAAA"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./arkenv-internal-DA4LpI3t.cjs`);require(`./config.cjs`);let t=require(`arkenv`);function n(t){return e.t(t,!1)}exports.arkenv=n,exports.default=n,Object.defineProperty(exports,`type`,{enumerable:!0,get:function(){return t.type}});
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./config-CU-9fwxw.cjs`);const e=require(`./arkenv-internal-QxkUlA5J.cjs`),t=require(`./script-BBfmzIh4.cjs`);let n=require(`@arkenv/core`);function r(t,r){return t&&typeof t==`object`&&(`runtimeEnv`in t||`server`in t||`client`in t||`shared`in t)?e.t(t,!1,void 0,n.arkenv,n.getSchemaKeys):e.t(t,r,{isServer:!1},n.arkenv,n.getSchemaKeys)}exports.ArkEnvScript=t.t,exports.arkenv=r,exports.default=r;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["arkenv","arkenvInternal"],"sources":["../src/index.ts"],"sourcesContent":["import type { SchemaShape } from \"@repo/types\";\nimport type { EnvSchema, Infer } from \"arkenv\";\nimport { arkenvInternal } from \"./arkenv-internal\";\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 arkenv<\n\tconst TServer extends SchemaShape = {},\n\tconst TClient extends SchemaShape = {},\n\tconst TShared extends SchemaShape = {},\n>(options: {\n\tserver?: EnvSchema<TServer>;\n\tclient?: EnvSchema<TClient> & {\n\t\t[K in keyof TClient]: K extends `NEXT_PUBLIC_${string}` ? unknown : never;\n\t};\n\tshared?: EnvSchema<TShared>;\n\truntimeEnv: Record<keyof TClient | keyof TShared, unknown> &\n\t\tRecord<string, unknown>;\n}): Readonly<Infer<TServer & TClient & TShared>> {\n\ttype ReturnType = Readonly<Infer<TServer & TClient & TShared>>;\n\treturn arkenvInternal(options, false) as ReturnType;\n}\n\nexport type { Infer } from \"arkenv\";\nexport { type } from \"arkenv\";\n\n/**\n * ArkEnv's Next.js integration export\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nexport default arkenv;\n"],"mappings":"iMAYA,SAAgBA,EAId,EAQ+C,CAEhD,OAAOC,EAAAA,EAAe,EAAS,GAAM"}
1
+ {"version":3,"file":"index.cjs","names":["arkenvInternal","coreArkenv","getSchemaKeys"],"sources":["../src/index.ts"],"sourcesContent":["import type { EnvSchema, Infer } from \"@arkenv/core\";\nimport { arkenv as coreArkenv, getSchemaKeys } from \"@arkenv/core\";\nimport type { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { arkenvInternal } from \"./arkenv-internal\";\nimport type { MergeExtends } from \"./types\";\n\n/**\n * Extract keys from a schema type that are visible on the client:\n * - Keys prefixed with `NEXT_PUBLIC_`\n * - `NODE_ENV` (implicitly shared by Next.js)\n * - Keys listed in `exposeToClient`\n */\ntype ClientVisibleKeys<\n\tTSchema extends SchemaShape,\n\tTExpose extends keyof TSchema,\n> = {\n\t[K in keyof TSchema]: K extends `NEXT_PUBLIC_${string}`\n\t\t? K\n\t\t: K extends \"NODE_ENV\"\n\t\t\t? K\n\t\t\t: K extends TExpose\n\t\t\t\t? K\n\t\t\t\t: never;\n}[keyof TSchema];\n\n/**\n * Create a validated, typesafe environment configuration for Next.js applications (Client-side / SSR entry point).\n */\nexport function arkenv<\n\tconst TSchema extends SchemaShape & { runtimeEnv?: never } = {},\n\tconst TExpose extends keyof TSchema = never,\n\tconst TExtends extends readonly unknown[] = [],\n>(\n\tschema: EnvSchema<TSchema>,\n\toptions?: {\n\t\t/**\n\t\t * Custom environment variables to expose to the client bundle.\n\t\t * By default, variables prefixed with `NEXT_PUBLIC_` and `NODE_ENV` are exposed automatically.\n\t\t * Use this option to expose custom variables that do not have the `NEXT_PUBLIC_` prefix.\n\t\t */\n\t\texposeToClient?: readonly TExpose[];\n\t\t/**\n\t\t * @deprecated Use `exposeToClient` instead\n\t\t */\n\t\texpose?: readonly TExpose[];\n\t\t/**\n\t\t * @deprecated Use `exposeToClient` instead\n\t\t */\n\t\tshared?: readonly TExpose[];\n\t\textends?: [...TExtends];\n\t\truntimeEnv?: Record<string, unknown>;\n\t},\n): Readonly<\n\tPick<\n\t\tdistill.Out<at.infer<TSchema, $>>,\n\t\tExtract<\n\t\t\tkeyof distill.Out<at.infer<TSchema, $>>,\n\t\t\tClientVisibleKeys<TSchema, TExpose>\n\t\t>\n\t> &\n\t\tMergeExtends<TExtends>\n>;\n\n/**\n * @deprecated Use the unified flat layout signature instead: `arkenv(schema, options)`\n */\nexport function arkenv<\n\tconst TServer extends SchemaShape = {},\n\tconst TClient extends SchemaShape = {},\n\tconst TShared extends SchemaShape = {},\n>(options: {\n\tserver?: EnvSchema<TServer>;\n\tclient?: EnvSchema<TClient> & {\n\t\t[K in keyof TClient]: K extends `NEXT_PUBLIC_${string}` ? unknown : never;\n\t};\n\tshared?: EnvSchema<TShared>;\n\truntimeEnv: Record<keyof TClient | keyof TShared, unknown> &\n\t\tRecord<string, unknown>;\n}): Readonly<Infer<TServer & TClient & TShared>>;\n\nexport function arkenv(schemaOrOptions: any, optionsOrIsServer?: any): any {\n\tconst isLegacy =\n\t\tschemaOrOptions &&\n\t\ttypeof schemaOrOptions === \"object\" &&\n\t\t(\"runtimeEnv\" in schemaOrOptions ||\n\t\t\t\"server\" in schemaOrOptions ||\n\t\t\t\"client\" in schemaOrOptions ||\n\t\t\t\"shared\" in schemaOrOptions);\n\n\tif (isLegacy) {\n\t\treturn arkenvInternal(\n\t\t\tschemaOrOptions,\n\t\t\tfalse,\n\t\t\tundefined,\n\t\t\tcoreArkenv,\n\t\t\tgetSchemaKeys,\n\t\t);\n\t}\n\n\treturn arkenvInternal(\n\t\tschemaOrOptions,\n\t\toptionsOrIsServer,\n\t\t{ isServer: false },\n\t\tcoreArkenv,\n\t\tgetSchemaKeys,\n\t);\n}\n\nexport type { ArkEnvScriptProps } from \"./script\";\nexport { ArkEnvScript } from \"./script\";\n\nexport default arkenv;\n"],"mappings":"mPAkFA,SAAgB,EAAO,EAAsB,EAA8B,CAmB1E,OAjBC,GACA,OAAO,GAAoB,WAC1B,eAAgB,GAChB,WAAY,GACZ,WAAY,GACZ,WAAY,GAGNA,EAAAA,EACN,EACA,GACA,IAAA,GACAC,EAAAA,OACAC,EAAAA,cACA,CAGKF,EAAAA,EACN,EACA,EACA,CAAE,SAAU,GAAO,CACnBC,EAAAA,OACAC,EAAAA,cACA"}
package/dist/index.d.cts CHANGED
@@ -1,21 +1,49 @@
1
- import { t as SchemaShape } from "./index-C6bpQ5GU.cjs";
2
- import { EnvSchema, Infer, Infer as Infer$1, type } from "arkenv";
1
+ import { a as $, t as SchemaShape } from "./index-BS1wAitS.cjs";
2
+ import { t as MergeExtends } from "./types-BlRHnQwj.cjs";
3
+ import { n as ArkEnvScriptProps, t as ArkEnvScript } from "./script-BHFJ0MU_.cjs";
4
+ import { EnvSchema, Infer } from "@arkenv/core";
5
+ import { distill, type } from "arktype";
3
6
 
4
7
  //#region src/index.d.ts
5
8
  /**
6
- * Create a validated, type-safe environment configuration for Next.js applications (Client-side / SSR entry point).
7
- *
8
- * @param options The environment validation configuration options
9
- * @returns A validated, readonly environment variables object wrapped in a security proxy
10
- * @throws An error if any client-side variable is not prefixed with `NEXT_PUBLIC_`
11
- * @throws An error if any client or shared variable is missing from `runtimeEnv`
9
+ * Extract keys from a schema type that are visible on the client:
10
+ * - Keys prefixed with `NEXT_PUBLIC_`
11
+ * - `NODE_ENV` (implicitly shared by Next.js)
12
+ * - Keys listed in `exposeToClient`
13
+ */
14
+ type ClientVisibleKeys<TSchema extends SchemaShape, TExpose extends keyof TSchema> = { [K in keyof TSchema]: K extends `NEXT_PUBLIC_${string}` ? K : K extends "NODE_ENV" ? K : K extends TExpose ? K : never }[keyof TSchema];
15
+ /**
16
+ * Create a validated, typesafe environment configuration for Next.js applications (Client-side / SSR entry point).
17
+ */
18
+ declare function arkenv<const TSchema extends SchemaShape & {
19
+ runtimeEnv?: never;
20
+ } = {}, const TExpose extends keyof TSchema = never, const TExtends extends readonly unknown[] = []>(schema: EnvSchema<TSchema>, options?: {
21
+ /**
22
+ * Custom environment variables to expose to the client bundle.
23
+ * By default, variables prefixed with `NEXT_PUBLIC_` and `NODE_ENV` are exposed automatically.
24
+ * Use this option to expose custom variables that do not have the `NEXT_PUBLIC_` prefix.
25
+ */
26
+ exposeToClient?: readonly TExpose[];
27
+ /**
28
+ * @deprecated Use `exposeToClient` instead
29
+ */
30
+ expose?: readonly TExpose[];
31
+ /**
32
+ * @deprecated Use `exposeToClient` instead
33
+ */
34
+ shared?: readonly TExpose[];
35
+ extends?: [...TExtends];
36
+ runtimeEnv?: Record<string, unknown>;
37
+ }): Readonly<Pick<distill.Out<type.infer<TSchema, $>>, Extract<keyof distill.Out<type.infer<TSchema, $>>, ClientVisibleKeys<TSchema, TExpose>>> & MergeExtends<TExtends>>;
38
+ /**
39
+ * @deprecated Use the unified flat layout signature instead: `arkenv(schema, options)`
12
40
  */
13
41
  declare function arkenv<const TServer extends SchemaShape = {}, const TClient extends SchemaShape = {}, const TShared extends SchemaShape = {}>(options: {
14
42
  server?: EnvSchema<TServer>;
15
43
  client?: EnvSchema<TClient> & { [K in keyof TClient]: K extends `NEXT_PUBLIC_${string}` ? unknown : never };
16
44
  shared?: EnvSchema<TShared>;
17
45
  runtimeEnv: Record<keyof TClient | keyof TShared, unknown> & Record<string, unknown>;
18
- }): Readonly<Infer$1<TServer & TClient & TShared>>;
46
+ }): Readonly<Infer<TServer & TClient & TShared>>;
19
47
  //#endregion
20
- export { type Infer, arkenv, arkenv as default, type };
48
+ export { ArkEnvScript, type ArkEnvScriptProps, arkenv, arkenv as default };
21
49
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AAYA;;;;;;iBAAgB,MAAA,uBACO,WAAA,6BACA,WAAA,6BACA,WAAA,MAAA,CACrB,OAAA;EACD,MAAA,GAAS,SAAA,CAAU,OAAA;EACnB,MAAA,GAAS,SAAA,CAAU,OAAA,kBACN,OAAA,GAAU,CAAA;EAEvB,MAAA,GAAS,SAAA,CAAU,OAAA;EACnB,UAAA,EAAY,MAAA,OAAa,OAAA,SAAgB,OAAA,aACxC,MAAA;AAAA,IACE,QAAA,CAAS,OAAA,CAAM,OAAA,GAAU,OAAA,GAAU,OAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;AAM4C;;;;KAQvC,iBAAA,iBACY,WAAA,wBACM,OAAA,kBAEV,OAAA,GAAU,CAAA,mCACnB,CAAA,GACA,CAAA,sBACC,CAAA,GACA,CAAA,SAAU,OAAA,GACT,CAAA,iBAEE,OAAA;;;;iBAKQ,MAAA,uBACO,WAAA;EAAgB,UAAA;AAAA,oCACV,OAAA,yDAAA,CAG5B,MAAA,EAAQ,SAAA,CAAU,OAAA,GAClB,OAAA;EAXO;;;;;EAiBN,cAAA,YAA0B,OAAA;EA1BL;;;EA8BrB,MAAA,YAAkB,OAAA;EA3BhB;;;EA+BF,MAAA,YAAkB,OAAA;EAClB,OAAA,OAAc,QAAA;EACd,UAAA,GAAa,MAAA;AAAA,IAEZ,QAAA,CACF,IAAA,CACC,O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