@arkenv/nextjs 1.0.0-alpha.11 → 1.0.0-alpha.13
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/README.md +18 -29
- package/dist/client.cjs +1 -1
- package/dist/config/index.cjs +1 -1
- package/dist/config/index.d.cts +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +1 -1
- package/dist/config-B9BksrZQ.js +97 -0
- package/dist/config-B9BksrZQ.js.map +1 -0
- package/dist/config-DNiuFUxj.cjs +97 -0
- package/dist/config-DNiuFUxj.cjs.map +1 -0
- package/dist/{index-CL9MPCBA.d.cts → index-BIewRgpQ.d.cts} +45 -13
- package/dist/{index-CL9MPCBA.d.cts.map → index-BIewRgpQ.d.cts.map} +1 -1
- package/dist/{index-DLwzgCyF.d.ts → index-U5bfcjNW.d.ts} +45 -13
- package/dist/{index-DLwzgCyF.d.ts.map → index-U5bfcjNW.d.ts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/react-server.cjs +1 -1
- package/dist/{script-BBfmzIh4.cjs → script-iYGXywhf.cjs} +2 -2
- package/dist/{script-BBfmzIh4.cjs.map → script-iYGXywhf.cjs.map} +1 -1
- package/dist/server.cjs +1 -1
- package/dist/standard/client.cjs +1 -1
- package/dist/standard/config.cjs +1 -1
- package/dist/standard/config.cjs.map +1 -1
- package/dist/standard/config.d.cts +6 -5
- package/dist/standard/config.d.cts.map +1 -1
- package/dist/standard/config.d.ts +6 -5
- package/dist/standard/config.d.ts.map +1 -1
- package/dist/standard/config.js +1 -1
- package/dist/standard/config.js.map +1 -1
- package/dist/standard/index.cjs +1 -1
- package/dist/standard/server.cjs +1 -1
- package/dist/standard/shared.cjs +1 -1
- package/package.json +3 -3
- package/dist/config-Bnir9dSk.js +0 -97
- package/dist/config-Bnir9dSk.js.map +0 -1
- package/dist/config-CU-9fwxw.cjs +0 -97
- package/dist/config-CU-9fwxw.cjs.map +0 -1
|
@@ -21,6 +21,19 @@ type Logger = {
|
|
|
21
21
|
*/
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/config/types.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* Context object Next.js passes to a function-form `next.config`.
|
|
26
|
+
*
|
|
27
|
+
* `defaultConfig` is `{}` so callers can spread it while remaining a
|
|
28
|
+
* supertype of Next.js's `NextConfig` interface.
|
|
29
|
+
*/
|
|
30
|
+
type NextConfigContext = {
|
|
31
|
+
defaultConfig: {};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Function-form Next.js config: sync or async, receiving the current phase.
|
|
35
|
+
*/
|
|
36
|
+
type NextConfigFactory<T extends object = object> = (phase: string, context: NextConfigContext) => T | Promise<T>;
|
|
24
37
|
/**
|
|
25
38
|
* Configuration options for the ArkEnv Next.js integration.
|
|
26
39
|
*
|
|
@@ -28,7 +41,6 @@ type Logger = {
|
|
|
28
41
|
* ```ts
|
|
29
42
|
* const configOptions: ArkEnvConfigOptions = {
|
|
30
43
|
* schemaPath: "./src/env.ts",
|
|
31
|
-
* outputPath: "./src/generated/env.gen.ts"
|
|
32
44
|
* };
|
|
33
45
|
* ```
|
|
34
46
|
*/
|
|
@@ -50,13 +62,16 @@ type ArkEnvConfigOptions = {
|
|
|
50
62
|
/**
|
|
51
63
|
* Specify the path where the generated file (`env.gen.ts`) should be written.
|
|
52
64
|
*
|
|
53
|
-
* Defaults to
|
|
65
|
+
* Defaults to `.arkenv/env.gen.ts` at the project root. Import the factory
|
|
66
|
+
* via `@/.arkenv`. Bundlers resolve that specifier through `withArkEnv`.
|
|
67
|
+
* `tsc --noEmit` resolves it through `.arkenv/index.ts`, which re-exports
|
|
68
|
+
* this file when it lives outside `.arkenv/`.
|
|
54
69
|
*
|
|
55
|
-
* @default "[
|
|
70
|
+
* @default "[projectRoot]/.arkenv/env.gen.ts"
|
|
56
71
|
* @example
|
|
57
72
|
* ```ts
|
|
58
73
|
* export default withArkEnv(nextConfig, {
|
|
59
|
-
* outputPath: "
|
|
74
|
+
* outputPath: "src/generated/env.gen.ts",
|
|
60
75
|
* });
|
|
61
76
|
* ```
|
|
62
77
|
*/
|
|
@@ -119,9 +134,11 @@ type ArkEnvConfigOptions = {
|
|
|
119
134
|
* @param outputPath The absolute path to the generated output file
|
|
120
135
|
* @param layoutOption The explicit layout to use; auto-detected from the filesystem when omitted
|
|
121
136
|
* @param forceStandard Force standard mode code generation
|
|
137
|
+
* @param logOptions Logger options forwarded to layout resolution
|
|
138
|
+
* @param projectRoot App root used to keep `.arkenv/index.ts` as the `@/.arkenv` TypeScript entry
|
|
122
139
|
* @throws An error if strict layout files are missing when `layoutOption` is `"strict"`
|
|
123
140
|
*/
|
|
124
|
-
declare function runCodegen(schemaPath: string, outputPath: string, layoutOption?: ArkEnvConfigOptions["layout"], forceStandard?: boolean, logOptions?: Pick<ArkEnvConfigOptions, "logger" | "logLevel"
|
|
141
|
+
declare function runCodegen(schemaPath: string, outputPath: string, layoutOption?: ArkEnvConfigOptions["layout"], forceStandard?: boolean, logOptions?: Pick<ArkEnvConfigOptions, "logger" | "logLevel">, projectRoot?: string): void;
|
|
125
142
|
//#endregion
|
|
126
143
|
//#region src/config/extract.d.ts
|
|
127
144
|
/**
|
|
@@ -141,6 +158,7 @@ type SetupResult = {
|
|
|
141
158
|
resolvedLayout: "flat" | "strict" | "simple";
|
|
142
159
|
baseDir: string | undefined;
|
|
143
160
|
clientEnvPath: string | undefined;
|
|
161
|
+
outputPath: string;
|
|
144
162
|
};
|
|
145
163
|
/**
|
|
146
164
|
* Run ArkEnv codegen and setup without wrapping nextConfig.
|
|
@@ -154,16 +172,30 @@ declare function setupArkEnv(options?: ArkEnvConfigOptions, internalOptions?: {
|
|
|
154
172
|
_jitiAliases?: Record<string, string>;
|
|
155
173
|
}): SetupResult;
|
|
156
174
|
/**
|
|
157
|
-
* Wrap a Next.js configuration object to
|
|
158
|
-
*
|
|
159
|
-
*
|
|
175
|
+
* Wrap a Next.js configuration object or function to generate `runtimeEnv` in
|
|
176
|
+
* `env.gen.ts`, register `#arkenv/client-env` in strict layout for auto-extend,
|
|
177
|
+
* and configure Turbopack/Webpack aliases for virtualized `.arkenv/` placement.
|
|
160
178
|
*
|
|
161
|
-
*
|
|
179
|
+
* Function-form configs (sync or async) are preserved: ArkEnv awaits the user's
|
|
180
|
+
* factory, then applies aliases to the resolved object.
|
|
181
|
+
*
|
|
182
|
+
* @param nextConfig The Next.js configuration object or `(phase, context)` factory
|
|
162
183
|
* @param options Optional configuration paths for schema and output files
|
|
163
|
-
* @returns The Next.js configuration object
|
|
184
|
+
* @returns The Next.js configuration object, or an async factory that resolves to it
|
|
164
185
|
* @throws An error if the schema file cannot be found or if code generation fails
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* export default withArkEnv({ reactStrictMode: true });
|
|
190
|
+
*
|
|
191
|
+
* export default withArkEnv(async (phase, { defaultConfig }) => ({
|
|
192
|
+
* ...defaultConfig,
|
|
193
|
+
* reactStrictMode: phase !== "phase-test",
|
|
194
|
+
* }));
|
|
195
|
+
* ```
|
|
165
196
|
*/
|
|
166
|
-
declare function withArkEnv<T>(nextConfig: T
|
|
197
|
+
declare function withArkEnv<T extends object>(nextConfig: NextConfigFactory<T>, options?: ArkEnvConfigOptions): (phase: string, context: NextConfigContext) => Promise<T>;
|
|
198
|
+
declare function withArkEnv<T extends object>(nextConfig: T, options?: ArkEnvConfigOptions): T;
|
|
167
199
|
//#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-
|
|
200
|
+
export { extractKeys as a, NextConfigContext as c, withArkEnv as i, NextConfigFactory as l, extractSharedKeys as n, runCodegen as o, setupArkEnv as r, ArkEnvConfigOptions as s, extractClientKeys as t };
|
|
201
|
+
//# sourceMappingURL=index-BIewRgpQ.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BIewRgpQ.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;;;;KCFxF,iBAAA;EACX,aAAA;AAAA;;;;KAMW,iBAAA,+BACX,KAAA,UACA,OAAA,EAAS,iBAAA,KACL,CAAA,GAAI,OAAA,CAAQ,CAAA;;;;;;;;;;;KAYL,mBAAA;EDNgC;;;;AChB5C;;;;;AAOA;;;;EA6BC,UAAA;EA1BgB;;;;;;;;;;;;;AAYjB;;;EAgCC,UAAA;EAlBA;;;;;;;;EA4BA,MAAA;EA8CW;;;EAAA;;;AChCZ;;;;;;;;EDIC,QAAA;ECFA;;;;;EDSA,QAAA;ECNA;;;;;EDaA,OAAA;;AE0BD;;;;EFnBC,MAAA,GAAS,MAAA;EEoBT;;;;;EFbA,QAAA,GAAW,QAAA;AAAA;;;;;AD5GwF;;;;;AAMvF;;;;iBEsEG,UAAA,CACf,UAAA,UACA,UAAA,UACA,YAAA,GAAe,mBAAA,YACf,aAAA,YACA,UAAA,GAAa,IAAA,CAAK,mBAAA,0BAClB,WAAA;;;;;;AFlFmG;;;iBGwHpF,WAAA,CAAY,OAAA;EAC3B,UAAA;EACA,UAAA;EACA,QAAA;AAAA;;;KCjEI,WAAA;EACJ,cAAA;EACA,OAAA;EACA,aAAA;EACA,UAAA;AAAA;;AJxDY;;;;;;;iBImEG,WAAA,CACf,OAAA,GAAU,mBAAA,EACV,eAAA;EAAoB,YAAA,GAAe,MAAA;AAAA,IACjC,WAAA;;;;;;;;;;;;AH9EH;;;;;AAOA;;;;;;;iBGyWgB,UAAA,kBAAA,CACf,UAAA,EAAY,iBAAA,CAAkB,CAAA,GAC9B,OAAA,GAAU,mBAAA,IACP,KAAA,UAAe,OAAA,EAAS,iBAAA,KAAsB,OAAA,CAAQ,CAAA;AAAA,iBAC1C,UAAA,kBAAA,CACf,UAAA,EAAY,CAAA,EACZ,OAAA,GAAU,mBAAA,GACR,CAAA"}
|
|
@@ -21,6 +21,19 @@ type Logger = {
|
|
|
21
21
|
*/
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/config/types.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* Context object Next.js passes to a function-form `next.config`.
|
|
26
|
+
*
|
|
27
|
+
* `defaultConfig` is `{}` so callers can spread it while remaining a
|
|
28
|
+
* supertype of Next.js's `NextConfig` interface.
|
|
29
|
+
*/
|
|
30
|
+
type NextConfigContext = {
|
|
31
|
+
defaultConfig: {};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Function-form Next.js config: sync or async, receiving the current phase.
|
|
35
|
+
*/
|
|
36
|
+
type NextConfigFactory<T extends object = object> = (phase: string, context: NextConfigContext) => T | Promise<T>;
|
|
24
37
|
/**
|
|
25
38
|
* Configuration options for the ArkEnv Next.js integration.
|
|
26
39
|
*
|
|
@@ -28,7 +41,6 @@ type Logger = {
|
|
|
28
41
|
* ```ts
|
|
29
42
|
* const configOptions: ArkEnvConfigOptions = {
|
|
30
43
|
* schemaPath: "./src/env.ts",
|
|
31
|
-
* outputPath: "./src/generated/env.gen.ts"
|
|
32
44
|
* };
|
|
33
45
|
* ```
|
|
34
46
|
*/
|
|
@@ -50,13 +62,16 @@ type ArkEnvConfigOptions = {
|
|
|
50
62
|
/**
|
|
51
63
|
* Specify the path where the generated file (`env.gen.ts`) should be written.
|
|
52
64
|
*
|
|
53
|
-
* Defaults to
|
|
65
|
+
* Defaults to `.arkenv/env.gen.ts` at the project root. Import the factory
|
|
66
|
+
* via `@/.arkenv`. Bundlers resolve that specifier through `withArkEnv`.
|
|
67
|
+
* `tsc --noEmit` resolves it through `.arkenv/index.ts`, which re-exports
|
|
68
|
+
* this file when it lives outside `.arkenv/`.
|
|
54
69
|
*
|
|
55
|
-
* @default "[
|
|
70
|
+
* @default "[projectRoot]/.arkenv/env.gen.ts"
|
|
56
71
|
* @example
|
|
57
72
|
* ```ts
|
|
58
73
|
* export default withArkEnv(nextConfig, {
|
|
59
|
-
* outputPath: "
|
|
74
|
+
* outputPath: "src/generated/env.gen.ts",
|
|
60
75
|
* });
|
|
61
76
|
* ```
|
|
62
77
|
*/
|
|
@@ -119,9 +134,11 @@ type ArkEnvConfigOptions = {
|
|
|
119
134
|
* @param outputPath The absolute path to the generated output file
|
|
120
135
|
* @param layoutOption The explicit layout to use; auto-detected from the filesystem when omitted
|
|
121
136
|
* @param forceStandard Force standard mode code generation
|
|
137
|
+
* @param logOptions Logger options forwarded to layout resolution
|
|
138
|
+
* @param projectRoot App root used to keep `.arkenv/index.ts` as the `@/.arkenv` TypeScript entry
|
|
122
139
|
* @throws An error if strict layout files are missing when `layoutOption` is `"strict"`
|
|
123
140
|
*/
|
|
124
|
-
declare function runCodegen(schemaPath: string, outputPath: string, layoutOption?: ArkEnvConfigOptions["layout"], forceStandard?: boolean, logOptions?: Pick<ArkEnvConfigOptions, "logger" | "logLevel"
|
|
141
|
+
declare function runCodegen(schemaPath: string, outputPath: string, layoutOption?: ArkEnvConfigOptions["layout"], forceStandard?: boolean, logOptions?: Pick<ArkEnvConfigOptions, "logger" | "logLevel">, projectRoot?: string): void;
|
|
125
142
|
//#endregion
|
|
126
143
|
//#region src/config/extract.d.ts
|
|
127
144
|
/**
|
|
@@ -141,6 +158,7 @@ type SetupResult = {
|
|
|
141
158
|
resolvedLayout: "flat" | "strict" | "simple";
|
|
142
159
|
baseDir: string | undefined;
|
|
143
160
|
clientEnvPath: string | undefined;
|
|
161
|
+
outputPath: string;
|
|
144
162
|
};
|
|
145
163
|
/**
|
|
146
164
|
* Run ArkEnv codegen and setup without wrapping nextConfig.
|
|
@@ -154,16 +172,30 @@ declare function setupArkEnv(options?: ArkEnvConfigOptions, internalOptions?: {
|
|
|
154
172
|
_jitiAliases?: Record<string, string>;
|
|
155
173
|
}): SetupResult;
|
|
156
174
|
/**
|
|
157
|
-
* Wrap a Next.js configuration object to
|
|
158
|
-
*
|
|
159
|
-
*
|
|
175
|
+
* Wrap a Next.js configuration object or function to generate `runtimeEnv` in
|
|
176
|
+
* `env.gen.ts`, register `#arkenv/client-env` in strict layout for auto-extend,
|
|
177
|
+
* and configure Turbopack/Webpack aliases for virtualized `.arkenv/` placement.
|
|
160
178
|
*
|
|
161
|
-
*
|
|
179
|
+
* Function-form configs (sync or async) are preserved: ArkEnv awaits the user's
|
|
180
|
+
* factory, then applies aliases to the resolved object.
|
|
181
|
+
*
|
|
182
|
+
* @param nextConfig The Next.js configuration object or `(phase, context)` factory
|
|
162
183
|
* @param options Optional configuration paths for schema and output files
|
|
163
|
-
* @returns The Next.js configuration object
|
|
184
|
+
* @returns The Next.js configuration object, or an async factory that resolves to it
|
|
164
185
|
* @throws An error if the schema file cannot be found or if code generation fails
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* export default withArkEnv({ reactStrictMode: true });
|
|
190
|
+
*
|
|
191
|
+
* export default withArkEnv(async (phase, { defaultConfig }) => ({
|
|
192
|
+
* ...defaultConfig,
|
|
193
|
+
* reactStrictMode: phase !== "phase-test",
|
|
194
|
+
* }));
|
|
195
|
+
* ```
|
|
165
196
|
*/
|
|
166
|
-
declare function withArkEnv<T>(nextConfig: T
|
|
197
|
+
declare function withArkEnv<T extends object>(nextConfig: NextConfigFactory<T>, options?: ArkEnvConfigOptions): (phase: string, context: NextConfigContext) => Promise<T>;
|
|
198
|
+
declare function withArkEnv<T extends object>(nextConfig: T, options?: ArkEnvConfigOptions): T;
|
|
167
199
|
//#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-
|
|
200
|
+
export { extractKeys as a, NextConfigContext as c, withArkEnv as i, NextConfigFactory as l, extractSharedKeys$1 as n, runCodegen as o, setupArkEnv as r, ArkEnvConfigOptions as s, extractClientKeys$1 as t };
|
|
201
|
+
//# sourceMappingURL=index-U5bfcjNW.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-U5bfcjNW.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;;;;KCFxF,iBAAA;EACX,aAAA;AAAA;;;;KAMW,iBAAA,+BACX,KAAA,UACA,OAAA,EAAS,iBAAA,KACL,CAAA,GAAI,OAAA,CAAQ,CAAA;;;;;;;;;;;KAYL,mBAAA;EDNgC;;;;AChB5C;;;;;AAOA;;;;EA6BC,UAAA;EA1BgB;;;;;;;;;;;;;AAYjB;;;EAgCC,UAAA;EAlBA;;;;;;;;EA4BA,MAAA;EA8CW;;;EAAA;;;AChCZ;;;;;;;;EDIC,QAAA;ECFA;;;;;EDSA,QAAA;ECNA;;;;;EDaA,OAAA;;AE0BD;;;;EFnBC,MAAA,GAAS,MAAA;EEoBT;;;;;EFbA,QAAA,GAAW,QAAA;AAAA;;;;;AD5GwF;;;;;AAMvF;;;;iBEsEG,UAAA,CACf,UAAA,UACA,UAAA,UACA,YAAA,GAAe,mBAAA,YACf,aAAA,YACA,UAAA,GAAa,IAAA,CAAK,mBAAA,0BAClB,WAAA;;;;;;AFlFmG;;;iBGwHpF,WAAA,CAAY,OAAA;EAC3B,UAAA;EACA,UAAA;EACA,QAAA;AAAA;;;KCjEI,WAAA;EACJ,cAAA;EACA,OAAA;EACA,aAAA;EACA,UAAA;AAAA;;AJxDY;;;;;;;iBImEG,WAAA,CACf,OAAA,GAAU,mBAAA,EACV,eAAA;EAAoB,YAAA,GAAe,MAAA;AAAA,IACjC,WAAA;;;;;;;;;;;;AH9EH;;;;;AAOA;;;;;;;iBGyWgB,UAAA,kBAAA,CACf,UAAA,EAAY,iBAAA,CAAkB,CAAA,GAC9B,OAAA,GAAU,mBAAA,IACP,KAAA,UAAe,OAAA,EAAS,iBAAA,KAAsB,OAAA,CAAQ,CAAA;AAAA,iBAC1C,UAAA,kBAAA,CACf,UAAA,EAAY,CAAA,EACZ,OAAA,GAAU,mBAAA,GACR,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./config-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./config-DNiuFUxj.cjs`);const e=require(`./arkenv-internal-QxkUlA5J.cjs`),t=require(`./script-iYGXywhf.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
|
package/dist/react-server.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./config-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./config-DNiuFUxj.cjs`);const e=require(`./arkenv-internal-QxkUlA5J.cjs`),t=require(`./script-iYGXywhf.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,!0,void 0,n.arkenv,n.getSchemaKeys):e.t(t,r,{isServer:!0},n.arkenv,n.getSchemaKeys)}exports.ArkEnvScript=t.t,exports.arkenv=r,exports.default=r;
|
|
2
2
|
//# sourceMappingURL=react-server.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require(`./config-
|
|
2
|
-
//# sourceMappingURL=script-
|
|
1
|
+
require(`./config-DNiuFUxj.cjs`);let e=require(`react/jsx-runtime`);function t({env:t}={}){let n={};if(typeof process<`u`&&process.env)for(let e of Object.keys(process.env))e.startsWith(`NEXT_PUBLIC_`)&&(n[e]=process.env[e]);if(t)for(let e of Object.keys(t))e.startsWith(`NEXT_PUBLIC_`)&&(n[e]=t[e]);return(0,e.jsx)(`script`,{id:`arkenv-script`,dangerouslySetInnerHTML:{__html:`globalThis.__arkenv_env__ = ${JSON.stringify(n).replace(/</g,`\\u003c`)};`}})}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
2
|
+
//# sourceMappingURL=script-iYGXywhf.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-
|
|
1
|
+
{"version":3,"file":"script-iYGXywhf.cjs","names":[],"sources":["../src/script.tsx"],"sourcesContent":["import type React from \"react\";\n\nexport type ArkEnvScriptProps = {\n\t/**\n\t * Optional custom environment variable map. If provided, any keys starting\n\t * with `NEXT_PUBLIC_` will be merged with public keys from `process.env`.\n\t */\n\tenv?: Record<string, string | undefined>;\n};\n\n/**\n * A React Component to serialize and inject NEXT_PUBLIC_* environment variables into the browser\n * during Server-Side Rendering (SSR). Placed in your root layout (layout.tsx), it sets\n * globalThis.__arkenv_env__ to ensure client-side components have access to runtime environment values.\n */\nexport function ArkEnvScript({\n\tenv,\n}: ArkEnvScriptProps = {}): React.ReactElement {\n\tconst publicEnv: Record<string, string | undefined> = {};\n\n\tif (typeof process !== \"undefined\" && process.env) {\n\t\tfor (const key of Object.keys(process.env)) {\n\t\t\tif (key.startsWith(\"NEXT_PUBLIC_\")) {\n\t\t\t\tpublicEnv[key] = process.env[key];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (env) {\n\t\tfor (const key of Object.keys(env)) {\n\t\t\tif (key.startsWith(\"NEXT_PUBLIC_\")) {\n\t\t\t\tpublicEnv[key] = env[key];\n\t\t\t}\n\t\t}\n\t}\n\n\tconst scriptContent = `globalThis.__arkenv_env__ = ${JSON.stringify(publicEnv).replace(/</g, \"\\\\u003c\")};`;\n\n\treturn (\n\t\t<script\n\t\t\tid=\"arkenv-script\"\n\t\t\tdangerouslySetInnerHTML={{ __html: scriptContent }}\n\t\t/>\n\t);\n}\n"],"mappings":"oEAeA,SAAgB,EAAa,CAC5B,OACsB,EAAE,CAAsB,CAC9C,IAAM,EAAgD,EAAE,CAExD,GAAI,OAAO,QAAY,KAAe,QAAQ,QACxC,IAAM,KAAO,OAAO,KAAK,QAAQ,IAAI,CACrC,EAAI,WAAW,eAAe,GACjC,EAAU,GAAO,QAAQ,IAAI,IAKhC,GAAI,MACE,IAAM,KAAO,OAAO,KAAK,EAAI,CAC7B,EAAI,WAAW,eAAe,GACjC,EAAU,GAAO,EAAI,IAOxB,OACC,EAAA,EAAA,KAAC,SAAD,CACC,GAAG,gBACH,wBAAyB,CAAE,OAAQ,+BALgB,KAAK,UAAU,EAAU,CAAC,QAAQ,KAAM,UAAU,CAAC,GAKpD,CACjD,CAAA"}
|
package/dist/server.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./config-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`./config-DNiuFUxj.cjs`);const e=require(`./arkenv-internal-QxkUlA5J.cjs`),t=require(`./strict-client-env-MouPnkRr.cjs`),n=require(`./auto-extend-CYzZnEvT.cjs`);let r=require(`@arkenv/core`);require(`server-only`);let i=require(`#arkenv/client-env`);function a(a,o){if(a&&typeof a==`object`&&(`runtimeEnv`in a||`server`in a||`shared`in a)){if(`client`in a)throw Error(`server entry point only accepts 'server' and 'shared' schemas.`);return e.t(a,!0,void 0,r.arkenv,r.getSchemaKeys)}return e.t(a,n.t(o,()=>t.i(i.env)),{isServer:!0,strictLayout:`server`},r.arkenv,r.getSchemaKeys)}exports.arkenv=a,exports.default=a;
|
|
2
2
|
//# sourceMappingURL=server.cjs.map
|
package/dist/standard/client.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../config-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../config-DNiuFUxj.cjs`);const e=require(`../arkenv-internal-QxkUlA5J.cjs`);let t=require(`@arkenv/standard`);function n(n,r){if(n&&typeof n==`object`&&(`runtimeEnv`in n||`client`in n||`shared`in n)){if(`server`in n)throw Error(`client entry point only accepts 'client' and 'shared' schemas.`);return e.t(n,!1,void 0,t.arkenv,t.getSchemaKeys)}return e.t(n,r,{isServer:!1},t.arkenv,t.getSchemaKeys)}exports.arkenv=n,exports.default=n;
|
|
2
2
|
//# sourceMappingURL=client.cjs.map
|
package/dist/standard/config.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../config-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../config-DNiuFUxj.cjs`);function t(t,n){return e.n(t,{...n,standard:!0})}exports.withArkEnv=t;
|
|
2
2
|
//# sourceMappingURL=config.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","names":["originalWithArkEnv"],"sources":["../../src/standard/config.ts"],"sourcesContent":["import {\n\ttype ArkEnvConfigOptions,\n\twithArkEnv as originalWithArkEnv,\n} from \"@/config\";\n\n/**\n * Wrap a Next.js configuration object to
|
|
1
|
+
{"version":3,"file":"config.cjs","names":["originalWithArkEnv"],"sources":["../../src/standard/config.ts"],"sourcesContent":["import {\n\ttype ArkEnvConfigOptions,\n\ttype NextConfigContext,\n\ttype NextConfigFactory,\n\twithArkEnv as originalWithArkEnv,\n} from \"@/config\";\n\n/**\n * Wrap a Next.js configuration object or function to generate `env.gen.ts` (Standard Mode).\n *\n * @param nextConfig The Next.js configuration object or `(phase, context)` factory\n * @param options Optional configuration paths for schema and output files\n * @returns The Next.js configuration object, or an async factory that resolves to it\n */\nexport function withArkEnv<T extends object>(\n\tnextConfig: NextConfigFactory<T>,\n\toptions?: ArkEnvConfigOptions,\n): (phase: string, context: NextConfigContext) => Promise<T>;\nexport function withArkEnv<T extends object>(\n\tnextConfig: T,\n\toptions?: ArkEnvConfigOptions,\n): T;\nexport function withArkEnv<T extends object>(\n\tnextConfig: T | NextConfigFactory<T>,\n\toptions?: ArkEnvConfigOptions,\n): T | ((phase: string, context: NextConfigContext) => Promise<T>) {\n\treturn originalWithArkEnv(nextConfig as T, {\n\t\t...options,\n\t\tstandard: true,\n\t}) as T | ((phase: string, context: NextConfigContext) => Promise<T>);\n}\n"],"mappings":"6GAsBA,SAAgB,EACf,EACA,EACkE,CAClE,OAAOA,EAAAA,EAAmB,EAAiB,CAC1C,GAAG,EACH,SAAU,GACV,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { s as ArkEnvConfigOptions } from "../index-
|
|
1
|
+
import { c as NextConfigContext, l as NextConfigFactory, s as ArkEnvConfigOptions } from "../index-BIewRgpQ.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/standard/config.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* Wrap a Next.js configuration object to
|
|
5
|
+
* Wrap a Next.js configuration object or function to generate `env.gen.ts` (Standard Mode).
|
|
6
6
|
*
|
|
7
|
-
* @param nextConfig The Next.js configuration object or
|
|
7
|
+
* @param nextConfig The Next.js configuration object or `(phase, context)` factory
|
|
8
8
|
* @param options Optional configuration paths for schema and output files
|
|
9
|
-
* @returns The Next.js configuration object
|
|
9
|
+
* @returns The Next.js configuration object, or an async factory that resolves to it
|
|
10
10
|
*/
|
|
11
|
-
declare function withArkEnv<T>(nextConfig: T
|
|
11
|
+
declare function withArkEnv<T extends object>(nextConfig: NextConfigFactory<T>, options?: ArkEnvConfigOptions): (phase: string, context: NextConfigContext) => Promise<T>;
|
|
12
|
+
declare function withArkEnv<T extends object>(nextConfig: T, options?: ArkEnvConfigOptions): T;
|
|
12
13
|
//#endregion
|
|
13
14
|
export { withArkEnv };
|
|
14
15
|
//# sourceMappingURL=config.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.cts","names":[],"sources":["../../src/standard/config.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"config.d.cts","names":[],"sources":["../../src/standard/config.ts"],"mappings":";;;;;AAcA;;;;;iBAAgB,UAAA,kBAAA,CACf,UAAA,EAAY,iBAAA,CAAkB,CAAA,GAC9B,OAAA,GAAU,mBAAA,IACP,KAAA,UAAe,OAAA,EAAS,iBAAA,KAAsB,OAAA,CAAQ,CAAA;AAAA,iBAC1C,UAAA,kBAAA,CACf,UAAA,EAAY,CAAA,EACZ,OAAA,GAAU,mBAAA,GACR,CAAA"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { s as ArkEnvConfigOptions } from "../index-
|
|
1
|
+
import { c as NextConfigContext, l as NextConfigFactory, s as ArkEnvConfigOptions } from "../index-U5bfcjNW.js";
|
|
2
2
|
|
|
3
3
|
//#region src/standard/config.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* Wrap a Next.js configuration object to
|
|
5
|
+
* Wrap a Next.js configuration object or function to generate `env.gen.ts` (Standard Mode).
|
|
6
6
|
*
|
|
7
|
-
* @param nextConfig The Next.js configuration object or
|
|
7
|
+
* @param nextConfig The Next.js configuration object or `(phase, context)` factory
|
|
8
8
|
* @param options Optional configuration paths for schema and output files
|
|
9
|
-
* @returns The Next.js configuration object
|
|
9
|
+
* @returns The Next.js configuration object, or an async factory that resolves to it
|
|
10
10
|
*/
|
|
11
|
-
declare function withArkEnv<T>(nextConfig: T
|
|
11
|
+
declare function withArkEnv<T extends object>(nextConfig: NextConfigFactory<T>, options?: ArkEnvConfigOptions): (phase: string, context: NextConfigContext) => Promise<T>;
|
|
12
|
+
declare function withArkEnv<T extends object>(nextConfig: T, options?: ArkEnvConfigOptions): T;
|
|
12
13
|
//#endregion
|
|
13
14
|
export { withArkEnv };
|
|
14
15
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","names":[],"sources":["../../src/standard/config.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"config.d.ts","names":[],"sources":["../../src/standard/config.ts"],"mappings":";;;;;AAcA;;;;;iBAAgB,UAAA,kBAAA,CACf,UAAA,EAAY,iBAAA,CAAkB,CAAA,GAC9B,OAAA,GAAU,mBAAA,IACP,KAAA,UAAe,OAAA,EAAS,iBAAA,KAAsB,OAAA,CAAQ,CAAA;AAAA,iBAC1C,UAAA,kBAAA,CACf,UAAA,EAAY,CAAA,EACZ,OAAA,GAAU,mBAAA,GACR,CAAA"}
|
package/dist/standard/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"../config-
|
|
1
|
+
import{i as e}from"../config-B9BksrZQ.js";function t(t,n){return e(t,{...n,standard:!0})}export{t as withArkEnv};
|
|
2
2
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["originalWithArkEnv"],"sources":["../../src/standard/config.ts"],"sourcesContent":["import {\n\ttype ArkEnvConfigOptions,\n\twithArkEnv as originalWithArkEnv,\n} from \"@/config\";\n\n/**\n * Wrap a Next.js configuration object to
|
|
1
|
+
{"version":3,"file":"config.js","names":["originalWithArkEnv"],"sources":["../../src/standard/config.ts"],"sourcesContent":["import {\n\ttype ArkEnvConfigOptions,\n\ttype NextConfigContext,\n\ttype NextConfigFactory,\n\twithArkEnv as originalWithArkEnv,\n} from \"@/config\";\n\n/**\n * Wrap a Next.js configuration object or function to generate `env.gen.ts` (Standard Mode).\n *\n * @param nextConfig The Next.js configuration object or `(phase, context)` factory\n * @param options Optional configuration paths for schema and output files\n * @returns The Next.js configuration object, or an async factory that resolves to it\n */\nexport function withArkEnv<T extends object>(\n\tnextConfig: NextConfigFactory<T>,\n\toptions?: ArkEnvConfigOptions,\n): (phase: string, context: NextConfigContext) => Promise<T>;\nexport function withArkEnv<T extends object>(\n\tnextConfig: T,\n\toptions?: ArkEnvConfigOptions,\n): T;\nexport function withArkEnv<T extends object>(\n\tnextConfig: T | NextConfigFactory<T>,\n\toptions?: ArkEnvConfigOptions,\n): T | ((phase: string, context: NextConfigContext) => Promise<T>) {\n\treturn originalWithArkEnv(nextConfig as T, {\n\t\t...options,\n\t\tstandard: true,\n\t}) as T | ((phase: string, context: NextConfigContext) => Promise<T>);\n}\n"],"mappings":"0CAsBA,SAAgB,EACf,EACA,EACkE,CAClE,OAAOA,EAAmB,EAAiB,CAC1C,GAAG,EACH,SAAU,GACV,CAAC"}
|
package/dist/standard/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../config-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../config-DNiuFUxj.cjs`);const e=require(`../arkenv-internal-QxkUlA5J.cjs`);let t=require(`@arkenv/standard`);function n(n,r){return n&&typeof n==`object`&&(`runtimeEnv`in n||`server`in n||`client`in n||`shared`in n)?e.t(n,!1,void 0,t.arkenv,t.getSchemaKeys):e.t(n,r,{isServer:!1},t.arkenv,t.getSchemaKeys)}exports.arkenv=n,exports.default=n;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/standard/server.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../config-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../config-DNiuFUxj.cjs`);const e=require(`../arkenv-internal-QxkUlA5J.cjs`),t=require(`../strict-client-env-MouPnkRr.cjs`),n=require(`../auto-extend-CYzZnEvT.cjs`);require(`server-only`);let r=require(`#arkenv/client-env`),i=require(`@arkenv/standard`);function a(a,o){if(a&&typeof a==`object`&&(`runtimeEnv`in a||`server`in a||`shared`in a)){if(`client`in a)throw Error(`server entry point only accepts 'server' and 'shared' schemas.`);return e.t(a,!0,void 0,i.arkenv,i.getSchemaKeys)}return e.t(a,n.t(o,()=>t.i(r.env)),{isServer:!0,strictLayout:`server`},i.arkenv,i.getSchemaKeys)}exports.arkenv=a,exports.default=a;
|
|
2
2
|
//# sourceMappingURL=server.cjs.map
|
package/dist/standard/shared.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../config-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../config-DNiuFUxj.cjs`);const e=require(`../arkenv-internal-QxkUlA5J.cjs`);let t=require(`@arkenv/standard`);function n(n,r){return e.t(n,r,{isServer:typeof window>`u`,isShared:!0},t.arkenv,t.getSchemaKeys)}exports.arkenv=n,exports.default=n;
|
|
2
2
|
//# sourceMappingURL=shared.cjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkenv/nextjs",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.13",
|
|
4
4
|
"author": "Yam Borodetsky <yam@yam.codes>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"tsdown": "0.21.10",
|
|
26
26
|
"typescript": "6.0.3",
|
|
27
27
|
"vitest": "4.1.5",
|
|
28
|
-
"@arkenv/core": "1.0.0-alpha.
|
|
29
|
-
"@arkenv/standard": "1.0.0-alpha.
|
|
28
|
+
"@arkenv/core": "1.0.0-alpha.7",
|
|
29
|
+
"@arkenv/standard": "1.0.0-alpha.7",
|
|
30
30
|
"@repo/log": "0.0.1",
|
|
31
31
|
"@repo/scope": "0.1.3",
|
|
32
32
|
"@repo/types": "0.1.0",
|
package/dist/config-Bnir9dSk.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./dist-DimRGXOV.js";import{r,t as i}from"./strict-client-env-CHDTZoLe.js";import{extractBlock as a,extractClientKeys as o,extractClientKeys as s,extractSharedKeys as c,extractSharedKeys as l,findSchemaPath as u,formatMissingSchemaError as d,parseBlockKeys as f,resolveLayout as p,watchSchema as m}from"@arkenv/build";import h from"node:fs";import g from"node:path";import{fileURLToPath as _}from"node:url";import{createJiti as v}from"jiti";function y(e){let t=e.match(/exposeToClient\s*:\s*\[([\s\S]*?)\]/)||e.match(/expose\s*:\s*\[([\s\S]*?)\]/)||e.match(/shared\s*:\s*\[([\s\S]*?)\]/);if(!t)return[];let n=[];for(let e of t[1].matchAll(/['"`](.*?)['"`]/g))n.push(e[1]);return n}function b(e){let t=/\b(?:arkenv|createEnv)\s*\(/g;for(;t.exec(e)!==null;){let n=1,r=t.lastIndex,i=null,a=null,o=0,s=0,c=[],l=``;for(;r<e.length&&n>0;){let t=e[r],u=e[r+1];if(a===`single`){(t===`
|
|
2
|
-
`||t===`\r`)&&(a=null),l+=t,r++;continue}if(a===`multi`){if(t===`*`&&u===`/`){a=null,l+=`*/`,r+=2;continue}l+=t,r++;continue}if(i){t===i&&e[r-1]!==`\\`&&(i=null),l+=t,r++;continue}if(t===`/`&&u===`/`){a=`single`,l+=`//`,r+=2;continue}if(t===`/`&&u===`*`){a=`multi`,l+=`/*`,r+=2;continue}if(t===`'`||t===`"`||t==="`"){i=t,l+=t,r++;continue}if(t===`(`?n++:t===`)`?n--:t===`{`?o++:t===`}`?o--:t===`[`?s++:t===`]`&&s--,n===0){c.push(l);break}t===`,`&&n===1&&o===0&&s===0?(c.push(l),l=``):l+=t,r++}if(n===0&&c.length>0)return{schemaArg:c[0].trim(),optionsArg:c[1]?c[1].trim():null}}return null}function x(e){let t=[],n=[],r=b(e);if(!r)return{clientKeys:t,sharedKeys:n,isLegacy:!1};let i=f(r.schemaArg.replace(/^\{/,``).replace(/\}$/,``).trim()),o=i.includes(`client`)||i.includes(`server`)||i.includes(`shared`);if(o){let e=a(r.schemaArg,`client`);e&&t.push(...f(e));let i=a(r.schemaArg,`shared`);return i&&n.push(...f(i)),{clientKeys:t,sharedKeys:n,isLegacy:o}}let s=r.optionsArg?y(r.optionsArg):[];for(let e of i){if(s.includes(e)||e===`NODE_ENV`){n.push(e);continue}e.startsWith(`NEXT_PUBLIC_`)&&t.push(e)}return{clientKeys:t,sharedKeys:n,isLegacy:o}}function S(e,t){return Array.from(new Set([...e,...t])).map(e=>`\t\t\t${e}: typeof window !== "undefined" ? (globalThis as any).__arkenv_env__?.${e} ?? process.env.${e} : process.env.${e},`).join(`
|
|
3
|
-
`)}const C=`/* eslint-disable */
|
|
4
|
-
// biome-ignore format: auto-generated
|
|
5
|
-
// Generated by ArkEnv. DO NOT EDIT DIRECTLY.
|
|
6
|
-
`,w=`
|
|
7
|
-
export default arkenv;
|
|
8
|
-
`;function T(e,t,n){let r=S(e,t);return`${C}
|
|
9
|
-
import { arkenv as coreArkenv } from "${n?`@arkenv/nextjs/standard`:`@arkenv/nextjs`}";
|
|
10
|
-
|
|
11
|
-
export function arkenv<
|
|
12
|
-
const TServer extends Record<string, any> = {},
|
|
13
|
-
const TClient extends Record<string, any> = {},
|
|
14
|
-
const TShared extends Record<string, any> = {},
|
|
15
|
-
>(options: {
|
|
16
|
-
server?: TServer;
|
|
17
|
-
client?: TClient & {
|
|
18
|
-
[K in keyof TClient]: K extends \`NEXT_PUBLIC_\${string}\` ? unknown : never;
|
|
19
|
-
};
|
|
20
|
-
shared?: TShared;
|
|
21
|
-
}) {
|
|
22
|
-
return coreArkenv({
|
|
23
|
-
...options,
|
|
24
|
-
runtimeEnv: {
|
|
25
|
-
${r}
|
|
26
|
-
},
|
|
27
|
-
} as any) as any;
|
|
28
|
-
}
|
|
29
|
-
${w}`}function E(e,t,n){let r=S(e,t);return`${C}
|
|
30
|
-
import { arkenv as coreArkenv } from "${n?`@arkenv/nextjs/standard`:`@arkenv/nextjs`}";${n?``:`
|
|
31
|
-
import type { type as at, distill } from "arktype";`}
|
|
32
|
-
|
|
33
|
-
export function arkenv<
|
|
34
|
-
const TSchema extends Record<string, unknown> & { runtimeEnv?: never } = {},
|
|
35
|
-
const TExpose extends keyof TSchema = never,
|
|
36
|
-
const TExtends extends readonly unknown[] = [],
|
|
37
|
-
>(
|
|
38
|
-
schema: TSchema,
|
|
39
|
-
options?: {
|
|
40
|
-
/**
|
|
41
|
-
* Custom environment variables to expose to the client bundle.
|
|
42
|
-
* By default, variables prefixed with \`NEXT_PUBLIC_\` and \`NODE_ENV\` are exposed automatically.
|
|
43
|
-
* Use this option to expose custom variables that do not have the \`NEXT_PUBLIC_\` prefix.
|
|
44
|
-
*/
|
|
45
|
-
exposeToClient?: readonly TExpose[];
|
|
46
|
-
extends?: [...TExtends];
|
|
47
|
-
},
|
|
48
|
-
): ${n?`Readonly<TSchema>`:`Readonly<distill.Out<at.infer<TSchema>>>`} {
|
|
49
|
-
const env = coreArkenv(schema as any, {
|
|
50
|
-
...options,
|
|
51
|
-
runtimeEnv: {
|
|
52
|
-
${r}
|
|
53
|
-
},
|
|
54
|
-
} as any);
|
|
55
|
-
return env${n?``:` as unknown as Readonly<distill.Out<at.infer<TSchema>>>`};
|
|
56
|
-
}
|
|
57
|
-
${w}`}function D(){return`${C}
|
|
58
|
-
declare module "#arkenv/client-env" {
|
|
59
|
-
export { env } from "../client";
|
|
60
|
-
}
|
|
61
|
-
`}function O(e,t,n){let r=S(e,t);return`${C}
|
|
62
|
-
import { arkenv as coreArkenv } from "${n?`@arkenv/nextjs/standard/client`:`@arkenv/nextjs/client`}";${n?``:`
|
|
63
|
-
import type { Infer } from "@arkenv/core";`}
|
|
64
|
-
|
|
65
|
-
type ResolveExtend<T> = [Infer<T>] extends [never] ? T : Infer<T>;
|
|
66
|
-
|
|
67
|
-
type UnionToIntersection<U> = (
|
|
68
|
-
U extends any ? (k: U) => void : never
|
|
69
|
-
) extends (k: infer I) => void
|
|
70
|
-
? I
|
|
71
|
-
: never;
|
|
72
|
-
|
|
73
|
-
type MergeExtends<TExtends extends readonly unknown[] | undefined> =
|
|
74
|
-
TExtends extends readonly unknown[]
|
|
75
|
-
? UnionToIntersection<ResolveExtend<TExtends[number]>>
|
|
76
|
-
: {};
|
|
77
|
-
|
|
78
|
-
export function arkenv<
|
|
79
|
-
const TSchema extends Record<string, any> = {},
|
|
80
|
-
const TExtends extends readonly unknown[] = [],
|
|
81
|
-
>(
|
|
82
|
-
schema: TSchema & {
|
|
83
|
-
[K in keyof TSchema]: K extends \`NEXT_PUBLIC_\${string}\` ? unknown : never;
|
|
84
|
-
},
|
|
85
|
-
options?: {
|
|
86
|
-
extends?: [...TExtends];
|
|
87
|
-
},
|
|
88
|
-
): ${n?`Readonly<TSchema & MergeExtends<TExtends>>`:`Readonly<Infer<TSchema> & MergeExtends<TExtends>>`} {
|
|
89
|
-
return coreArkenv(schema as any, {
|
|
90
|
-
...options,
|
|
91
|
-
runtimeEnv: {
|
|
92
|
-
${r}
|
|
93
|
-
},
|
|
94
|
-
} as any);
|
|
95
|
-
}
|
|
96
|
-
${w}`}let k=!1;function A(e,t){return e===`flat`?`simple`:e===`simple`?process.env.NODE_ENV!==`development`||k?`simple`:(k=!0,t.logBuildWarning(`The 'simple' layout option is deprecated and will be removed in the next major version. Use 'flat' instead.`),`simple`):e}function j(e,t){return t?!0:e.includes(`@arkenv/standard`)||e.includes(`arkenv/standard`)}function M(t,n,r,i,a){let{layout:s,baseDir:l}=p(t,A(r,e(a))),u=``;if(s===`strict`){let e=g.join(l,`client.ts`),t=g.join(l,`internal`,`shared.ts`),n=h.existsSync(e)?h.readFileSync(e,`utf-8`):``,r=h.existsSync(t)?h.readFileSync(t,`utf-8`):``,a=j(n,i)||j(r,i);u=O(o(n),c(r),a)}else{let e=h.readFileSync(t,`utf-8`),n=j(e,i),{clientKeys:r,sharedKeys:a,isLegacy:o}=x(e);u=o?T(r,a,n):E(r,a,n)}let d=g.dirname(n);h.existsSync(d)||h.mkdirSync(d,{recursive:!0});let f=!0;if(h.existsSync(n)&&h.readFileSync(n,`utf-8`)===u&&(f=!1),f&&h.writeFileSync(n,u,`utf-8`),s===`strict`&&l){let e=g.join(g.dirname(n),`arkenv-client-env.d.ts`),t=D(),r=!0;h.existsSync(e)&&h.readFileSync(e,`utf-8`)===t&&(r=!1),r&&h.writeFileSync(e,t,`utf-8`)}}function N(e,t,n){if(Array.isArray(e)){let r=e.filter(e=>e.name!==t);return r.push({name:t,alias:n}),r}return{...e??{},[t]:n}}function P(e,t,n=`#arkenv/client-env`){let r=e.webpack,i=(e,i)=>{let a=r?r(e,i)??e:e;a.resolve=a.resolve??{},a.resolve.alias=N(a.resolve.alias,n,t);let o=i.webpack?.DefinePlugin;return o&&(a.plugins=a.plugins??[],a.plugins.push(new o({__ARKENV_STRICT_LAYOUT__:JSON.stringify(!0)}))),a},a=g.isAbsolute(t)?`./${g.relative(process.cwd(),t).replace(/\\/g,`/`)}`:t.startsWith(`.`)?t:`./${t}`,o=e.turbopack??{},s={...o.resolveAlias??{},[n]:a},c=e.experimental,l=c?{...c,...c.turbo?{turbo:{...c.turbo,resolveAlias:{...c.turbo.resolveAlias??{},[n]:a}}}:{}}:void 0,u={...e,webpack:i,env:{...e.env??{},ARKENV_STRICT_LAYOUT:`true`},turbopack:{...o,resolveAlias:s}};return l&&(u.experimental=l),u}function F(e){for(let t of[e,g.join(e,`..`)]){let e=g.join(t,`mock-server-only.ts`);if(h.existsSync(e))return e;let n=g.join(t,`mock-server-only.js`);if(h.existsSync(n))return n}return g.join(e,`mock-server-only.js`)}function I(e){for(let t of[e,g.join(e,`..`)]){let e=g.join(t,`empty-client-env.ts`);if(h.existsSync(e))return e;let n=g.join(t,`empty-client-env.js`);if(h.existsSync(n))return n}return g.join(e,`empty-client-env.js`)}function L(e){if(h.existsSync(e))return!0;let t=g.extname(e);if(!t)return!1;let n=e.slice(0,-t.length);return h.existsSync(n)}function R(a,o){let s=e(a),c=a?.schemaPath?g.resolve(a.schemaPath):u();if(!c||!L(c))throw Error(d({schemaPath:a?.schemaPath,optionsHint:`setupArkEnv options`}));let{layout:l,baseDir:f}=p(c,A(a?.layout,s)),y=l===`strict`&&f?g.join(f,`client.ts`):void 0;if(y&&!h.existsSync(y))throw Error(r(y,f));let b=l===`strict`&&f?f:g.dirname(c),x=g.join(b,`generated`,`env.gen.ts`),S=a?.outputPath?g.resolve(a.outputPath):x,C=a?.codegen??!0;if(C)try{M(c,S,l,a?.standard,a)}catch(e){let n=e instanceof Error?e.message:String(e);throw Error(t(`Failed to generate env.gen.ts: ${n}`))}if(a?.validate??!0){let e=globalThis;try{e.__arkenv_force_server__=!0;let t=l===`strict`&&f?g.join(f,`server.ts`):c,n=typeof __filename<`u`?__filename:import.meta.url?_(import.meta.url):``,r=g.dirname(n),a=F(r),s=I(r),u=v(t,{moduleCache:!1,fsCache:!1,tsconfigPaths:!0,alias:{"server-only":a,"./script":a,"./script.tsx":a,[i]:y&&h.existsSync(y)?y:s,...o?._jitiAliases}});if(l===`strict`&&y){e.__ARKENV_STRICT_LAYOUT__=!0;let t=u(y);e.__ARKENV_CLIENT_ENV__=t.env??t.default?.env??t}u(t)}catch(e){s.logBuildError(`Environment validation failed:`),s.logBuildErrorDetail(e instanceof Error?e.message:String(e)),s.logBuildErrorBlankLine(),process.exit(1)}finally{delete e.__arkenv_force_server__,delete e.__ARKENV_STRICT_LAYOUT__,delete e.__ARKENV_CLIENT_ENV__}}return(process.env.NODE_ENV===`development`||process.env.NEXT_PHASE===`phase-development-server`)&&C&&m(l===`strict`&&f?[g.join(f,`internal`,`shared.ts`),g.join(f,`client.ts`),g.join(f,`server.ts`)].filter(h.existsSync):[c],()=>{M(c,S,l,a?.standard,a)},n(a)),{resolvedLayout:l,baseDir:f,clientEnvPath:y}}function z(e,t){let{resolvedLayout:n,clientEnvPath:r}=R(t);return n===`strict`&&r?P(e,r,i):e}export{M as a,z as i,l as n,x as o,R as r,s as t};
|
|
97
|
-
//# sourceMappingURL=config-Bnir9dSk.js.map
|