@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,97 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./dist-Bof1Std7.cjs`),l=require(`./strict-client-env-MouPnkRr.cjs`);let u=require(`@arkenv/build`),d=require(`node:fs`);d=s(d,1);let f=require(`node:path`);f=s(f,1);let p=require(`node:url`),m=require(`jiti`);function h(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 g(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 _(e){let t=[],n=[],r=g(e);if(!r)return{clientKeys:t,sharedKeys:n,isLegacy:!1};let i=(0,u.parseBlockKeys)(r.schemaArg.replace(/^\{/,``).replace(/\}$/,``).trim()),a=i.includes(`client`)||i.includes(`server`)||i.includes(`shared`);if(a){let e=(0,u.extractBlock)(r.schemaArg,`client`);e&&t.push(...(0,u.parseBlockKeys)(e));let i=(0,u.extractBlock)(r.schemaArg,`shared`);return i&&n.push(...(0,u.parseBlockKeys)(i)),{clientKeys:t,sharedKeys:n,isLegacy:a}}let o=r.optionsArg?h(r.optionsArg):[];for(let e of i){if(o.includes(e)||e===`NODE_ENV`){n.push(e);continue}e.startsWith(`NEXT_PUBLIC_`)&&t.push(e)}return{clientKeys:t,sharedKeys:n,isLegacy:a}}function v(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 y=`/* eslint-disable */
4
+ // biome-ignore format: auto-generated
5
+ // Generated by ArkEnv. DO NOT EDIT DIRECTLY.
6
+ `,b=`
7
+ export default arkenv;
8
+ `;function x(e,t,n){let r=v(e,t);return`${y}
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
+ ${b}`}function S(e,t,n){let r=v(e,t);return`${y}
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
+ ${b}`}function C(){return`${y}
58
+ declare module "#arkenv/client-env" {
59
+ export { env } from "../client";
60
+ }
61
+ `}function w(e,t,n){let r=v(e,t);return`${y}
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
+ ${b}`}let T=!1;function E(e,t){return e===`flat`?`simple`:e===`simple`?process.env.NODE_ENV!==`development`||T?`simple`:(T=!0,t.logBuildWarning(`The 'simple' layout option is deprecated and will be removed in the next major version. Use 'flat' instead.`),`simple`):e}function D(e,t){return t?!0:e.includes(`@arkenv/standard`)||e.includes(`arkenv/standard`)}function O(e,t,n,r,i){let{layout:a,baseDir:o}=(0,u.resolveLayout)(e,E(n,c.n(i))),s=``;if(a===`strict`){let e=f.default.join(o,`client.ts`),t=f.default.join(o,`internal`,`shared.ts`),n=d.default.existsSync(e)?d.default.readFileSync(e,`utf-8`):``,i=d.default.existsSync(t)?d.default.readFileSync(t,`utf-8`):``,a=D(n,r)||D(i,r);s=w((0,u.extractClientKeys)(n),(0,u.extractSharedKeys)(i),a)}else{let t=d.default.readFileSync(e,`utf-8`),n=D(t,r),{clientKeys:i,sharedKeys:a,isLegacy:o}=_(t);s=o?x(i,a,n):S(i,a,n)}let l=f.default.dirname(t);d.default.existsSync(l)||d.default.mkdirSync(l,{recursive:!0});let p=!0;if(d.default.existsSync(t)&&d.default.readFileSync(t,`utf-8`)===s&&(p=!1),p&&d.default.writeFileSync(t,s,`utf-8`),a===`strict`&&o){let e=f.default.join(f.default.dirname(t),`arkenv-client-env.d.ts`),n=C(),r=!0;d.default.existsSync(e)&&d.default.readFileSync(e,`utf-8`)===n&&(r=!1),r&&d.default.writeFileSync(e,n,`utf-8`)}}function k(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 A(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=k(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=f.default.isAbsolute(t)?`./${f.default.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 j(e){for(let t of[e,f.default.join(e,`..`)]){let e=f.default.join(t,`mock-server-only.ts`);if(d.default.existsSync(e))return e;let n=f.default.join(t,`mock-server-only.js`);if(d.default.existsSync(n))return n}return f.default.join(e,`mock-server-only.js`)}function M(e){for(let t of[e,f.default.join(e,`..`)]){let e=f.default.join(t,`empty-client-env.ts`);if(d.default.existsSync(e))return e;let n=f.default.join(t,`empty-client-env.js`);if(d.default.existsSync(n))return n}return f.default.join(e,`empty-client-env.js`)}function N(e){if(d.default.existsSync(e))return!0;let t=f.default.extname(e);if(!t)return!1;let n=e.slice(0,-t.length);return d.default.existsSync(n)}function P(e,t){let n=c.n(e),r=e?.schemaPath?f.default.resolve(e.schemaPath):(0,u.findSchemaPath)();if(!r||!N(r))throw Error((0,u.formatMissingSchemaError)({schemaPath:e?.schemaPath,optionsHint:`setupArkEnv options`}));let{layout:i,baseDir:a}=(0,u.resolveLayout)(r,E(e?.layout,n)),o=i===`strict`&&a?f.default.join(a,`client.ts`):void 0;if(o&&!d.default.existsSync(o))throw Error(l.r(o,a));let s=i===`strict`&&a?a:f.default.dirname(r),h=f.default.join(s,`generated`,`env.gen.ts`),g=e?.outputPath?f.default.resolve(e.outputPath):h,_=e?.codegen??!0;if(_)try{O(r,g,i,e?.standard,e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(c.r(`Failed to generate env.gen.ts: ${t}`))}if(e?.validate??!0){let e=globalThis;try{e.__arkenv_force_server__=!0;let n=i===`strict`&&a?f.default.join(a,`server.ts`):r,s=typeof __filename<`u`?__filename:require(`url`).pathToFileURL(__filename).href?(0,p.fileURLToPath)(require(`url`).pathToFileURL(__filename).href):``,c=f.default.dirname(s),u=j(c),h=M(c),g=(0,m.createJiti)(n,{moduleCache:!1,fsCache:!1,tsconfigPaths:!0,alias:{"server-only":u,"./script":u,"./script.tsx":u,[l.t]:o&&d.default.existsSync(o)?o:h,...t?._jitiAliases}});if(i===`strict`&&o){e.__ARKENV_STRICT_LAYOUT__=!0;let t=g(o);e.__ARKENV_CLIENT_ENV__=t.env??t.default?.env??t}g(n)}catch(e){n.logBuildError(`Environment validation failed:`),n.logBuildErrorDetail(e instanceof Error?e.message:String(e)),n.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`)&&_&&(0,u.watchSchema)(i===`strict`&&a?[f.default.join(a,`internal`,`shared.ts`),f.default.join(a,`client.ts`),f.default.join(a,`server.ts`)].filter(d.default.existsSync):[r],()=>{O(r,g,i,e?.standard,e)},c.t(e)),{resolvedLayout:i,baseDir:a,clientEnvPath:o}}function F(e,t){let{resolvedLayout:n,clientEnvPath:r}=P(t);return n===`strict`&&r?A(e,r,l.t):e}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return P}});
97
+ //# sourceMappingURL=config-CU-9fwxw.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-CU-9fwxw.cjs","names":["resolveBuildLog","path","fs","path","path","fs","resolveBuildLog","missingClientTsError","formatBuildError","jiti","CLIENT_ENV_SPECIFIER","resolveLoggerFromOptions"],"sources":["../src/config/extract.ts","../src/config/generate.ts","../src/config/layout.ts","../src/config/codegen.ts","../src/config/strict-layout-aliases.ts","../src/config/setup.ts"],"sourcesContent":["import { extractBlock, parseBlockKeys } from \"@arkenv/build\";\n\nfunction parseExposeKeys(optionsArg: string): string[] {\n\tconst exposeMatch =\n\t\toptionsArg.match(/exposeToClient\\s*:\\s*\\[([\\s\\S]*?)\\]/) ||\n\t\toptionsArg.match(/expose\\s*:\\s*\\[([\\s\\S]*?)\\]/) ||\n\t\toptionsArg.match(/shared\\s*:\\s*\\[([\\s\\S]*?)\\]/);\n\tif (!exposeMatch) return [];\n\n\tconst keys: string[] = [];\n\tfor (const match of exposeMatch[1].matchAll(/['\"`](.*?)['\"`]/g)) {\n\t\tkeys.push(match[1]);\n\t}\n\treturn keys;\n}\n\nfunction extractCallArguments(\n\tcontent: string,\n): { schemaArg: string; optionsArg: string | null } | null {\n\tconst regex = /\\b(?:arkenv|createEnv)\\s*\\(/g;\n\twhile (regex.exec(content) !== null) {\n\t\tlet parenCount = 1;\n\t\tlet index = regex.lastIndex;\n\t\tlet inString: string | null = null;\n\t\tlet inComment: \"single\" | \"multi\" | null = null;\n\t\tlet braceCount = 0;\n\t\tlet bracketCount = 0;\n\n\t\tconst args: string[] = [];\n\t\tlet currentArg = \"\";\n\n\t\twhile (index < content.length && parenCount > 0) {\n\t\t\tconst char = content[index];\n\t\t\tconst nextChar = content[index + 1];\n\n\t\t\tif (inComment === \"single\") {\n\t\t\t\tif (char === \"\\n\" || char === \"\\r\") inComment = null;\n\t\t\t\tcurrentArg += char;\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (inComment === \"multi\") {\n\t\t\t\tif (char === \"*\" && nextChar === \"/\") {\n\t\t\t\t\tinComment = null;\n\t\t\t\t\tcurrentArg += \"*/\";\n\t\t\t\t\tindex += 2;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcurrentArg += char;\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (inString) {\n\t\t\t\tif (char === inString && content[index - 1] !== \"\\\\\") {\n\t\t\t\t\tinString = null;\n\t\t\t\t}\n\t\t\t\tcurrentArg += char;\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (char === \"/\" && nextChar === \"/\") {\n\t\t\t\tinComment = \"single\";\n\t\t\t\tcurrentArg += \"//\";\n\t\t\t\tindex += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \"/\" && nextChar === \"*\") {\n\t\t\t\tinComment = \"multi\";\n\t\t\t\tcurrentArg += \"/*\";\n\t\t\t\tindex += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \"'\" || char === '\"' || char === \"`\") {\n\t\t\t\tinString = char;\n\t\t\t\tcurrentArg += char;\n\t\t\t\tindex++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (char === \"(\") {\n\t\t\t\tparenCount++;\n\t\t\t} else if (char === \")\") {\n\t\t\t\tparenCount--;\n\t\t\t} else if (char === \"{\") {\n\t\t\t\tbraceCount++;\n\t\t\t} else if (char === \"}\") {\n\t\t\t\tbraceCount--;\n\t\t\t} else if (char === \"[\") {\n\t\t\t\tbracketCount++;\n\t\t\t} else if (char === \"]\") {\n\t\t\t\tbracketCount--;\n\t\t\t}\n\n\t\t\tif (parenCount === 0) {\n\t\t\t\targs.push(currentArg);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tchar === \",\" &&\n\t\t\t\tparenCount === 1 &&\n\t\t\t\tbraceCount === 0 &&\n\t\t\t\tbracketCount === 0\n\t\t\t) {\n\t\t\t\targs.push(currentArg);\n\t\t\t\tcurrentArg = \"\";\n\t\t\t} else {\n\t\t\t\tcurrentArg += char;\n\t\t\t}\n\t\t\tindex++;\n\t\t}\n\n\t\tif (parenCount === 0 && args.length > 0) {\n\t\t\treturn {\n\t\t\t\tschemaArg: args[0].trim(),\n\t\t\t\toptionsArg: args[1] ? args[1].trim() : null,\n\t\t\t};\n\t\t}\n\t}\n\treturn null;\n}\n\n/**\n * Statically extract client and shared keys from the schema content.\n *\n * @param content The schema file string content\n * @returns An object containing the extracted client and shared keys\n */\nexport function extractKeys(content: string): {\n\tclientKeys: string[];\n\tsharedKeys: string[];\n\tisLegacy?: boolean;\n} {\n\tconst clientKeys: string[] = [];\n\tconst sharedKeys: string[] = [];\n\n\tconst args = extractCallArguments(content);\n\tif (!args) {\n\t\treturn { clientKeys, sharedKeys, isLegacy: false };\n\t}\n\n\tconst trimmedSchema = args.schemaArg\n\t\t.replace(/^\\{/, \"\")\n\t\t.replace(/\\}$/, \"\")\n\t\t.trim();\n\tconst topKeys = parseBlockKeys(trimmedSchema);\n\tconst isLegacy =\n\t\ttopKeys.includes(\"client\") ||\n\t\ttopKeys.includes(\"server\") ||\n\t\ttopKeys.includes(\"shared\");\n\n\tif (isLegacy) {\n\t\tconst clientBlock = extractBlock(args.schemaArg, \"client\");\n\t\tif (clientBlock) clientKeys.push(...parseBlockKeys(clientBlock));\n\t\tconst sharedBlock = extractBlock(args.schemaArg, \"shared\");\n\t\tif (sharedBlock) sharedKeys.push(...parseBlockKeys(sharedBlock));\n\t\treturn { clientKeys, sharedKeys, isLegacy };\n\t}\n\n\tconst optionExposedKeys = args.optionsArg\n\t\t? parseExposeKeys(args.optionsArg)\n\t\t: [];\n\n\tfor (const key of topKeys) {\n\t\tif (optionExposedKeys.includes(key) || key === \"NODE_ENV\") {\n\t\t\tsharedKeys.push(key);\n\t\t\tcontinue;\n\t\t}\n\t\tif (key.startsWith(\"NEXT_PUBLIC_\")) {\n\t\t\tclientKeys.push(key);\n\t\t}\n\t}\n\n\treturn { clientKeys, sharedKeys, isLegacy };\n}\n","function generateRuntimeEnvLines(\n\tclientKeys: string[],\n\tsharedKeys: string[],\n): string {\n\tconst allKeys = Array.from(new Set([...clientKeys, ...sharedKeys]));\n\treturn allKeys\n\t\t.map(\n\t\t\t(key) =>\n\t\t\t\t`\\t\\t\\t${key}: typeof window !== \"undefined\" ? (globalThis as any).__arkenv_env__?.${key} ?? process.env.${key} : process.env.${key},`,\n\t\t)\n\t\t.join(\"\\n\");\n}\n\nconst GENERATED_HEADER = `/* eslint-disable */\n// biome-ignore format: auto-generated\n// Generated by ArkEnv. DO NOT EDIT DIRECTLY.\n`;\n\nconst GENERATED_FOOTER = `\nexport default arkenv;\n`;\n\nexport function generateFactoryCode(\n\tclientKeys: string[],\n\tsharedKeys: string[],\n\tisStandard?: boolean,\n): string {\n\tconst runtimeEnvLines = generateRuntimeEnvLines(clientKeys, sharedKeys);\n\tconst importPath = isStandard ? \"@arkenv/nextjs/standard\" : \"@arkenv/nextjs\";\n\tconst coreName = \"arkenv\";\n\tconst callPrefix = \"coreArkenv\";\n\n\treturn `${GENERATED_HEADER}\nimport { ${coreName} as coreArkenv } from \"${importPath}\";\n\nexport function arkenv<\n\tconst TServer extends Record<string, any> = {},\n\tconst TClient extends Record<string, any> = {},\n\tconst TShared extends Record<string, any> = {},\n>(options: {\n\tserver?: TServer;\n\tclient?: TClient & {\n\t\t[K in keyof TClient]: K extends \\`NEXT_PUBLIC_\\${string}\\` ? unknown : never;\n\t};\n\tshared?: TShared;\n}) {\n\treturn ${callPrefix}({\n\t\t...options,\n\t\truntimeEnv: {\n\t\t\t${runtimeEnvLines}\n\t\t},\n\t} as any) as any;\n}\n${GENERATED_FOOTER}`;\n}\n\nexport function generateFlatFactoryCode(\n\tclientKeys: string[],\n\tsharedKeys: string[],\n\tisStandard?: boolean,\n): string {\n\tconst runtimeEnvLines = generateRuntimeEnvLines(clientKeys, sharedKeys);\n\tconst importPath = isStandard ? \"@arkenv/nextjs/standard\" : \"@arkenv/nextjs\";\n\tconst coreName = \"arkenv\";\n\tconst typeImport = isStandard\n\t\t? \"\"\n\t\t: '\\nimport type { type as at, distill } from \"arktype\";';\n\tconst returnType = isStandard\n\t\t? \"Readonly<TSchema>\"\n\t\t: \"Readonly<distill.Out<at.infer<TSchema>>>\";\n\tconst castReturn = isStandard\n\t\t? \"\"\n\t\t: \" as unknown as Readonly<distill.Out<at.infer<TSchema>>>\";\n\tconst callPrefix = \"coreArkenv\";\n\n\treturn `${GENERATED_HEADER}\nimport { ${coreName} as coreArkenv } from \"${importPath}\";${typeImport}\n\nexport function arkenv<\n\tconst TSchema extends Record<string, unknown> & { runtimeEnv?: never } = {},\n\tconst TExpose extends keyof TSchema = never,\n\tconst TExtends extends readonly unknown[] = [],\n>(\n\tschema: 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\textends?: [...TExtends];\n\t},\n): ${returnType} {\n\tconst env = ${callPrefix}(schema as any, {\n\t\t...options,\n\t\truntimeEnv: {\n\t\t\t${runtimeEnvLines}\n\t\t},\n\t} as any);\n\treturn env${castReturn};\n}\n${GENERATED_FOOTER}`;\n}\n\n/**\n * Ambient module declaration so `#arkenv/client-env` resolves to the project's\n * `env/client.ts` for `AutoClientEnv` type inference on `@arkenv/nextjs/server`.\n *\n * @returns Generated `.d.ts` source\n */\nexport function generateClientEnvAmbientDeclaration(): string {\n\treturn `${GENERATED_HEADER}\ndeclare module \"#arkenv/client-env\" {\n\texport { env } from \"../client\";\n}\n`;\n}\n\nexport function generateClientFactoryCode(\n\tclientKeys: string[],\n\tsharedKeys: string[],\n\tisStandard?: boolean,\n): string {\n\tconst runtimeEnvLines = generateRuntimeEnvLines(clientKeys, sharedKeys);\n\tconst importPath = isStandard\n\t\t? \"@arkenv/nextjs/standard/client\"\n\t\t: \"@arkenv/nextjs/client\";\n\tconst coreName = \"arkenv\";\n\tconst typeImport = isStandard\n\t\t? \"\"\n\t\t: '\\nimport type { Infer } from \"@arkenv/core\";';\n\tconst callPrefix = \"coreArkenv\";\n\tconst returnType = isStandard\n\t\t? \"Readonly<TSchema & MergeExtends<TExtends>>\"\n\t\t: \"Readonly<Infer<TSchema> & MergeExtends<TExtends>>\";\n\n\treturn `${GENERATED_HEADER}\nimport { ${coreName} as coreArkenv } from \"${importPath}\";${typeImport}\n\ntype ResolveExtend<T> = [Infer<T>] extends [never] ? T : Infer<T>;\n\ntype UnionToIntersection<U> = (\n\tU extends any ? (k: U) => void : never\n) extends (k: infer I) => void\n\t? I\n\t: never;\n\ntype MergeExtends<TExtends extends readonly unknown[] | undefined> =\n\tTExtends extends readonly unknown[]\n\t\t? UnionToIntersection<ResolveExtend<TExtends[number]>>\n\t\t: {};\n\nexport function arkenv<\n\tconst TSchema extends Record<string, any> = {},\n\tconst TExtends extends readonly unknown[] = [],\n>(\n\tschema: TSchema & {\n\t\t[K in keyof TSchema]: K extends \\`NEXT_PUBLIC_\\${string}\\` ? unknown : never;\n\t},\n\toptions?: {\n\t\textends?: [...TExtends];\n\t},\n): ${returnType} {\n\treturn ${callPrefix}(schema as any, {\n\t\t...options,\n\t\truntimeEnv: {\n\t\t\t${runtimeEnvLines}\n\t\t},\n\t} as any);\n}\n${GENERATED_FOOTER}`;\n}\n","import type { BuildLogHelpers } from \"@repo/log\";\nimport type { ArkEnvConfigOptions } from \"./types\";\n\nlet hasWarnedSimpleLayout = false;\n\nexport function normalizeLayout(\n\tlayout: ArkEnvConfigOptions[\"layout\"],\n\tbuildLog: BuildLogHelpers,\n): \"simple\" | \"strict\" | undefined {\n\tif (layout === \"flat\") return \"simple\";\n\tif (layout !== \"simple\") return layout;\n\n\tconst isDev = process.env.NODE_ENV === \"development\";\n\tif (!isDev || hasWarnedSimpleLayout) return \"simple\";\n\n\thasWarnedSimpleLayout = true;\n\tbuildLog.logBuildWarning(\n\t\t\"The 'simple' layout option is deprecated and will be removed in the next major version. Use 'flat' instead.\",\n\t);\n\treturn \"simple\";\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n\textractClientKeys,\n\textractSharedKeys,\n\tresolveLayout,\n} from \"@arkenv/build\";\nimport { resolveBuildLog } from \"@repo/log\";\nimport { extractKeys } from \"./extract\";\nimport {\n\tgenerateClientEnvAmbientDeclaration,\n\tgenerateClientFactoryCode,\n\tgenerateFactoryCode,\n\tgenerateFlatFactoryCode,\n} from \"./generate\";\nimport { normalizeLayout } from \"./layout\";\nimport type { ArkEnvConfigOptions } from \"./types\";\n\nfunction detectStandard(content: string, forceStandard?: boolean): boolean {\n\tif (forceStandard) return true;\n\treturn (\n\t\tcontent.includes(\"@arkenv/standard\") || content.includes(\"arkenv/standard\")\n\t);\n}\n\n/**\n * Run code generation to read the schema file and generate the env.gen.ts factory.\n *\n * @param schemaPath The absolute path to the schema file or directory\n * @param outputPath The absolute path to the generated output file\n * @param layoutOption The explicit layout to use; auto-detected from the filesystem when omitted\n * @param forceStandard Force standard mode code generation\n * @throws An error if strict layout files are missing when `layoutOption` is `\"strict\"`\n */\nexport function runCodegen(\n\tschemaPath: string,\n\toutputPath: string,\n\tlayoutOption?: ArkEnvConfigOptions[\"layout\"],\n\tforceStandard?: boolean,\n\tlogOptions?: Pick<ArkEnvConfigOptions, \"logger\" | \"logLevel\">,\n) {\n\tconst normalizedLayout = normalizeLayout(\n\t\tlayoutOption,\n\t\tresolveBuildLog(logOptions),\n\t);\n\n\tconst { layout: resolvedLayout, baseDir } = resolveLayout(\n\t\tschemaPath,\n\t\tnormalizedLayout,\n\t);\n\n\tlet generatedCode = \"\";\n\tif (resolvedLayout === \"strict\") {\n\t\tconst clientPath = path.join(baseDir, \"client.ts\");\n\t\tconst sharedPath = path.join(baseDir, \"internal\", \"shared.ts\");\n\n\t\tconst clientContent = fs.existsSync(clientPath)\n\t\t\t? fs.readFileSync(clientPath, \"utf-8\")\n\t\t\t: \"\";\n\t\tconst sharedContent = fs.existsSync(sharedPath)\n\t\t\t? fs.readFileSync(sharedPath, \"utf-8\")\n\t\t\t: \"\";\n\n\t\tconst isStandard =\n\t\t\tdetectStandard(clientContent, forceStandard) ||\n\t\t\tdetectStandard(sharedContent, forceStandard);\n\n\t\tconst clientKeys = extractClientKeys(clientContent);\n\t\tconst sharedKeys = extractSharedKeys(sharedContent);\n\n\t\tgeneratedCode = generateClientFactoryCode(\n\t\t\tclientKeys,\n\t\t\tsharedKeys,\n\t\t\tisStandard,\n\t\t);\n\t} else {\n\t\tconst fileContent = fs.readFileSync(schemaPath, \"utf-8\");\n\t\tconst isStandard = detectStandard(fileContent, forceStandard);\n\n\t\tconst { clientKeys, sharedKeys, isLegacy } = extractKeys(fileContent);\n\t\tif (isLegacy) {\n\t\t\tgeneratedCode = generateFactoryCode(clientKeys, sharedKeys, isStandard);\n\t\t} else {\n\t\t\tgeneratedCode = generateFlatFactoryCode(\n\t\t\t\tclientKeys,\n\t\t\t\tsharedKeys,\n\t\t\t\tisStandard,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst outputDir = path.dirname(outputPath);\n\tif (!fs.existsSync(outputDir)) {\n\t\tfs.mkdirSync(outputDir, { recursive: true });\n\t}\n\n\tlet shouldWrite = true;\n\tif (fs.existsSync(outputPath)) {\n\t\tconst existingContent = fs.readFileSync(outputPath, \"utf-8\");\n\t\tif (existingContent === generatedCode) {\n\t\t\tshouldWrite = false;\n\t\t}\n\t}\n\n\tif (shouldWrite) {\n\t\tfs.writeFileSync(outputPath, generatedCode, \"utf-8\");\n\t}\n\n\tif (resolvedLayout === \"strict\" && baseDir) {\n\t\tconst ambientPath = path.join(\n\t\t\tpath.dirname(outputPath),\n\t\t\t\"arkenv-client-env.d.ts\",\n\t\t);\n\t\tconst ambientCode = generateClientEnvAmbientDeclaration();\n\t\tlet shouldWriteAmbient = true;\n\t\tif (fs.existsSync(ambientPath)) {\n\t\t\tif (fs.readFileSync(ambientPath, \"utf-8\") === ambientCode) {\n\t\t\t\tshouldWriteAmbient = false;\n\t\t\t}\n\t\t}\n\t\tif (shouldWriteAmbient) {\n\t\t\tfs.writeFileSync(ambientPath, ambientCode, \"utf-8\");\n\t\t}\n\t}\n}\n","import path from \"node:path\";\nimport type { CLIENT_ENV_SPECIFIER } from \"../strict-client-env\";\n\ntype WebpackConfigLike = {\n\tresolve?: {\n\t\talias?:\n\t\t\t| Record<string, string | false | string[]>\n\t\t\t| Array<{ name: string; alias: string | false | string[] }>;\n\t};\n\tplugins?: unknown[];\n};\n\ntype WebpackLike = {\n\tDefinePlugin: new (definitions: Record<string, string>) => unknown;\n};\n\ntype WebpackContextLike = {\n\twebpack?: WebpackLike;\n};\n\ntype TurbopackResolveAlias = Record<string, string | string[]>;\n\ntype NextConfigLike = {\n\twebpack?: (\n\t\tconfig: WebpackConfigLike,\n\t\tcontext: WebpackContextLike,\n\t) => WebpackConfigLike | undefined;\n\tturbopack?: {\n\t\tresolveAlias?: TurbopackResolveAlias;\n\t\t[key: string]: unknown;\n\t};\n\texperimental?: {\n\t\tturbo?: {\n\t\t\tresolveAlias?: TurbopackResolveAlias;\n\t\t\t[key: string]: unknown;\n\t\t};\n\t\t[key: string]: unknown;\n\t};\n\tenv?: Record<string, string | undefined>;\n\t[key: string]: unknown;\n};\n\n/**\n * Merge `#arkenv/client-env` into a webpack `resolve.alias` value (object or array form).\n *\n * @param alias Existing webpack resolve.alias\n * @param specifier Virtual module specifier\n * @param target Absolute path to the project client env module\n * @returns Updated alias value\n */\nfunction mergeWebpackAlias(\n\talias:\n\t\t| Record<string, string | false | string[]>\n\t\t| Array<{ name: string; alias: string | false | string[] }>\n\t\t| undefined,\n\tspecifier: string,\n\ttarget: string,\n):\n\t| Record<string, string | false | string[]>\n\t| Array<{ name: string; alias: string | false | string[] }> {\n\tif (Array.isArray(alias)) {\n\t\tconst next = alias.filter((entry) => entry.name !== specifier);\n\t\tnext.push({ name: specifier, alias: target });\n\t\treturn next;\n\t}\n\treturn {\n\t\t...(alias ?? {}),\n\t\t[specifier]: target,\n\t};\n}\n\n/**\n * Apply webpack + Turbopack aliases and a compile-time strict-layout flag.\n *\n * Chains any existing `webpack` function on the user config. Turbopack aliases\n * are written to both `turbopack.resolveAlias` (Next 15+) and\n * `experimental.turbo.resolveAlias` for older configs.\n *\n * @param nextConfig User Next.js config object\n * @param clientEnvPath Absolute path to `env/client.ts`\n * @param specifier Virtual module specifier (typically `#arkenv/client-env`)\n * @returns Next config with strict-layout alias wiring\n */\nexport function applyStrictLayoutAliases<T extends NextConfigLike>(\n\tnextConfig: T,\n\tclientEnvPath: string,\n\tspecifier: typeof CLIENT_ENV_SPECIFIER | string = \"#arkenv/client-env\",\n): T {\n\tconst previousWebpack = nextConfig.webpack;\n\n\tconst webpack = (config: WebpackConfigLike, context: WebpackContextLike) => {\n\t\tconst resolved = previousWebpack\n\t\t\t? (previousWebpack(config, context) ?? config)\n\t\t\t: config;\n\t\tresolved.resolve = resolved.resolve ?? {};\n\t\tresolved.resolve.alias = mergeWebpackAlias(\n\t\t\tresolved.resolve.alias,\n\t\t\tspecifier,\n\t\t\tclientEnvPath,\n\t\t);\n\n\t\tconst DefinePlugin = context.webpack?.DefinePlugin;\n\t\tif (DefinePlugin) {\n\t\t\tresolved.plugins = resolved.plugins ?? [];\n\t\t\tresolved.plugins.push(\n\t\t\t\tnew DefinePlugin({\n\t\t\t\t\t__ARKENV_STRICT_LAYOUT__: JSON.stringify(true),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\treturn resolved;\n\t};\n\n\tconst turbopackTarget = path.isAbsolute(clientEnvPath)\n\t\t? `./${path.relative(process.cwd(), clientEnvPath).replace(/\\\\/g, \"/\")}`\n\t\t: clientEnvPath.startsWith(\".\")\n\t\t\t? clientEnvPath\n\t\t\t: `./${clientEnvPath}`;\n\n\tconst existingTurbopack = nextConfig.turbopack ?? {};\n\tconst turbopackResolveAlias: TurbopackResolveAlias = {\n\t\t...(existingTurbopack.resolveAlias ?? {}),\n\t\t[specifier]: turbopackTarget,\n\t};\n\n\tconst existingExperimental = nextConfig.experimental;\n\tconst experimental = existingExperimental\n\t\t? {\n\t\t\t\t...existingExperimental,\n\t\t\t\t...(existingExperimental.turbo\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tturbo: {\n\t\t\t\t\t\t\t\t...existingExperimental.turbo,\n\t\t\t\t\t\t\t\tresolveAlias: {\n\t\t\t\t\t\t\t\t\t...(existingExperimental.turbo.resolveAlias ?? {}),\n\t\t\t\t\t\t\t\t\t[specifier]: turbopackTarget,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t}\n\t\t: undefined;\n\n\t// NOTE: `nextConfig` is spread as a plain object below. Only the object-form\n\t// of `next.config` is supported here — a callable/function-form config would\n\t// lose its call signature when spread, silently dropping any phase-dependent\n\t// logic. Callers are responsible for dereferencing a callable config before\n\t// passing it to this function. Full callable-form support is tracked separately.\n\tconst result: Record<string, unknown> = {\n\t\t...nextConfig,\n\t\twebpack,\n\t\t// Turbopack / non-webpack paths: surface the flag via Next env inlining.\n\t\t// Note: Next.js forbids keys with __ prefix in nextConfig.env, so we use\n\t\t// ARKENV_STRICT_LAYOUT (no underscores) here. The webpack DefinePlugin\n\t\t// path uses __ARKENV_STRICT_LAYOUT__ as a compile-time literal, which is fine.\n\t\tenv: {\n\t\t\t...(nextConfig.env ?? {}),\n\t\t\tARKENV_STRICT_LAYOUT: \"true\",\n\t\t},\n\t\tturbopack: {\n\t\t\t...existingTurbopack,\n\t\t\tresolveAlias: turbopackResolveAlias,\n\t\t},\n\t};\n\n\tif (experimental) {\n\t\tresult.experimental = experimental;\n\t}\n\n\treturn result as T;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport {\n\tfindSchemaPath,\n\tformatMissingSchemaError,\n\tresolveLayout,\n\twatchSchema,\n} from \"@arkenv/build\";\nimport {\n\tformatBuildError,\n\tresolveBuildLog,\n\tresolveLoggerFromOptions,\n} from \"@repo/log\";\nimport { createJiti } from \"jiti\";\nimport {\n\tCLIENT_ENV_SPECIFIER,\n\tmissingClientTsError,\n} from \"../strict-client-env\";\nimport { runCodegen } from \"./codegen\";\nimport { normalizeLayout } from \"./layout\";\nimport { applyStrictLayoutAliases } from \"./strict-layout-aliases\";\nimport type { ArkEnvConfigOptions } from \"./types\";\n\nfunction resolveMockServerOnlyPath(moduleDir: string): string {\n\tfor (const base of [moduleDir, path.join(moduleDir, \"..\")]) {\n\t\tconst tsPath = path.join(base, \"mock-server-only.ts\");\n\t\tif (fs.existsSync(tsPath)) {\n\t\t\treturn tsPath;\n\t\t}\n\t\tconst jsPath = path.join(base, \"mock-server-only.js\");\n\t\tif (fs.existsSync(jsPath)) {\n\t\t\treturn jsPath;\n\t\t}\n\t}\n\n\treturn path.join(moduleDir, \"mock-server-only.js\");\n}\n\nfunction resolveEmptyClientEnvPath(moduleDir: string): string {\n\tfor (const base of [moduleDir, path.join(moduleDir, \"..\")]) {\n\t\tconst tsPath = path.join(base, \"empty-client-env.ts\");\n\t\tif (fs.existsSync(tsPath)) {\n\t\t\treturn tsPath;\n\t\t}\n\t\tconst jsPath = path.join(base, \"empty-client-env.js\");\n\t\tif (fs.existsSync(jsPath)) {\n\t\t\treturn jsPath;\n\t\t}\n\t}\n\n\treturn path.join(moduleDir, \"empty-client-env.js\");\n}\n\nfunction schemaPathExists(schemaPath: string): boolean {\n\tif (fs.existsSync(schemaPath)) return true;\n\n\tconst ext = path.extname(schemaPath);\n\tif (!ext) return false;\n\n\tconst baseWithoutExt = schemaPath.slice(0, -ext.length);\n\treturn fs.existsSync(baseWithoutExt);\n}\n\ntype SetupResult = {\n\tresolvedLayout: \"flat\" | \"strict\" | \"simple\";\n\tbaseDir: string | undefined;\n\tclientEnvPath: string | undefined;\n};\n\n/**\n * Run ArkEnv codegen and setup without wrapping nextConfig.\n *\n * @param options Optional configuration paths for schema and output files\n * @param internalOptions Optional configuration for internal testing hooks\n * @returns Resolved layout paths used by `withArkEnv` for alias registration\n * @throws An error if the schema file cannot be found or if code generation fails\n */\nexport function setupArkEnv(\n\toptions?: ArkEnvConfigOptions,\n\tinternalOptions?: { _jitiAliases?: Record<string, string> },\n): SetupResult {\n\tconst buildLog = resolveBuildLog(options);\n\n\tconst schemaPath = options?.schemaPath\n\t\t? path.resolve(options.schemaPath)\n\t\t: findSchemaPath();\n\n\tif (!schemaPath || !schemaPathExists(schemaPath)) {\n\t\tthrow new Error(\n\t\t\tformatMissingSchemaError({\n\t\t\t\tschemaPath: options?.schemaPath,\n\t\t\t\toptionsHint: \"setupArkEnv options\",\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst normalizedLayout = normalizeLayout(options?.layout, buildLog);\n\n\tconst { layout: resolvedLayout, baseDir } = resolveLayout(\n\t\tschemaPath,\n\t\tnormalizedLayout,\n\t);\n\n\tconst clientEnvPath =\n\t\tresolvedLayout === \"strict\" && baseDir\n\t\t\t? path.join(baseDir, \"client.ts\")\n\t\t\t: undefined;\n\n\tif (clientEnvPath && !fs.existsSync(clientEnvPath)) {\n\t\tthrow new Error(missingClientTsError(clientEnvPath, baseDir!));\n\t}\n\n\tconst defaultOutputDir =\n\t\tresolvedLayout === \"strict\" && baseDir ? baseDir : path.dirname(schemaPath);\n\tconst defaultOutputPath = path.join(\n\t\tdefaultOutputDir,\n\t\t\"generated\",\n\t\t\"env.gen.ts\",\n\t);\n\tconst outputPath = options?.outputPath\n\t\t? path.resolve(options.outputPath)\n\t\t: defaultOutputPath;\n\n\tconst codegen = options?.codegen ?? true;\n\tif (codegen) {\n\t\ttry {\n\t\t\trunCodegen(\n\t\t\t\tschemaPath,\n\t\t\t\toutputPath,\n\t\t\t\tresolvedLayout,\n\t\t\t\toptions?.standard,\n\t\t\t\toptions,\n\t\t\t);\n\t\t} catch (error: unknown) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tthrow new Error(\n\t\t\t\tformatBuildError(`Failed to generate env.gen.ts: ${message}`),\n\t\t\t);\n\t\t}\n\t}\n\n\tconst runValidation = options?.validate ?? true;\n\tif (runValidation) {\n\t\tconst g = globalThis as {\n\t\t\t__arkenv_force_server__?: boolean;\n\t\t\t__ARKENV_STRICT_LAYOUT__?: boolean;\n\t\t\t__ARKENV_CLIENT_ENV__?: unknown;\n\t\t};\n\t\ttry {\n\t\t\tg.__arkenv_force_server__ = true;\n\t\t\tconst fileToEvaluate =\n\t\t\t\tresolvedLayout === \"strict\" && baseDir\n\t\t\t\t\t? path.join(baseDir, \"server.ts\")\n\t\t\t\t\t: schemaPath;\n\n\t\t\tconst filenameForJiti =\n\t\t\t\ttypeof __filename !== \"undefined\"\n\t\t\t\t\t? __filename\n\t\t\t\t\t: typeof import.meta !== \"undefined\" && import.meta.url\n\t\t\t\t\t\t? fileURLToPath(import.meta.url)\n\t\t\t\t\t\t: \"\";\n\t\t\tconst dir = path.dirname(filenameForJiti);\n\t\t\tconst mockServerOnlyPath = resolveMockServerOnlyPath(dir);\n\t\t\tconst emptyClientEnvPath = resolveEmptyClientEnvPath(dir);\n\n\t\t\tconst aliases: Record<string, string> = {\n\t\t\t\t\"server-only\": mockServerOnlyPath,\n\t\t\t\t\"./script\": mockServerOnlyPath,\n\t\t\t\t\"./script.tsx\": mockServerOnlyPath,\n\t\t\t\t[CLIENT_ENV_SPECIFIER]:\n\t\t\t\t\tclientEnvPath && fs.existsSync(clientEnvPath)\n\t\t\t\t\t\t? clientEnvPath\n\t\t\t\t\t\t: emptyClientEnvPath,\n\t\t\t\t...internalOptions?._jitiAliases,\n\t\t\t};\n\n\t\t\tconst jiti = createJiti(fileToEvaluate, {\n\t\t\t\tmoduleCache: false,\n\t\t\t\tfsCache: false,\n\t\t\t\ttsconfigPaths: true,\n\t\t\t\talias: aliases,\n\t\t\t});\n\n\t\t\tif (resolvedLayout === \"strict\" && clientEnvPath) {\n\t\t\t\tg.__ARKENV_STRICT_LAYOUT__ = true;\n\t\t\t\tconst clientMod = jiti(clientEnvPath) as {\n\t\t\t\t\tenv?: unknown;\n\t\t\t\t\tdefault?: { env?: unknown };\n\t\t\t\t};\n\t\t\t\tg.__ARKENV_CLIENT_ENV__ =\n\t\t\t\t\tclientMod.env ?? clientMod.default?.env ?? clientMod;\n\t\t\t}\n\n\t\t\tjiti(fileToEvaluate);\n\t\t} catch (error: unknown) {\n\t\t\tbuildLog.logBuildError(\"Environment validation failed:\");\n\t\t\tbuildLog.logBuildErrorDetail(\n\t\t\t\terror instanceof Error ? error.message : String(error),\n\t\t\t);\n\t\t\tbuildLog.logBuildErrorBlankLine();\n\t\t\tprocess.exit(1);\n\t\t} finally {\n\t\t\tdelete g.__arkenv_force_server__;\n\t\t\tdelete g.__ARKENV_STRICT_LAYOUT__;\n\t\t\tdelete g.__ARKENV_CLIENT_ENV__;\n\t\t}\n\t}\n\n\tconst isDev =\n\t\tprocess.env.NODE_ENV === \"development\" ||\n\t\tprocess.env.NEXT_PHASE === \"phase-development-server\";\n\tif (isDev && codegen) {\n\t\tconst watchPaths =\n\t\t\tresolvedLayout === \"strict\" && baseDir\n\t\t\t\t? [\n\t\t\t\t\t\tpath.join(baseDir, \"internal\", \"shared.ts\"),\n\t\t\t\t\t\tpath.join(baseDir, \"client.ts\"),\n\t\t\t\t\t\tpath.join(baseDir, \"server.ts\"),\n\t\t\t\t\t].filter(fs.existsSync)\n\t\t\t\t: [schemaPath];\n\t\twatchSchema(\n\t\t\twatchPaths,\n\t\t\t() => {\n\t\t\t\trunCodegen(\n\t\t\t\t\tschemaPath,\n\t\t\t\t\toutputPath,\n\t\t\t\t\tresolvedLayout,\n\t\t\t\t\toptions?.standard,\n\t\t\t\t\toptions,\n\t\t\t\t);\n\t\t\t},\n\t\t\tresolveLoggerFromOptions(options),\n\t\t);\n\t}\n\n\treturn {\n\t\tresolvedLayout,\n\t\tbaseDir,\n\t\tclientEnvPath,\n\t};\n}\n\n/**\n * Wrap a Next.js configuration object to automatically generate the `runtimeEnv`\n * block in `env.gen.ts` and, in strict layout, register the `#arkenv/client-env`\n * alias so `@arkenv/nextjs/server` can auto-extend the client env.\n *\n * @param nextConfig The Next.js configuration object (object-form only; function-form configs are not yet supported — see follow-up issue)\n * @param options Optional configuration paths for schema and output files\n * @returns The Next.js configuration object (with strict-layout aliases when applicable)\n * @throws An error if the schema file cannot be found or if code generation fails\n */\nexport function withArkEnv<T>(nextConfig: T, options?: ArkEnvConfigOptions): T {\n\tconst { resolvedLayout, clientEnvPath } = setupArkEnv(options);\n\n\tif (resolvedLayout === \"strict\" && clientEnvPath) {\n\t\treturn applyStrictLayoutAliases(\n\t\t\tnextConfig as Record<string, unknown>,\n\t\t\tclientEnvPath,\n\t\t\tCLIENT_ENV_SPECIFIER,\n\t\t) as T;\n\t}\n\n\treturn nextConfig;\n}\n"],"mappings":"gsBAEA,SAAS,EAAgB,EAA8B,CACtD,IAAM,EACL,EAAW,MAAM,sCAAsC,EACvD,EAAW,MAAM,8BAA8B,EAC/C,EAAW,MAAM,8BAA8B,CAChD,GAAI,CAAC,EAAa,MAAO,EAAE,CAE3B,IAAM,EAAiB,EAAE,CACzB,IAAK,IAAM,KAAS,EAAY,GAAG,SAAS,mBAAmB,CAC9D,EAAK,KAAK,EAAM,GAAG,CAEpB,OAAO,EAGR,SAAS,EACR,EAC0D,CAC1D,IAAM,EAAQ,+BACd,KAAO,EAAM,KAAK,EAAQ,GAAK,MAAM,CACpC,IAAI,EAAa,EACb,EAAQ,EAAM,UACd,EAA0B,KAC1B,EAAuC,KACvC,EAAa,EACb,EAAe,EAEb,EAAiB,EAAE,CACrB,EAAa,GAEjB,KAAO,EAAQ,EAAQ,QAAU,EAAa,GAAG,CAChD,IAAM,EAAO,EAAQ,GACf,EAAW,EAAQ,EAAQ,GAEjC,GAAI,IAAc,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ACT,OAAO,EAAE,uBA+BX,OA1BC,QAAQ,IAAI,WAAa,eACzB,QAAQ,IAAI,aAAe,6BACf,IASZ,EAAA,EAAA,aAPC,IAAmB,UAAY,EAC5B,CACAL,EAAAA,QAAK,KAAK,EAAS,WAAY,YAAY,CAC3CA,EAAAA,QAAK,KAAK,EAAS,YAAY,CAC/BA,EAAAA,QAAK,KAAK,EAAS,YAAY,CAC/B,CAAC,OAAOC,EAAAA,QAAG,WAAW,CACtB,CAAC,EAAW,KAGT,CACL,EACC,EACA,EACA,EACA,GAAS,SACT,EACA,EAEFM,EAAAA,EAAyB,EAAQ,CACjC,CAGK,CACN,iBACA,UACA,gBACA,CAaF,SAAgB,EAAc,EAAe,EAAkC,CAC9E,GAAM,CAAE,iBAAgB,iBAAkB,EAAY,EAAQ,CAU9D,OARI,IAAmB,UAAY,EAC3B,EACN,EACA,EACAD,EAAAA,EACA,CAGK"}
@@ -0,0 +1,2 @@
1
+ function e(e){return e instanceof Error?e.stack??e.message:String(e)}const t={debug:0,info:1,warn:2,error:3},n=new Set([`debug`,`info`,`warn`,`error`,`silent`]);function r(e){if(!e)return;let t=e.trim().toLowerCase();if(n.has(t))return t}function i(){if(!(typeof process>`u`))return r(process.env?.ARKENV_LOG_LEVEL)}function a(e){return e?.level??i()??`info`}function o(e,n){return e===`silent`?!1:t[n]>=t[e]}function s(e,t,n){return(r,...i)=>{o(e,t)&&console[n](r,...i)}}function c(e){let t=a(e);return{debug:s(t,`debug`,`debug`),info:s(t,`info`,`info`),warn:s(t,`warn`,`warn`),error:s(t,`error`,`error`)}}let l=c();const u=`[ArkEnv]`,d=`[ArkEnv Watcher]`;function f(e){return`${u} ${e}`}function p(t){return{logBuildWarning(e){t.warn(`⚠️ ${u} ${e}`)},logBuildError(e){t.error(`❌ ${u} ${e}`)},logBuildErrorDetail(e){t.error(e)},logBuildErrorBlankLine(){t.error(``)},logBuildErrorWithCause(n,r){t.error(`❌ ${u} ${n}`),t.error(e(r))},logWatcherError(e){t.error(`${d} ${e}`)},logWatcherErrorWithCause(n,r){t.error(`${d} ${n}`),t.error(e(r))}}}function m(e){return e??l}let h=p(l);function g(e){h.logBuildWarning(e)}function _(e){return e?.logger?e.logger:e?.logLevel?c({level:e.logLevel}):m()}function v(e){return p(_(e))}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
2
+ //# sourceMappingURL=dist-Bof1Std7.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-Bof1Std7.cjs","names":[],"sources":["../../internal/log/dist/index.js"],"sourcesContent":["function e(e){return e instanceof Error?e.stack??e.message:String(e)}function t(e,t,n){e(`${t}: ${n instanceof Error?n.message:String(n)}`),n instanceof Error&&n.stack&&e(n.stack)}const n={debug:0,info:1,warn:2,error:3},r=new Set([`debug`,`info`,`warn`,`error`,`silent`]);function i(e){if(!e)return;let t=e.trim().toLowerCase();if(r.has(t))return t}function a(){if(!(typeof process>`u`))return i(process.env?.ARKENV_LOG_LEVEL)}function o(e){return e?.level??a()??`info`}function s(e,t){return e===`silent`?!1:n[t]>=n[e]}function c(e,t,n){return(r,...i)=>{s(e,t)&&console[n](r,...i)}}function l(e){let t=o(e);return{debug:c(t,`debug`,`debug`),info:c(t,`info`,`info`),warn:c(t,`warn`,`warn`),error:c(t,`error`,`error`)}}let u=l();function d(e){u=e}const f=`[ArkEnv]`,p=`[ArkEnv Watcher]`;function m(e){return`${f} ${e}`}function h(t){return{logBuildWarning(e){t.warn(`⚠️ ${f} ${e}`)},logBuildError(e){t.error(`❌ ${f} ${e}`)},logBuildErrorDetail(e){t.error(e)},logBuildErrorBlankLine(){t.error(``)},logBuildErrorWithCause(n,r){t.error(`❌ ${f} ${n}`),t.error(e(r))},logWatcherError(e){t.error(`${p} ${e}`)},logWatcherErrorWithCause(n,r){t.error(`${p} ${n}`),t.error(e(r))}}}function g(e){return e??u}let _=h(u);function v(e){_=h(e)}function y(e){_.logBuildWarning(e)}function b(e){_.logBuildError(e)}function x(e){_.logBuildErrorDetail(e)}function S(){_.logBuildErrorBlankLine()}function C(e,t){_.logBuildErrorWithCause(e,t)}function w(e){_.logWatcherError(e)}function T(e,t){_.logWatcherErrorWithCause(e,t)}const E=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null;function D(){if(!E())return!0;let e=process.env;return e.FORCE_COLOR===`0`?!0:e.FORCE_COLOR!==void 0&&e.FORCE_COLOR!==`0`?!1:!!(e.NO_COLOR!==void 0||e.CI!==void 0||process.stdout&&!process.stdout.isTTY)}function O(e,t){let n=t??l(e);d(n),v(n)}function k(e){if(!e)return{pluginConfig:{},logOptions:{}};let{logger:t,logLevel:n,...r}=e,i={};return t!==void 0&&(i.logger=t),n!==void 0&&(i.logLevel=n),{pluginConfig:r,logOptions:i}}function A(e){return e?.logger?e.logger:e?.logLevel?l({level:e.logLevel}):g()}function j(e){return h(A(e))}export{f as BUILD_PREFIX,p as WATCHER_PREFIX,v as bindDefaultBuildLog,O as configureDefaultLogger,h as createBuildLogHelpers,l as createConsoleLogger,u as defaultLogger,m as formatBuildError,e as formatErrorCause,E as isNode,b as logBuildError,S as logBuildErrorBlankLine,x as logBuildErrorDetail,C as logBuildErrorWithCause,y as logBuildWarning,t as logErrorWithCauseVia,w as logWatcherError,T as logWatcherErrorWithCause,i as parseLogLevel,a as readEnvLogLevel,j as resolveBuildLog,o as resolveLogLevel,g as resolveLogger,A as resolveLoggerFromOptions,D as shouldDisableColors,s as shouldLog,k as splitPluginConfig};\n//# sourceMappingURL=index.js.map"],"mappings":"AAAA,SAAS,EAAE,EAAE,CAAC,OAAO,aAAa,MAAM,EAAE,OAAO,EAAE,QAAQ,OAAO,EAAE,CAAgH,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,IA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,gBAAgB,EAAE,CAAC,EAAE,MAAM,GAAG,EAAE,GAAG,IAAI,EAAE,yBAAyB,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAsB,SAAS,EAAE,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAivB,SAAS,EAAE,EAAE,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ function e(e){return e instanceof Error?e.stack??e.message:String(e)}const t={debug:0,info:1,warn:2,error:3},n=new Set([`debug`,`info`,`warn`,`error`,`silent`]);function r(e){if(!e)return;let t=e.trim().toLowerCase();if(n.has(t))return t}function i(){if(!(typeof process>`u`))return r(process.env?.ARKENV_LOG_LEVEL)}function a(e){return e?.level??i()??`info`}function o(e,n){return e===`silent`?!1:t[n]>=t[e]}function s(e,t,n){return(r,...i)=>{o(e,t)&&console[n](r,...i)}}function c(e){let t=a(e);return{debug:s(t,`debug`,`debug`),info:s(t,`info`,`info`),warn:s(t,`warn`,`warn`),error:s(t,`error`,`error`)}}let l=c();const u=`[ArkEnv]`,d=`[ArkEnv Watcher]`;function f(e){return`${u} ${e}`}function p(t){return{logBuildWarning(e){t.warn(`⚠️ ${u} ${e}`)},logBuildError(e){t.error(`❌ ${u} ${e}`)},logBuildErrorDetail(e){t.error(e)},logBuildErrorBlankLine(){t.error(``)},logBuildErrorWithCause(n,r){t.error(`❌ ${u} ${n}`),t.error(e(r))},logWatcherError(e){t.error(`${d} ${e}`)},logWatcherErrorWithCause(n,r){t.error(`${d} ${n}`),t.error(e(r))}}}function m(e){return e??l}let h=p(l);function g(e){h.logBuildWarning(e)}function _(e){return e?.logger?e.logger:e?.logLevel?c({level:e.logLevel}):m()}function v(e){return p(_(e))}export{g as i,v as n,f as r,_ as t};
2
+ //# sourceMappingURL=dist-DimRGXOV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-DimRGXOV.js","names":[],"sources":["../../internal/log/dist/index.js"],"sourcesContent":["function e(e){return e instanceof Error?e.stack??e.message:String(e)}function t(e,t,n){e(`${t}: ${n instanceof Error?n.message:String(n)}`),n instanceof Error&&n.stack&&e(n.stack)}const n={debug:0,info:1,warn:2,error:3},r=new Set([`debug`,`info`,`warn`,`error`,`silent`]);function i(e){if(!e)return;let t=e.trim().toLowerCase();if(r.has(t))return t}function a(){if(!(typeof process>`u`))return i(process.env?.ARKENV_LOG_LEVEL)}function o(e){return e?.level??a()??`info`}function s(e,t){return e===`silent`?!1:n[t]>=n[e]}function c(e,t,n){return(r,...i)=>{s(e,t)&&console[n](r,...i)}}function l(e){let t=o(e);return{debug:c(t,`debug`,`debug`),info:c(t,`info`,`info`),warn:c(t,`warn`,`warn`),error:c(t,`error`,`error`)}}let u=l();function d(e){u=e}const f=`[ArkEnv]`,p=`[ArkEnv Watcher]`;function m(e){return`${f} ${e}`}function h(t){return{logBuildWarning(e){t.warn(`⚠️ ${f} ${e}`)},logBuildError(e){t.error(`❌ ${f} ${e}`)},logBuildErrorDetail(e){t.error(e)},logBuildErrorBlankLine(){t.error(``)},logBuildErrorWithCause(n,r){t.error(`❌ ${f} ${n}`),t.error(e(r))},logWatcherError(e){t.error(`${p} ${e}`)},logWatcherErrorWithCause(n,r){t.error(`${p} ${n}`),t.error(e(r))}}}function g(e){return e??u}let _=h(u);function v(e){_=h(e)}function y(e){_.logBuildWarning(e)}function b(e){_.logBuildError(e)}function x(e){_.logBuildErrorDetail(e)}function S(){_.logBuildErrorBlankLine()}function C(e,t){_.logBuildErrorWithCause(e,t)}function w(e){_.logWatcherError(e)}function T(e,t){_.logWatcherErrorWithCause(e,t)}const E=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null;function D(){if(!E())return!0;let e=process.env;return e.FORCE_COLOR===`0`?!0:e.FORCE_COLOR!==void 0&&e.FORCE_COLOR!==`0`?!1:!!(e.NO_COLOR!==void 0||e.CI!==void 0||process.stdout&&!process.stdout.isTTY)}function O(e,t){let n=t??l(e);d(n),v(n)}function k(e){if(!e)return{pluginConfig:{},logOptions:{}};let{logger:t,logLevel:n,...r}=e,i={};return t!==void 0&&(i.logger=t),n!==void 0&&(i.logLevel=n),{pluginConfig:r,logOptions:i}}function A(e){return e?.logger?e.logger:e?.logLevel?l({level:e.logLevel}):g()}function j(e){return h(A(e))}export{f as BUILD_PREFIX,p as WATCHER_PREFIX,v as bindDefaultBuildLog,O as configureDefaultLogger,h as createBuildLogHelpers,l as createConsoleLogger,u as defaultLogger,m as formatBuildError,e as formatErrorCause,E as isNode,b as logBuildError,S as logBuildErrorBlankLine,x as logBuildErrorDetail,C as logBuildErrorWithCause,y as logBuildWarning,t as logErrorWithCauseVia,w as logWatcherError,T as logWatcherErrorWithCause,i as parseLogLevel,a as readEnvLogLevel,j as resolveBuildLog,o as resolveLogLevel,g as resolveLogger,A as resolveLoggerFromOptions,D as shouldDisableColors,s as shouldLog,k as splitPluginConfig};\n//# sourceMappingURL=index.js.map"],"mappings":"AAAA,SAAS,EAAE,EAAE,CAAC,OAAO,aAAa,MAAM,EAAE,OAAO,EAAE,QAAQ,OAAO,EAAE,CAAgH,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,OAAO,OAAO,QAAQ,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,SAAS,GAAG,CAAC,GAAG,EAAE,OAAO,QAAQ,KA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E,CAAsB,SAAS,EAAE,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAivB,SAAS,EAAE,EAAE,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e={};exports.env=e;
2
+ //# sourceMappingURL=empty-client-env.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-client-env.cjs","names":[],"sources":["../src/empty-client-env.ts"],"sourcesContent":["/**\n * Empty client env used when `#arkenv/client-env` is imported outside strict\n * layout (so the server entry can keep a static import without the bundler\n * failing to resolve the virtual specifier).\n */\nexport const env = {};\n"],"mappings":"mEAKA,MAAa,EAAM,EAAE"}
@@ -0,0 +1,10 @@
1
+ //#region src/empty-client-env.d.ts
2
+ /**
3
+ * Empty client env used when `#arkenv/client-env` is imported outside strict
4
+ * layout (so the server entry can keep a static import without the bundler
5
+ * failing to resolve the virtual specifier).
6
+ */
7
+ declare const env: {};
8
+ //#endregion
9
+ export { env };
10
+ //# sourceMappingURL=empty-client-env.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-client-env.d.cts","names":[],"sources":["../src/empty-client-env.ts"],"mappings":";;AAKA;;;;cAAa,GAAA"}
@@ -0,0 +1,10 @@
1
+ //#region src/empty-client-env.d.ts
2
+ /**
3
+ * Empty client env used when `#arkenv/client-env` is imported outside strict
4
+ * layout (so the server entry can keep a static import without the bundler
5
+ * failing to resolve the virtual specifier).
6
+ */
7
+ declare const env: {};
8
+ //#endregion
9
+ export { env };
10
+ //# sourceMappingURL=empty-client-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-client-env.d.ts","names":[],"sources":["../src/empty-client-env.ts"],"mappings":";;AAKA;;;;cAAa,GAAA"}
@@ -0,0 +1,2 @@
1
+ const e={};export{e as env};
2
+ //# sourceMappingURL=empty-client-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-client-env.js","names":[],"sources":["../src/empty-client-env.ts"],"sourcesContent":["/**\n * Empty client env used when `#arkenv/client-env` is imported outside strict\n * layout (so the server entry can keep a static import without the bundler\n * failing to resolve the virtual specifier).\n */\nexport const env = {};\n"],"mappings":"AAKA,MAAa,EAAM,EAAE"}
@@ -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-C6bpQ5GU.d.cts.map
249
+ export { $ as a, Dict as i, InferType as n, StandardSchemaV1 as r, SchemaShape as t };
250
+ //# sourceMappingURL=index-BS1wAitS.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BS1wAitS.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","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/d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