envapt 7.1.0 → 8.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/CHANGELOG.md +44 -99
  2. package/README.md +1 -1
  3. package/dist/node/converters/BuiltInConverters.cjs +1 -1
  4. package/dist/node/converters/BuiltInConverters.cjs.map +1 -1
  5. package/dist/node/converters/BuiltInConverters.mjs +1 -1
  6. package/dist/node/converters/BuiltInConverters.mjs.map +1 -1
  7. package/dist/node/converters/Converters.cjs.map +1 -1
  8. package/dist/node/converters/Converters.mjs.map +1 -1
  9. package/dist/node/converters/ValueConverter.cjs +1 -1
  10. package/dist/node/converters/ValueConverter.cjs.map +1 -1
  11. package/dist/node/converters/ValueConverter.mjs +1 -1
  12. package/dist/node/converters/ValueConverter.mjs.map +1 -1
  13. package/dist/node/core/AdvancedMethods.cjs +1 -1
  14. package/dist/node/core/AdvancedMethods.cjs.map +1 -1
  15. package/dist/node/core/AdvancedMethods.mjs +1 -1
  16. package/dist/node/core/AdvancedMethods.mjs.map +1 -1
  17. package/dist/node/core/EnvapterBase.cjs +1 -1
  18. package/dist/node/core/EnvapterBase.cjs.map +1 -1
  19. package/dist/node/core/EnvapterBase.mjs +1 -1
  20. package/dist/node/core/EnvapterBase.mjs.map +1 -1
  21. package/dist/node/core/Environment.cjs +2 -0
  22. package/dist/node/core/Environment.cjs.map +1 -0
  23. package/dist/node/core/Environment.mjs +2 -0
  24. package/dist/node/core/Environment.mjs.map +1 -0
  25. package/dist/node/core/EnvironmentMethods.cjs +1 -1
  26. package/dist/node/core/EnvironmentMethods.cjs.map +1 -1
  27. package/dist/node/core/EnvironmentMethods.mjs +1 -1
  28. package/dist/node/core/EnvironmentMethods.mjs.map +1 -1
  29. package/dist/node/core/PrimitiveMethods.cjs +1 -1
  30. package/dist/node/core/PrimitiveMethods.cjs.map +1 -1
  31. package/dist/node/core/PrimitiveMethods.mjs +1 -1
  32. package/dist/node/core/PrimitiveMethods.mjs.map +1 -1
  33. package/dist/node/core/engine.cjs +2 -0
  34. package/dist/node/core/engine.cjs.map +1 -0
  35. package/dist/node/core/engine.mjs +2 -0
  36. package/dist/node/core/engine.mjs.map +1 -0
  37. package/dist/node/core/missing.cjs +2 -0
  38. package/dist/node/core/missing.cjs.map +1 -0
  39. package/dist/node/core/missing.mjs +2 -0
  40. package/dist/node/core/missing.mjs.map +1 -0
  41. package/dist/node/core/paths.cjs +2 -0
  42. package/dist/node/core/paths.cjs.map +1 -0
  43. package/dist/node/core/paths.mjs +2 -0
  44. package/dist/node/core/paths.mjs.map +1 -0
  45. package/dist/node/core/state.cjs +2 -0
  46. package/dist/node/core/state.cjs.map +1 -0
  47. package/dist/node/core/state.mjs +2 -0
  48. package/dist/node/core/state.mjs.map +1 -0
  49. package/dist/node/decorators/legacy/Envapt.cjs.map +1 -1
  50. package/dist/node/decorators/legacy/Envapt.mjs.map +1 -1
  51. package/dist/node/decorators/legacy/SugarDecorators.cjs.map +1 -1
  52. package/dist/node/decorators/legacy/SugarDecorators.mjs.map +1 -1
  53. package/dist/node/decorators/modern/Envapt.cjs.map +1 -1
  54. package/dist/node/decorators/modern/Envapt.mjs.map +1 -1
  55. package/dist/node/decorators/modern/SugarDecorators.cjs.map +1 -1
  56. package/dist/node/decorators/modern/SugarDecorators.mjs.map +1 -1
  57. package/dist/node/decorators/resolveDecoratorValue.cjs +1 -1
  58. package/dist/node/decorators/resolveDecoratorValue.cjs.map +1 -1
  59. package/dist/node/decorators/resolveDecoratorValue.mjs +1 -1
  60. package/dist/node/decorators/resolveDecoratorValue.mjs.map +1 -1
  61. package/dist/node/engine/Envapter.cjs +1 -1
  62. package/dist/node/engine/Envapter.cjs.map +1 -1
  63. package/dist/node/engine/Envapter.mjs +1 -1
  64. package/dist/node/engine/Envapter.mjs.map +1 -1
  65. package/dist/node/engine/NodeEnvapter.cjs +1 -1
  66. package/dist/node/engine/NodeEnvapter.cjs.map +1 -1
  67. package/dist/node/engine/NodeEnvapter.mjs +1 -1
  68. package/dist/node/engine/NodeEnvapter.mjs.map +1 -1
  69. package/dist/node/engine/TemplateResolver.cjs +1 -1
  70. package/dist/node/engine/TemplateResolver.cjs.map +1 -1
  71. package/dist/node/engine/TemplateResolver.mjs +1 -1
  72. package/dist/node/engine/TemplateResolver.mjs.map +1 -1
  73. package/dist/node/engine/Validators.cjs +1 -1
  74. package/dist/node/engine/Validators.cjs.map +1 -1
  75. package/dist/node/engine/Validators.mjs +1 -1
  76. package/dist/node/engine/Validators.mjs.map +1 -1
  77. package/dist/node/index.cjs +1 -1
  78. package/dist/node/index.mjs +1 -1
  79. package/dist/node/infra/Debug.cjs +1 -1
  80. package/dist/node/infra/Debug.cjs.map +1 -1
  81. package/dist/node/infra/Debug.mjs +1 -1
  82. package/dist/node/infra/Debug.mjs.map +1 -1
  83. package/dist/node/infra/Dotenv.cjs.map +1 -1
  84. package/dist/node/infra/Dotenv.mjs.map +1 -1
  85. package/dist/node/infra/Error.cjs +1 -1
  86. package/dist/node/infra/Error.cjs.map +1 -1
  87. package/dist/node/infra/Error.mjs +1 -1
  88. package/dist/node/infra/Error.mjs.map +1 -1
  89. package/dist/node/infra/recase.cjs +2 -0
  90. package/dist/node/infra/recase.cjs.map +1 -0
  91. package/dist/node/infra/recase.mjs +2 -0
  92. package/dist/node/infra/recase.mjs.map +1 -0
  93. package/dist/node/infra/runtime.cjs +1 -1
  94. package/dist/node/infra/runtime.cjs.map +1 -1
  95. package/dist/node/infra/runtime.mjs +1 -1
  96. package/dist/node/infra/runtime.mjs.map +1 -1
  97. package/dist/node/sources/{NodeEnvSource.cjs → FileSource.cjs} +2 -2
  98. package/dist/node/sources/FileSource.cjs.map +1 -0
  99. package/dist/node/sources/{NodeEnvSource.mjs → FileSource.mjs} +2 -2
  100. package/dist/node/sources/FileSource.mjs.map +1 -0
  101. package/dist/node/sources/PortableSource.cjs.map +1 -1
  102. package/dist/node/sources/PortableSource.mjs.map +1 -1
  103. package/dist/node/sources/{UnboundEnvSource.cjs → UnboundSource.cjs} +2 -2
  104. package/dist/node/sources/UnboundSource.cjs.map +1 -0
  105. package/dist/{browser/sources/UnboundEnvSource.mjs → node/sources/UnboundSource.mjs} +2 -2
  106. package/dist/node/sources/UnboundSource.mjs.map +1 -0
  107. package/dist/node/sources/coerce.cjs.map +1 -1
  108. package/dist/node/sources/coerce.mjs.map +1 -1
  109. package/dist/node/sources/merge.cjs +2 -0
  110. package/dist/node/sources/merge.cjs.map +1 -0
  111. package/dist/node/sources/merge.mjs +2 -0
  112. package/dist/node/sources/merge.mjs.map +1 -0
  113. package/dist/node/sources/normalizeSource.cjs +2 -0
  114. package/dist/node/sources/normalizeSource.cjs.map +1 -0
  115. package/dist/node/sources/normalizeSource.mjs +2 -0
  116. package/dist/node/sources/normalizeSource.mjs.map +1 -0
  117. package/dist/portable/converters/BuiltInConverters.mjs +2 -0
  118. package/dist/portable/converters/BuiltInConverters.mjs.map +1 -0
  119. package/dist/portable/converters/Converters.mjs.map +1 -0
  120. package/dist/portable/converters/ValueConverter.mjs +2 -0
  121. package/dist/portable/converters/ValueConverter.mjs.map +1 -0
  122. package/dist/portable/core/AdvancedMethods.mjs +2 -0
  123. package/dist/portable/core/AdvancedMethods.mjs.map +1 -0
  124. package/dist/portable/core/EnvapterBase.mjs +2 -0
  125. package/dist/portable/core/EnvapterBase.mjs.map +1 -0
  126. package/dist/portable/core/Environment.mjs +2 -0
  127. package/dist/portable/core/Environment.mjs.map +1 -0
  128. package/dist/portable/core/EnvironmentMethods.mjs +2 -0
  129. package/dist/portable/core/EnvironmentMethods.mjs.map +1 -0
  130. package/dist/portable/core/PrimitiveMethods.mjs +2 -0
  131. package/dist/portable/core/PrimitiveMethods.mjs.map +1 -0
  132. package/dist/portable/core/engine.mjs +2 -0
  133. package/dist/portable/core/engine.mjs.map +1 -0
  134. package/dist/portable/core/missing.mjs +2 -0
  135. package/dist/portable/core/missing.mjs.map +1 -0
  136. package/dist/portable/core/paths.mjs +2 -0
  137. package/dist/portable/core/paths.mjs.map +1 -0
  138. package/dist/portable/core/state.mjs +2 -0
  139. package/dist/portable/core/state.mjs.map +1 -0
  140. package/dist/{workerd → portable}/decorators/legacy/Envapt.mjs.map +1 -1
  141. package/dist/portable/decorators/legacy/SugarDecorators.mjs.map +1 -0
  142. package/dist/{browser → portable}/decorators/modern/Envapt.mjs.map +1 -1
  143. package/dist/portable/decorators/modern/SugarDecorators.mjs.map +1 -0
  144. package/dist/portable/decorators/resolveDecoratorValue.mjs +2 -0
  145. package/dist/portable/decorators/resolveDecoratorValue.mjs.map +1 -0
  146. package/dist/portable/engine/Envapter.mjs +2 -0
  147. package/dist/portable/engine/Envapter.mjs.map +1 -0
  148. package/dist/portable/engine/PortableEnvapter.mjs +2 -0
  149. package/dist/portable/engine/PortableEnvapter.mjs.map +1 -0
  150. package/dist/portable/engine/TemplateResolver.mjs +2 -0
  151. package/dist/portable/engine/TemplateResolver.mjs.map +1 -0
  152. package/dist/portable/engine/Validators.mjs +2 -0
  153. package/dist/portable/engine/Validators.mjs.map +1 -0
  154. package/dist/portable/engine/fileApiStub.mjs +2 -0
  155. package/dist/portable/engine/fileApiStub.mjs.map +1 -0
  156. package/dist/portable/index.mjs +1 -0
  157. package/dist/portable/infra/Debug.mjs +2 -0
  158. package/dist/portable/infra/Debug.mjs.map +1 -0
  159. package/dist/portable/infra/Dotenv.mjs.map +1 -0
  160. package/dist/{browser → portable}/infra/Error.mjs +1 -1
  161. package/dist/portable/infra/Error.mjs.map +1 -0
  162. package/dist/portable/infra/recase.mjs +2 -0
  163. package/dist/portable/infra/recase.mjs.map +1 -0
  164. package/dist/portable/infra/runtime.mjs +2 -0
  165. package/dist/portable/infra/runtime.mjs.map +1 -0
  166. package/dist/portable/sources/PortableSource.mjs.map +1 -0
  167. package/dist/{node/sources/UnboundEnvSource.mjs → portable/sources/UnboundSource.mjs} +2 -2
  168. package/dist/portable/sources/UnboundSource.mjs.map +1 -0
  169. package/dist/portable/sources/coerce.mjs.map +1 -0
  170. package/dist/portable/sources/merge.mjs +2 -0
  171. package/dist/portable/sources/merge.mjs.map +1 -0
  172. package/dist/portable/sources/normalizeSource.mjs +2 -0
  173. package/dist/portable/sources/normalizeSource.mjs.map +1 -0
  174. package/dist/types/converters/Converters.d.mts +3 -24
  175. package/dist/types/core/AdvancedMethods.d.mts +40 -19
  176. package/dist/types/core/EnvapterBase.d.mts +21 -26
  177. package/dist/types/core/Environment.d.mts +26 -0
  178. package/dist/types/core/EnvironmentMethods.d.mts +8 -67
  179. package/dist/types/core/PrimitiveMethods.d.mts +7 -10
  180. package/dist/types/decorators/legacy/SugarDecorators.d.mts +5 -0
  181. package/dist/types/decorators/modern/SugarDecorators.d.mts +5 -0
  182. package/dist/types/engine/Envapter.d.mts +6 -5
  183. package/dist/types/engine/NodeEnvapter.d.mts +18 -9
  184. package/dist/types/engine/PortableEnvapter.d.mts +17 -5
  185. package/dist/types/index.d.mts +10 -14
  186. package/dist/types/index.portable.d.mts +9 -13
  187. package/dist/types/infra/Debug.d.mts +1 -0
  188. package/dist/types/infra/Dotenv.d.mts +1 -0
  189. package/dist/types/infra/Error.d.mts +5 -1
  190. package/dist/types/infra/StandardSchema.d.mts +2 -12
  191. package/dist/types/sources/{NodeEnvSource.d.mts → FileSource.d.mts} +6 -5
  192. package/dist/types/sources/PortableSource.d.mts +3 -2
  193. package/dist/types/sources/merge.d.mts +16 -0
  194. package/dist/types/types/Casing.d.mts +8 -0
  195. package/dist/types/types/Conversion.d.mts +12 -71
  196. package/dist/types/types/Decorator.d.mts +0 -14
  197. package/dist/types/types/Env.d.mts +1 -10
  198. package/dist/types/types/Options.d.mts +13 -2
  199. package/dist/types/types/Schema.d.mts +1 -13
  200. package/dist/types/types/Source.d.mts +11 -33
  201. package/package.json +62 -19
  202. package/aliases/browser.d.mts +0 -7
  203. package/aliases/browser.mjs +0 -4
  204. package/aliases/workerd.d.mts +0 -7
  205. package/aliases/workerd.mjs +0 -4
  206. package/dist/browser/converters/BuiltInConverters.mjs +0 -2
  207. package/dist/browser/converters/BuiltInConverters.mjs.map +0 -1
  208. package/dist/browser/converters/Converters.mjs.map +0 -1
  209. package/dist/browser/converters/ValueConverter.mjs +0 -2
  210. package/dist/browser/converters/ValueConverter.mjs.map +0 -1
  211. package/dist/browser/core/AdvancedMethods.mjs +0 -2
  212. package/dist/browser/core/AdvancedMethods.mjs.map +0 -1
  213. package/dist/browser/core/EnvapterBase.mjs +0 -2
  214. package/dist/browser/core/EnvapterBase.mjs.map +0 -1
  215. package/dist/browser/core/EnvironmentMethods.mjs +0 -2
  216. package/dist/browser/core/EnvironmentMethods.mjs.map +0 -1
  217. package/dist/browser/core/PrimitiveMethods.mjs +0 -2
  218. package/dist/browser/core/PrimitiveMethods.mjs.map +0 -1
  219. package/dist/browser/decorators/legacy/Envapt.mjs.map +0 -1
  220. package/dist/browser/decorators/legacy/SugarDecorators.mjs.map +0 -1
  221. package/dist/browser/decorators/modern/SugarDecorators.mjs.map +0 -1
  222. package/dist/browser/decorators/resolveDecoratorValue.mjs +0 -2
  223. package/dist/browser/decorators/resolveDecoratorValue.mjs.map +0 -1
  224. package/dist/browser/engine/Envapter.mjs +0 -2
  225. package/dist/browser/engine/Envapter.mjs.map +0 -1
  226. package/dist/browser/engine/PortableEnvapter.mjs +0 -2
  227. package/dist/browser/engine/PortableEnvapter.mjs.map +0 -1
  228. package/dist/browser/engine/TemplateResolver.mjs +0 -2
  229. package/dist/browser/engine/TemplateResolver.mjs.map +0 -1
  230. package/dist/browser/engine/Validators.mjs +0 -2
  231. package/dist/browser/engine/Validators.mjs.map +0 -1
  232. package/dist/browser/engine/installFileApiStubs.mjs +0 -2
  233. package/dist/browser/engine/installFileApiStubs.mjs.map +0 -1
  234. package/dist/browser/index.mjs +0 -1
  235. package/dist/browser/infra/Debug.mjs +0 -2
  236. package/dist/browser/infra/Debug.mjs.map +0 -1
  237. package/dist/browser/infra/Dotenv.mjs.map +0 -1
  238. package/dist/browser/infra/Error.mjs.map +0 -1
  239. package/dist/browser/infra/runtime.mjs +0 -2
  240. package/dist/browser/infra/runtime.mjs.map +0 -1
  241. package/dist/browser/sources/ManualEnvSource.mjs +0 -2
  242. package/dist/browser/sources/ManualEnvSource.mjs.map +0 -1
  243. package/dist/browser/sources/PortableSource.mjs.map +0 -1
  244. package/dist/browser/sources/UnboundEnvSource.mjs.map +0 -1
  245. package/dist/browser/sources/WorkerEnvSource.mjs +0 -2
  246. package/dist/browser/sources/WorkerEnvSource.mjs.map +0 -1
  247. package/dist/browser/sources/coerce.mjs.map +0 -1
  248. package/dist/node/sources/ManualEnvSource.cjs +0 -2
  249. package/dist/node/sources/ManualEnvSource.cjs.map +0 -1
  250. package/dist/node/sources/ManualEnvSource.mjs +0 -2
  251. package/dist/node/sources/ManualEnvSource.mjs.map +0 -1
  252. package/dist/node/sources/NodeEnvSource.cjs.map +0 -1
  253. package/dist/node/sources/NodeEnvSource.mjs.map +0 -1
  254. package/dist/node/sources/UnboundEnvSource.cjs.map +0 -1
  255. package/dist/node/sources/UnboundEnvSource.mjs.map +0 -1
  256. package/dist/node/sources/WorkerEnvSource.cjs +0 -2
  257. package/dist/node/sources/WorkerEnvSource.cjs.map +0 -1
  258. package/dist/node/sources/WorkerEnvSource.mjs +0 -2
  259. package/dist/node/sources/WorkerEnvSource.mjs.map +0 -1
  260. package/dist/types/converters/ValueConverter.d.mts +0 -25
  261. package/dist/types/engine/TemplateResolver.d.mts +0 -17
  262. package/dist/types/sources/ManualEnvSource.d.mts +0 -12
  263. package/dist/types/sources/WorkerEnvSource.d.mts +0 -12
  264. package/dist/workerd/converters/BuiltInConverters.mjs +0 -2
  265. package/dist/workerd/converters/BuiltInConverters.mjs.map +0 -1
  266. package/dist/workerd/converters/Converters.mjs +0 -2
  267. package/dist/workerd/converters/Converters.mjs.map +0 -1
  268. package/dist/workerd/converters/ListOfBuiltInConverters.mjs +0 -2
  269. package/dist/workerd/converters/ListOfBuiltInConverters.mjs.map +0 -1
  270. package/dist/workerd/converters/ValueConverter.mjs +0 -2
  271. package/dist/workerd/converters/ValueConverter.mjs.map +0 -1
  272. package/dist/workerd/core/AdvancedMethods.mjs +0 -2
  273. package/dist/workerd/core/AdvancedMethods.mjs.map +0 -1
  274. package/dist/workerd/core/EnvapterBase.mjs +0 -2
  275. package/dist/workerd/core/EnvapterBase.mjs.map +0 -1
  276. package/dist/workerd/core/EnvironmentMethods.mjs +0 -2
  277. package/dist/workerd/core/EnvironmentMethods.mjs.map +0 -1
  278. package/dist/workerd/core/PrimitiveMethods.mjs +0 -2
  279. package/dist/workerd/core/PrimitiveMethods.mjs.map +0 -1
  280. package/dist/workerd/decorators/legacy/Envapt.mjs +0 -2
  281. package/dist/workerd/decorators/legacy/SugarDecorators.mjs +0 -2
  282. package/dist/workerd/decorators/legacy/SugarDecorators.mjs.map +0 -1
  283. package/dist/workerd/decorators/legacy/createPropertyDecorator.mjs +0 -2
  284. package/dist/workerd/decorators/legacy/createPropertyDecorator.mjs.map +0 -1
  285. package/dist/workerd/decorators/modern/Envapt.mjs +0 -2
  286. package/dist/workerd/decorators/modern/Envapt.mjs.map +0 -1
  287. package/dist/workerd/decorators/modern/SugarDecorators.mjs +0 -2
  288. package/dist/workerd/decorators/modern/SugarDecorators.mjs.map +0 -1
  289. package/dist/workerd/decorators/modern/createAccessorDecorator.mjs +0 -2
  290. package/dist/workerd/decorators/modern/createAccessorDecorator.mjs.map +0 -1
  291. package/dist/workerd/decorators/parseEnvaptOptions.mjs +0 -2
  292. package/dist/workerd/decorators/parseEnvaptOptions.mjs.map +0 -1
  293. package/dist/workerd/decorators/resolveDecoratorValue.mjs +0 -2
  294. package/dist/workerd/decorators/resolveDecoratorValue.mjs.map +0 -1
  295. package/dist/workerd/engine/Envapter.mjs +0 -2
  296. package/dist/workerd/engine/Envapter.mjs.map +0 -1
  297. package/dist/workerd/engine/PortableEnvapter.mjs +0 -2
  298. package/dist/workerd/engine/PortableEnvapter.mjs.map +0 -1
  299. package/dist/workerd/engine/TemplateResolver.mjs +0 -2
  300. package/dist/workerd/engine/TemplateResolver.mjs.map +0 -1
  301. package/dist/workerd/engine/Validators.mjs +0 -2
  302. package/dist/workerd/engine/Validators.mjs.map +0 -1
  303. package/dist/workerd/engine/installFileApiStubs.mjs +0 -2
  304. package/dist/workerd/engine/installFileApiStubs.mjs.map +0 -1
  305. package/dist/workerd/index.mjs +0 -1
  306. package/dist/workerd/infra/Debug.mjs +0 -2
  307. package/dist/workerd/infra/Debug.mjs.map +0 -1
  308. package/dist/workerd/infra/Dotenv.mjs +0 -3
  309. package/dist/workerd/infra/Dotenv.mjs.map +0 -1
  310. package/dist/workerd/infra/Error.mjs +0 -2
  311. package/dist/workerd/infra/Error.mjs.map +0 -1
  312. package/dist/workerd/infra/runtime.mjs +0 -2
  313. package/dist/workerd/infra/runtime.mjs.map +0 -1
  314. package/dist/workerd/legacy.mjs +0 -1
  315. package/dist/workerd/sources/ManualEnvSource.mjs +0 -2
  316. package/dist/workerd/sources/ManualEnvSource.mjs.map +0 -1
  317. package/dist/workerd/sources/PortableSource.mjs +0 -2
  318. package/dist/workerd/sources/PortableSource.mjs.map +0 -1
  319. package/dist/workerd/sources/UnboundEnvSource.mjs +0 -2
  320. package/dist/workerd/sources/UnboundEnvSource.mjs.map +0 -1
  321. package/dist/workerd/sources/WorkerEnvSource.mjs +0 -2
  322. package/dist/workerd/sources/WorkerEnvSource.mjs.map +0 -1
  323. package/dist/workerd/sources/coerce.mjs +0 -2
  324. package/dist/workerd/sources/coerce.mjs.map +0 -1
  325. /package/dist/{browser → portable}/converters/Converters.mjs +0 -0
  326. /package/dist/{browser → portable}/converters/ListOfBuiltInConverters.mjs +0 -0
  327. /package/dist/{browser → portable}/converters/ListOfBuiltInConverters.mjs.map +0 -0
  328. /package/dist/{browser → portable}/decorators/legacy/Envapt.mjs +0 -0
  329. /package/dist/{browser → portable}/decorators/legacy/SugarDecorators.mjs +0 -0
  330. /package/dist/{browser → portable}/decorators/legacy/createPropertyDecorator.mjs +0 -0
  331. /package/dist/{browser → portable}/decorators/legacy/createPropertyDecorator.mjs.map +0 -0
  332. /package/dist/{browser → portable}/decorators/modern/Envapt.mjs +0 -0
  333. /package/dist/{browser → portable}/decorators/modern/SugarDecorators.mjs +0 -0
  334. /package/dist/{browser → portable}/decorators/modern/createAccessorDecorator.mjs +0 -0
  335. /package/dist/{browser → portable}/decorators/modern/createAccessorDecorator.mjs.map +0 -0
  336. /package/dist/{browser → portable}/decorators/parseEnvaptOptions.mjs +0 -0
  337. /package/dist/{browser → portable}/decorators/parseEnvaptOptions.mjs.map +0 -0
  338. /package/dist/{browser → portable}/infra/Dotenv.mjs +0 -0
  339. /package/dist/{browser → portable}/legacy.mjs +0 -0
  340. /package/dist/{browser → portable}/sources/PortableSource.mjs +0 -0
  341. /package/dist/{browser → portable}/sources/coerce.mjs +0 -0
@@ -1,2 +1,2 @@
1
- const e=require("../infra/Error.cjs"),t=require("../core/EnvapterBase.cjs"),n=require("../converters/ValueConverter.cjs"),r=require("../engine/Envapter.cjs");function i(e){return Array.isArray(e)?`[${e.join(`, `)}]`:String(e)}const a=new WeakMap;let o=0;function s(e,t,n){let r=a.get(e);return r===void 0&&(r=o++,a.set(e,r)),`${r}.${t?`static`:`instance`}.${n}`}function c(a,o,s){let{fallback:c,converter:l,hasFallback:u,required:d,schema:f}=o;if(t.EnvaptCache.has(s))return t.EnvaptCache.get(s);let p=new r.Envapter;if(d&&f===void 0){let t=p.getRaw(a);if(t===void 0||t.trim()===``)throw new e.EnvaptError(305,`Required environment variable "${i(a)}" is missing or empty.`)}let m=new n.ValueConverter(p),h=f===void 0?m.convertValue(a,c,l,u):m.convertWithSchema(a,f,c,u);return t.EnvaptCache.set(s,h),h}exports.decoratorCacheKey=s,exports.resolveDecoratorValue=c;
1
+ const e=require("../infra/Error.cjs"),t=require("../core/state.cjs"),n=require("../core/missing.cjs"),r=require("../converters/ValueConverter.cjs"),i=require("../engine/Envapter.cjs");function a(e){return Array.isArray(e)?`[${e.join(`, `)}]`:String(e)}const o=new WeakMap;let s=0;function c(e,t,n){let r=o.get(e);return r===void 0&&(r=s++,o.set(e,r)),`${r}.${t?`static`:`instance`}.${n}`}function l(o,s,c){let{fallback:l,converter:u,hasFallback:d,required:f,schema:p}=s;if(t.cache.has(c))return t.cache.get(c);let m=new i.Envapter;if(f&&p===void 0&&n.isMissing(m.getRaw(o)))throw new e.EnvaptError(305,`Required environment variable "${a(o)}" is missing or empty.`);let h=new r.ValueConverter(m),g=p===void 0?h.convertValue(o,l,u,d):h.convertWithSchema(o,p,l,d);return t.cache.set(c,g),g}exports.decoratorCacheKey=c,exports.resolveDecoratorValue=l;
2
2
  //# sourceMappingURL=resolveDecoratorValue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveDecoratorValue.cjs","names":["EnvaptCache","Envapter","EnvaptError","ValueConverter"],"sources":["../../../src/decorators/resolveDecoratorValue.ts"],"sourcesContent":["import { ValueConverter } from '../converters';\nimport { EnvaptCache } from '../core';\nimport { Envapter } from '../engine/Envapter';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { StandardSchemaV1 } from '../infra/StandardSchema';\nimport type { EnvaptConverter, EnvKeyInput } from '../types';\n\nexport interface DecoratorConfig<TFallback> {\n fallback: TFallback | undefined;\n converter: EnvaptConverter<TFallback> | undefined;\n hasFallback: boolean;\n required: boolean;\n schema: StandardSchemaV1 | undefined;\n}\n\nfunction formatKeyForError(key: EnvKeyInput): string {\n return Array.isArray(key) ? `[${key.join(', ')}]` : String(key);\n}\n\nconst classIds = new WeakMap<object, number>();\nlet nextClassId = 0;\n\n// keyed on the constructor object, not its name, so two same-named classes (and a same-named\n// static/instance pair) stay in separate cache slots\nexport function decoratorCacheKey(owner: object, isStatic: boolean, prop: string): string {\n let id = classIds.get(owner);\n if (id === undefined) {\n id = nextClassId++;\n classIds.set(owner, id);\n }\n return `${id}.${isStatic ? 'static' : 'instance'}.${prop}`;\n}\n\nexport function resolveDecoratorValue<TFallback>(\n key: EnvKeyInput,\n config: DecoratorConfig<TFallback>,\n cacheKey: string\n): TFallback | null | undefined {\n const { fallback, converter, hasFallback, required, schema } = config;\n\n // .has(), not a get()-truthiness check, so a cached undefined (fallback: undefined, or a converter\n // that returns undefined) resolves once instead of re-running on every access\n if (EnvaptCache.has(cacheKey)) return EnvaptCache.get(cacheKey) as TFallback | null | undefined;\n\n const envapter = new Envapter();\n\n if (required && schema === undefined) {\n const rawValue = envapter.getRaw(key);\n if (rawValue === undefined || rawValue.trim() === '') {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Required environment variable \"${formatKeyForError(key)}\" is missing or empty.`\n );\n }\n }\n\n const valueConverter = new ValueConverter(envapter);\n const value =\n schema !== undefined\n ? (valueConverter.convertWithSchema(key, schema, fallback, hasFallback) as TFallback)\n : valueConverter.convertValue(key, fallback, converter, hasFallback);\n\n EnvaptCache.set(cacheKey, value);\n return value;\n}\n"],"mappings":"8JAgBA,SAAS,EAAkB,EAA0B,CACjD,OAAO,MAAM,QAAQ,CAAG,EAAI,IAAI,EAAI,KAAK,IAAI,EAAE,GAAK,OAAO,CAAG,CAClE,CAEA,MAAM,EAAW,IAAI,QACrB,IAAI,EAAc,EAIlB,SAAgB,EAAkB,EAAe,EAAmB,EAAsB,CACtF,IAAI,EAAK,EAAS,IAAI,CAAK,EAK3B,OAJI,IAAO,IAAA,KACP,EAAK,IACL,EAAS,IAAI,EAAO,CAAE,GAEnB,GAAG,EAAG,GAAG,EAAW,SAAW,WAAW,GAAG,GACxD,CAEA,SAAgB,EACZ,EACA,EACA,EAC4B,CAC5B,GAAM,CAAE,WAAU,YAAW,cAAa,WAAU,UAAW,EAI/D,GAAIA,EAAAA,YAAY,IAAI,CAAQ,EAAG,OAAOA,EAAAA,YAAY,IAAI,CAAQ,EAE9D,IAAM,EAAW,IAAIC,EAAAA,SAErB,GAAI,GAAY,IAAW,IAAA,GAAW,CAClC,IAAM,EAAW,EAAS,OAAO,CAAG,EACpC,GAAI,IAAa,IAAA,IAAa,EAAS,KAAK,IAAM,GAC9C,MAAM,IAAIC,EAAAA,YAAAA,IAEN,kCAAkC,EAAkB,CAAG,EAAE,uBAC7D,CAER,CAEA,IAAM,EAAiB,IAAIC,EAAAA,eAAe,CAAQ,EAC5C,EACF,IAAW,IAAA,GAEL,EAAe,aAAa,EAAK,EAAU,EAAW,CAAW,EADhE,EAAe,kBAAkB,EAAK,EAAQ,EAAU,CAAW,EAI9E,OADA,EAAA,YAAY,IAAI,EAAU,CAAK,EACxB,CACX"}
1
+ {"version":3,"file":"resolveDecoratorValue.cjs","names":["cache","Envapter","isMissing","EnvaptError","ValueConverter"],"sources":["../../../src/decorators/resolveDecoratorValue.ts"],"sourcesContent":["import { ValueConverter } from '../converters';\nimport { isMissing } from '../core/missing';\nimport { cache } from '../core/state';\nimport { Envapter } from '../engine/Envapter';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { StandardSchemaV1 } from '../infra/StandardSchema';\nimport type { EnvaptConverter, EnvKeyInput } from '../types';\n\nexport interface DecoratorConfig<TFallback> {\n fallback: TFallback | undefined;\n converter: EnvaptConverter<TFallback> | undefined;\n hasFallback: boolean;\n required: boolean;\n schema: StandardSchemaV1 | undefined;\n}\n\nfunction formatKeyForError(key: EnvKeyInput): string {\n return Array.isArray(key) ? `[${key.join(', ')}]` : String(key);\n}\n\nconst classIds = new WeakMap<object, number>();\nlet nextClassId = 0;\n\n// keyed on the constructor object, not its name, so two same-named classes (and a same-named\n// static/instance pair) stay in separate cache slots\nexport function decoratorCacheKey(owner: object, isStatic: boolean, prop: string): string {\n let id = classIds.get(owner);\n if (id === undefined) {\n id = nextClassId++;\n classIds.set(owner, id);\n }\n return `${id}.${isStatic ? 'static' : 'instance'}.${prop}`;\n}\n\nexport function resolveDecoratorValue<TFallback>(\n key: EnvKeyInput,\n config: DecoratorConfig<TFallback>,\n cacheKey: string\n): TFallback | null | undefined {\n const { fallback, converter, hasFallback, required, schema } = config;\n\n // .has(), not a get()-truthiness check, so a cached undefined (fallback: undefined, or a converter\n // that returns undefined) resolves once instead of re-running on every access\n if (cache.has(cacheKey)) return cache.get(cacheKey) as TFallback | null | undefined;\n\n const envapter = new Envapter();\n\n if (required && schema === undefined) {\n const rawValue = envapter.getRaw(key);\n if (isMissing(rawValue)) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Required environment variable \"${formatKeyForError(key)}\" is missing or empty.`\n );\n }\n }\n\n const valueConverter = new ValueConverter(envapter);\n const value =\n schema !== undefined\n ? (valueConverter.convertWithSchema(key, schema, fallback, hasFallback) as TFallback)\n : valueConverter.convertValue(key, fallback, converter, hasFallback);\n\n cache.set(cacheKey, value);\n return value;\n}\n"],"mappings":"wLAiBA,SAAS,EAAkB,EAA0B,CACjD,OAAO,MAAM,QAAQ,CAAG,EAAI,IAAI,EAAI,KAAK,IAAI,EAAE,GAAK,OAAO,CAAG,CAClE,CAEA,MAAM,EAAW,IAAI,QACrB,IAAI,EAAc,EAIlB,SAAgB,EAAkB,EAAe,EAAmB,EAAsB,CACtF,IAAI,EAAK,EAAS,IAAI,CAAK,EAK3B,OAJI,IAAO,IAAA,KACP,EAAK,IACL,EAAS,IAAI,EAAO,CAAE,GAEnB,GAAG,EAAG,GAAG,EAAW,SAAW,WAAW,GAAG,GACxD,CAEA,SAAgB,EACZ,EACA,EACA,EAC4B,CAC5B,GAAM,CAAE,WAAU,YAAW,cAAa,WAAU,UAAW,EAI/D,GAAIA,EAAAA,MAAM,IAAI,CAAQ,EAAG,OAAOA,EAAAA,MAAM,IAAI,CAAQ,EAElD,IAAM,EAAW,IAAIC,EAAAA,SAErB,GAAI,GAAY,IAAW,IAAA,IAEnBC,EAAAA,UADa,EAAS,OAAO,CACZ,CAAC,EAClB,MAAM,IAAIC,EAAAA,YAAAA,IAEN,kCAAkC,EAAkB,CAAG,EAAE,uBAC7D,EAIR,IAAM,EAAiB,IAAIC,EAAAA,eAAe,CAAQ,EAC5C,EACF,IAAW,IAAA,GAEL,EAAe,aAAa,EAAK,EAAU,EAAW,CAAW,EADhE,EAAe,kBAAkB,EAAK,EAAQ,EAAU,CAAW,EAI9E,OADA,EAAA,MAAM,IAAI,EAAU,CAAK,EAClB,CACX"}
@@ -1,2 +1,2 @@
1
- import{EnvaptError as e}from"../infra/Error.mjs";import{EnvaptCache as t}from"../core/EnvapterBase.mjs";import{ValueConverter as n}from"../converters/ValueConverter.mjs";import{Envapter as r}from"../engine/Envapter.mjs";function i(e){return Array.isArray(e)?`[${e.join(`, `)}]`:String(e)}const a=new WeakMap;let o=0;function s(e,t,n){let r=a.get(e);return r===void 0&&(r=o++,a.set(e,r)),`${r}.${t?`static`:`instance`}.${n}`}function c(a,o,s){let{fallback:c,converter:l,hasFallback:u,required:d,schema:f}=o;if(t.has(s))return t.get(s);let p=new r;if(d&&f===void 0){let t=p.getRaw(a);if(t===void 0||t.trim()===``)throw new e(305,`Required environment variable "${i(a)}" is missing or empty.`)}let m=new n(p),h=f===void 0?m.convertValue(a,c,l,u):m.convertWithSchema(a,f,c,u);return t.set(s,h),h}export{s as decoratorCacheKey,c as resolveDecoratorValue};
1
+ import{EnvaptError as e}from"../infra/Error.mjs";import{cache as t}from"../core/state.mjs";import{isMissing as n}from"../core/missing.mjs";import{ValueConverter as r}from"../converters/ValueConverter.mjs";import{Envapter as i}from"../engine/Envapter.mjs";function a(e){return Array.isArray(e)?`[${e.join(`, `)}]`:String(e)}const o=new WeakMap;let s=0;function c(e,t,n){let r=o.get(e);return r===void 0&&(r=s++,o.set(e,r)),`${r}.${t?`static`:`instance`}.${n}`}function l(o,s,c){let{fallback:l,converter:u,hasFallback:d,required:f,schema:p}=s;if(t.has(c))return t.get(c);let m=new i;if(f&&p===void 0&&n(m.getRaw(o)))throw new e(305,`Required environment variable "${a(o)}" is missing or empty.`);let h=new r(m),g=p===void 0?h.convertValue(o,l,u,d):h.convertWithSchema(o,p,l,d);return t.set(c,g),g}export{c as decoratorCacheKey,l as resolveDecoratorValue};
2
2
  //# sourceMappingURL=resolveDecoratorValue.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveDecoratorValue.mjs","names":[],"sources":["../../../src/decorators/resolveDecoratorValue.ts"],"sourcesContent":["import { ValueConverter } from '../converters';\nimport { EnvaptCache } from '../core';\nimport { Envapter } from '../engine/Envapter';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { StandardSchemaV1 } from '../infra/StandardSchema';\nimport type { EnvaptConverter, EnvKeyInput } from '../types';\n\nexport interface DecoratorConfig<TFallback> {\n fallback: TFallback | undefined;\n converter: EnvaptConverter<TFallback> | undefined;\n hasFallback: boolean;\n required: boolean;\n schema: StandardSchemaV1 | undefined;\n}\n\nfunction formatKeyForError(key: EnvKeyInput): string {\n return Array.isArray(key) ? `[${key.join(', ')}]` : String(key);\n}\n\nconst classIds = new WeakMap<object, number>();\nlet nextClassId = 0;\n\n// keyed on the constructor object, not its name, so two same-named classes (and a same-named\n// static/instance pair) stay in separate cache slots\nexport function decoratorCacheKey(owner: object, isStatic: boolean, prop: string): string {\n let id = classIds.get(owner);\n if (id === undefined) {\n id = nextClassId++;\n classIds.set(owner, id);\n }\n return `${id}.${isStatic ? 'static' : 'instance'}.${prop}`;\n}\n\nexport function resolveDecoratorValue<TFallback>(\n key: EnvKeyInput,\n config: DecoratorConfig<TFallback>,\n cacheKey: string\n): TFallback | null | undefined {\n const { fallback, converter, hasFallback, required, schema } = config;\n\n // .has(), not a get()-truthiness check, so a cached undefined (fallback: undefined, or a converter\n // that returns undefined) resolves once instead of re-running on every access\n if (EnvaptCache.has(cacheKey)) return EnvaptCache.get(cacheKey) as TFallback | null | undefined;\n\n const envapter = new Envapter();\n\n if (required && schema === undefined) {\n const rawValue = envapter.getRaw(key);\n if (rawValue === undefined || rawValue.trim() === '') {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Required environment variable \"${formatKeyForError(key)}\" is missing or empty.`\n );\n }\n }\n\n const valueConverter = new ValueConverter(envapter);\n const value =\n schema !== undefined\n ? (valueConverter.convertWithSchema(key, schema, fallback, hasFallback) as TFallback)\n : valueConverter.convertValue(key, fallback, converter, hasFallback);\n\n EnvaptCache.set(cacheKey, value);\n return value;\n}\n"],"mappings":"4NAgBA,SAAS,EAAkB,EAA0B,CACjD,OAAO,MAAM,QAAQ,CAAG,EAAI,IAAI,EAAI,KAAK,IAAI,EAAE,GAAK,OAAO,CAAG,CAClE,CAEA,MAAM,EAAW,IAAI,QACrB,IAAI,EAAc,EAIlB,SAAgB,EAAkB,EAAe,EAAmB,EAAsB,CACtF,IAAI,EAAK,EAAS,IAAI,CAAK,EAK3B,OAJI,IAAO,IAAA,KACP,EAAK,IACL,EAAS,IAAI,EAAO,CAAE,GAEnB,GAAG,EAAG,GAAG,EAAW,SAAW,WAAW,GAAG,GACxD,CAEA,SAAgB,EACZ,EACA,EACA,EAC4B,CAC5B,GAAM,CAAE,WAAU,YAAW,cAAa,WAAU,UAAW,EAI/D,GAAI,EAAY,IAAI,CAAQ,EAAG,OAAO,EAAY,IAAI,CAAQ,EAE9D,IAAM,EAAW,IAAI,EAErB,GAAI,GAAY,IAAW,IAAA,GAAW,CAClC,IAAM,EAAW,EAAS,OAAO,CAAG,EACpC,GAAI,IAAa,IAAA,IAAa,EAAS,KAAK,IAAM,GAC9C,MAAM,IAAI,EAAA,IAEN,kCAAkC,EAAkB,CAAG,EAAE,uBAC7D,CAER,CAEA,IAAM,EAAiB,IAAI,EAAe,CAAQ,EAC5C,EACF,IAAW,IAAA,GAEL,EAAe,aAAa,EAAK,EAAU,EAAW,CAAW,EADhE,EAAe,kBAAkB,EAAK,EAAQ,EAAU,CAAW,EAI9E,OADA,EAAY,IAAI,EAAU,CAAK,EACxB,CACX"}
1
+ {"version":3,"file":"resolveDecoratorValue.mjs","names":[],"sources":["../../../src/decorators/resolveDecoratorValue.ts"],"sourcesContent":["import { ValueConverter } from '../converters';\nimport { isMissing } from '../core/missing';\nimport { cache } from '../core/state';\nimport { Envapter } from '../engine/Envapter';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { StandardSchemaV1 } from '../infra/StandardSchema';\nimport type { EnvaptConverter, EnvKeyInput } from '../types';\n\nexport interface DecoratorConfig<TFallback> {\n fallback: TFallback | undefined;\n converter: EnvaptConverter<TFallback> | undefined;\n hasFallback: boolean;\n required: boolean;\n schema: StandardSchemaV1 | undefined;\n}\n\nfunction formatKeyForError(key: EnvKeyInput): string {\n return Array.isArray(key) ? `[${key.join(', ')}]` : String(key);\n}\n\nconst classIds = new WeakMap<object, number>();\nlet nextClassId = 0;\n\n// keyed on the constructor object, not its name, so two same-named classes (and a same-named\n// static/instance pair) stay in separate cache slots\nexport function decoratorCacheKey(owner: object, isStatic: boolean, prop: string): string {\n let id = classIds.get(owner);\n if (id === undefined) {\n id = nextClassId++;\n classIds.set(owner, id);\n }\n return `${id}.${isStatic ? 'static' : 'instance'}.${prop}`;\n}\n\nexport function resolveDecoratorValue<TFallback>(\n key: EnvKeyInput,\n config: DecoratorConfig<TFallback>,\n cacheKey: string\n): TFallback | null | undefined {\n const { fallback, converter, hasFallback, required, schema } = config;\n\n // .has(), not a get()-truthiness check, so a cached undefined (fallback: undefined, or a converter\n // that returns undefined) resolves once instead of re-running on every access\n if (cache.has(cacheKey)) return cache.get(cacheKey) as TFallback | null | undefined;\n\n const envapter = new Envapter();\n\n if (required && schema === undefined) {\n const rawValue = envapter.getRaw(key);\n if (isMissing(rawValue)) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Required environment variable \"${formatKeyForError(key)}\" is missing or empty.`\n );\n }\n }\n\n const valueConverter = new ValueConverter(envapter);\n const value =\n schema !== undefined\n ? (valueConverter.convertWithSchema(key, schema, fallback, hasFallback) as TFallback)\n : valueConverter.convertValue(key, fallback, converter, hasFallback);\n\n cache.set(cacheKey, value);\n return value;\n}\n"],"mappings":"+PAiBA,SAAS,EAAkB,EAA0B,CACjD,OAAO,MAAM,QAAQ,CAAG,EAAI,IAAI,EAAI,KAAK,IAAI,EAAE,GAAK,OAAO,CAAG,CAClE,CAEA,MAAM,EAAW,IAAI,QACrB,IAAI,EAAc,EAIlB,SAAgB,EAAkB,EAAe,EAAmB,EAAsB,CACtF,IAAI,EAAK,EAAS,IAAI,CAAK,EAK3B,OAJI,IAAO,IAAA,KACP,EAAK,IACL,EAAS,IAAI,EAAO,CAAE,GAEnB,GAAG,EAAG,GAAG,EAAW,SAAW,WAAW,GAAG,GACxD,CAEA,SAAgB,EACZ,EACA,EACA,EAC4B,CAC5B,GAAM,CAAE,WAAU,YAAW,cAAa,WAAU,UAAW,EAI/D,GAAI,EAAM,IAAI,CAAQ,EAAG,OAAO,EAAM,IAAI,CAAQ,EAElD,IAAM,EAAW,IAAI,EAErB,GAAI,GAAY,IAAW,IAAA,IAEnB,EADa,EAAS,OAAO,CACZ,CAAC,EAClB,MAAM,IAAI,EAAA,IAEN,kCAAkC,EAAkB,CAAG,EAAE,uBAC7D,EAIR,IAAM,EAAiB,IAAI,EAAe,CAAQ,EAC5C,EACF,IAAW,IAAA,GAEL,EAAe,aAAa,EAAK,EAAU,EAAW,CAAW,EADhE,EAAe,kBAAkB,EAAK,EAAQ,EAAU,CAAW,EAI9E,OADA,EAAM,IAAI,EAAU,CAAK,EAClB,CACX"}
@@ -1,2 +1,2 @@
1
- const e=require("../infra/Error.cjs");require("../core/EnvapterBase.cjs"),require("../core/EnvironmentMethods.cjs");const t=require("../core/AdvancedMethods.cjs");var n=class n extends t.AdvancedMethods{static resolve(t,...r){let i=n.strict;return t.reduce((t,n,a)=>{let o=r[a];if(!o)return t+n;let s=super.get(o,``);if(i&&s.trim()===``)throw new e.EnvaptError(305,`Cannot resolve template variable "\${${o}}": value is missing or empty.`);return t+n+s},``)}resolve(e,...t){return n.resolve(e,...t)}static require(...t){let r=[];for(let e of t)n.resolveAndValidate(e)===void 0&&r.push(e);if(r.length>0)throw new e.EnvaptError(305,`Missing required environment variables: ${r.join(`, `)}.`)}static resolveAndValidate(e){let{value:t}=this.resolveKeyInput(e);if(t===void 0)return;let n=this.templateResolver.resolveTemplate(e,t);if(n.trim()!==``)return n}require(...e){n.require(...e)}};exports.Envapter=n;
1
+ const e=require("../infra/Error.cjs");require("../core/Environment.cjs");const t=require("../core/engine.cjs"),n=require("../core/AdvancedMethods.cjs");var r=class r extends n.AdvancedMethods{static resolve(t,...n){let i=r.strict;return t.reduce((t,r,a)=>{let o=n[a];if(!o)return t+r;let s=super.get(o,``);if(i&&s.trim()===``)throw new e.EnvaptError(305,`Cannot resolve template variable "\${${o}}": value is missing or empty.`);return t+r+s},``)}resolve(e,...t){return r.resolve(e,...t)}static require(...r){let i=r.filter(e=>n.resolveRequired(t.resolveKeyInput(e),t.templateResolver).value===void 0);if(i.length>0)throw new e.EnvaptError(305,`Missing required environment variables: ${i.join(`, `)}.`)}require(...e){r.require(...e)}};exports.Envapter=r;
2
2
  //# sourceMappingURL=Envapter.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Envapter.cjs","names":["AdvancedMethods","EnvaptError"],"sources":["../../../src/engine/Envapter.ts"],"sourcesContent":["import { AdvancedMethods } from '../core';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nexport { EnvaptCache, Environment } from '../core';\n\n/**\n * Main configuration class for environment variable management.\n *\n * Provides both static and instance methods for retrieving typed environment variables\n * with support for template resolution, multiple .env files, and environment detection.\n *\n * Extend your own classes from this to define properties with \\@Envapt decorators and get access to environment-variable methods.\n *\n * @example\n * ```ts\n * // Static usage\n * const port = Envapter.getNumber('PORT', 3000);\n * const url = Envapter.get('API_URL', 'http://localhost');\n * const replica = Envapter.get(['READONLY_URL', 'DATABASE_URL'], 'sqlite://memory');\n *\n * // Instance usage\n * const env = new Envapter();\n * const dbUrl = env.get('DATABASE_URL', 'sqlite://memory');\n * const primaryHost = env.get(['PRIMARY_HOST', 'SECONDARY_HOST']);\n * ```\n *\n * @public\n */\nexport class Envapter extends AdvancedMethods {\n /**\n * Tagged template literal for resolving environment variables in template strings.\n *\n * @example\n * ```ts\n * // Given API_HOST=api.example.com and API_PORT=8080 in environment\n * const endpoint = Envapter.resolve`Connecting to ${'API_HOST'}:${'API_PORT'}`;\n * // Returns: \"Connecting to api.example.com:8080\"\n *\n * // Works with template variables in .env too:\n * // API_URL=https://${API_HOST}:${API_PORT}\n * const message = Envapter.resolve`Service endpoint: ${'API_URL'}`;\n * // Returns: \"Service endpoint: https://api.example.com:8080\"\n * ```\n */\n static resolve(strings: TemplateStringsArray, ...keys: string[]): string {\n const strict = Envapter.strict;\n return strings.reduce((result, string, i) => {\n const envKey = keys[i];\n if (!envKey) return result + string;\n const raw = super.get(envKey, '');\n if (strict && raw.trim() === '') {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Cannot resolve template variable \"\\${${envKey}}\": value is missing or empty.`\n );\n }\n return result + string + raw;\n }, '');\n }\n\n /**\n * @see {@link Envapter.resolve}\n */\n resolve(strings: TemplateStringsArray, ...keys: string[]): string {\n return Envapter.resolve(strings, ...keys);\n }\n\n /**\n * Assert that one or more environment variables are present and non-empty (post-trim,\n * after template resolution). Throws `MissingEnvValue` listing every missing key.\n *\n * For typed fail-fast in functional code, use `Envapter.getUsing(key, { converter, required: true })`.\n *\n * @example\n * ```ts\n * Envapter.require('DATABASE_URL');\n * Envapter.require('DATABASE_URL', 'API_KEY', 'SENTRY_DSN');\n * ```\n */\n static require(...keys: [string, ...string[]]): void {\n const missing: string[] = [];\n for (const k of keys) {\n if (Envapter.resolveAndValidate(k) === undefined) missing.push(k);\n }\n\n if (missing.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Missing required environment variables: ${missing.join(', ')}.`\n );\n }\n }\n\n private static resolveAndValidate(key: string): string | undefined {\n const { value } = this.resolveKeyInput(key);\n if (value === undefined) return undefined;\n const resolved = this.templateResolver.resolveTemplate(key, value);\n if (resolved.trim() === '') return undefined;\n return resolved;\n }\n\n /**\n * @see {@link Envapter.require}\n */\n require(...keys: [string, ...string[]]): void {\n Envapter.require(...keys);\n }\n}\n"],"mappings":"mKA4BA,IAAa,EAAb,MAAa,UAAiBA,EAAAA,eAAgB,CAgB1C,OAAO,QAAQ,EAA+B,GAAG,EAAwB,CACrE,IAAM,EAAS,EAAS,OACxB,OAAO,EAAQ,QAAQ,EAAQ,EAAQ,IAAM,CACzC,IAAM,EAAS,EAAK,GACpB,GAAI,CAAC,EAAQ,OAAO,EAAS,EAC7B,IAAM,EAAM,MAAM,IAAI,EAAQ,EAAE,EAChC,GAAI,GAAU,EAAI,KAAK,IAAM,GACzB,MAAM,IAAIC,EAAAA,YAAAA,IAEN,wCAAwC,EAAO,+BACnD,EAEJ,OAAO,EAAS,EAAS,CAC7B,EAAG,EAAE,CACT,CAKA,QAAQ,EAA+B,GAAG,EAAwB,CAC9D,OAAO,EAAS,QAAQ,EAAS,GAAG,CAAI,CAC5C,CAcA,OAAO,QAAQ,GAAG,EAAmC,CACjD,IAAM,EAAoB,CAAC,EAC3B,IAAK,IAAM,KAAK,EACR,EAAS,mBAAmB,CAAC,IAAM,IAAA,IAAW,EAAQ,KAAK,CAAC,EAGpE,GAAI,EAAQ,OAAS,EACjB,MAAM,IAAIA,EAAAA,YAAAA,IAEN,2CAA2C,EAAQ,KAAK,IAAI,EAAE,EAClE,CAER,CAEA,OAAe,mBAAmB,EAAiC,CAC/D,GAAM,CAAE,SAAU,KAAK,gBAAgB,CAAG,EAC1C,GAAI,IAAU,IAAA,GAAW,OACzB,IAAM,EAAW,KAAK,iBAAiB,gBAAgB,EAAK,CAAK,EAC7D,KAAS,KAAK,IAAM,GACxB,OAAO,CACX,CAKA,QAAQ,GAAG,EAAmC,CAC1C,EAAS,QAAQ,GAAG,CAAI,CAC5B,CACJ"}
1
+ {"version":3,"file":"Envapter.cjs","names":["AdvancedMethods","EnvaptError","resolveRequired","resolveKeyInput","templateResolver"],"sources":["../../../src/engine/Envapter.ts"],"sourcesContent":["import { AdvancedMethods } from '../core';\nimport { resolveRequired } from '../core/AdvancedMethods';\nimport { resolveKeyInput, templateResolver } from '../core/engine';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nexport { Environment } from '../core';\n\n/**\n * Main configuration class for environment variable management.\n *\n * Provides both static and instance methods for retrieving typed environment variables\n * with support for template resolution, multiple .env files, and environment detection.\n *\n * Extend your own classes from this to define properties with \\@Envapt decorators and get access to environment-variable methods.\n *\n * @example\n * ```ts\n * // Static usage\n * const port = Envapter.getNumber('PORT', 3000);\n * const url = Envapter.get('API_URL', 'http://localhost');\n * const replica = Envapter.get(['READONLY_URL', 'DATABASE_URL'], 'sqlite://memory');\n *\n * // Instance usage\n * const env = new Envapter();\n * const dbUrl = env.get('DATABASE_URL', 'sqlite://memory');\n * const primaryHost = env.get(['PRIMARY_HOST', 'SECONDARY_HOST']);\n * ```\n *\n * @public\n */\nexport class Envapter extends AdvancedMethods {\n /**\n * Tagged template literal for resolving environment variables in template strings.\n *\n * @example\n * ```ts\n * // Given API_HOST=api.example.com and API_PORT=8080 in environment\n * const endpoint = Envapter.resolve`Connecting to ${'API_HOST'}:${'API_PORT'}`;\n * // Returns: \"Connecting to api.example.com:8080\"\n *\n * // Works with template variables in .env too:\n * // API_URL=https://${API_HOST}:${API_PORT}\n * const message = Envapter.resolve`Service endpoint: ${'API_URL'}`;\n * // Returns: \"Service endpoint: https://api.example.com:8080\"\n * ```\n * @see {@link https://envapt.materwelon.dev/docs/templates#the-resolve-tagged-template}\n */\n static resolve(strings: TemplateStringsArray, ...keys: string[]): string {\n const strict = Envapter.strict;\n return strings.reduce((result, string, i) => {\n const envKey = keys[i];\n if (!envKey) return result + string;\n const raw = super.get(envKey, '');\n if (strict && raw.trim() === '') {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Cannot resolve template variable \"\\${${envKey}}\": value is missing or empty.`\n );\n }\n return result + string + raw;\n }, '');\n }\n\n /**\n * @see {@link Envapter.resolve}\n */\n resolve(strings: TemplateStringsArray, ...keys: string[]): string {\n return Envapter.resolve(strings, ...keys);\n }\n\n /**\n * Assert that one or more environment variables are present and non-empty after template\n * resolution. Throws `MissingEnvValue` listing every missing key. A whitespace-only value\n * counts as missing only under strict mode.\n *\n * For a typed required read in functional code, use `Envapter.getRequired(key, converter)`.\n *\n * @example\n * ```ts\n * Envapter.require('DATABASE_URL');\n * Envapter.require('DATABASE_URL', 'API_KEY', 'SENTRY_DSN');\n * ```\n */\n static require(...keys: [string, ...string[]]): void {\n const missing = keys.filter((k) => resolveRequired(resolveKeyInput(k), templateResolver).value === undefined);\n\n if (missing.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Missing required environment variables: ${missing.join(', ')}.`\n );\n }\n }\n\n /**\n * @see {@link Envapter.require}\n */\n require(...keys: [string, ...string[]]): void {\n Envapter.require(...keys);\n }\n}\n"],"mappings":"wJA8BA,IAAa,EAAb,MAAa,UAAiBA,EAAAA,eAAgB,CAiB1C,OAAO,QAAQ,EAA+B,GAAG,EAAwB,CACrE,IAAM,EAAS,EAAS,OACxB,OAAO,EAAQ,QAAQ,EAAQ,EAAQ,IAAM,CACzC,IAAM,EAAS,EAAK,GACpB,GAAI,CAAC,EAAQ,OAAO,EAAS,EAC7B,IAAM,EAAM,MAAM,IAAI,EAAQ,EAAE,EAChC,GAAI,GAAU,EAAI,KAAK,IAAM,GACzB,MAAM,IAAIC,EAAAA,YAAAA,IAEN,wCAAwC,EAAO,+BACnD,EAEJ,OAAO,EAAS,EAAS,CAC7B,EAAG,EAAE,CACT,CAKA,QAAQ,EAA+B,GAAG,EAAwB,CAC9D,OAAO,EAAS,QAAQ,EAAS,GAAG,CAAI,CAC5C,CAeA,OAAO,QAAQ,GAAG,EAAmC,CACjD,IAAM,EAAU,EAAK,OAAQ,GAAMC,EAAAA,gBAAgBC,EAAAA,gBAAgB,CAAC,EAAGC,EAAAA,gBAAgB,CAAC,CAAC,QAAU,IAAA,EAAS,EAE5G,GAAI,EAAQ,OAAS,EACjB,MAAM,IAAIH,EAAAA,YAAAA,IAEN,2CAA2C,EAAQ,KAAK,IAAI,EAAE,EAClE,CAER,CAKA,QAAQ,GAAG,EAAmC,CAC1C,EAAS,QAAQ,GAAG,CAAI,CAC5B,CACJ"}
@@ -1,2 +1,2 @@
1
- import{EnvaptError as e}from"../infra/Error.mjs";import"../core/EnvapterBase.mjs";import"../core/EnvironmentMethods.mjs";import{AdvancedMethods as t}from"../core/AdvancedMethods.mjs";var n=class n extends t{static resolve(t,...r){let i=n.strict;return t.reduce((t,n,a)=>{let o=r[a];if(!o)return t+n;let s=super.get(o,``);if(i&&s.trim()===``)throw new e(305,`Cannot resolve template variable "\${${o}}": value is missing or empty.`);return t+n+s},``)}resolve(e,...t){return n.resolve(e,...t)}static require(...t){let r=[];for(let e of t)n.resolveAndValidate(e)===void 0&&r.push(e);if(r.length>0)throw new e(305,`Missing required environment variables: ${r.join(`, `)}.`)}static resolveAndValidate(e){let{value:t}=this.resolveKeyInput(e);if(t===void 0)return;let n=this.templateResolver.resolveTemplate(e,t);if(n.trim()!==``)return n}require(...e){n.require(...e)}};export{n as Envapter};
1
+ import{EnvaptError as e}from"../infra/Error.mjs";import"../core/Environment.mjs";import{resolveKeyInput as t,templateResolver as n}from"../core/engine.mjs";import{AdvancedMethods as r,resolveRequired as i}from"../core/AdvancedMethods.mjs";var a=class a extends r{static resolve(t,...n){let r=a.strict;return t.reduce((t,i,a)=>{let o=n[a];if(!o)return t+i;let s=super.get(o,``);if(r&&s.trim()===``)throw new e(305,`Cannot resolve template variable "\${${o}}": value is missing or empty.`);return t+i+s},``)}resolve(e,...t){return a.resolve(e,...t)}static require(...r){let a=r.filter(e=>i(t(e),n).value===void 0);if(a.length>0)throw new e(305,`Missing required environment variables: ${a.join(`, `)}.`)}require(...e){a.require(...e)}};export{a as Envapter};
2
2
  //# sourceMappingURL=Envapter.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Envapter.mjs","names":[],"sources":["../../../src/engine/Envapter.ts"],"sourcesContent":["import { AdvancedMethods } from '../core';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nexport { EnvaptCache, Environment } from '../core';\n\n/**\n * Main configuration class for environment variable management.\n *\n * Provides both static and instance methods for retrieving typed environment variables\n * with support for template resolution, multiple .env files, and environment detection.\n *\n * Extend your own classes from this to define properties with \\@Envapt decorators and get access to environment-variable methods.\n *\n * @example\n * ```ts\n * // Static usage\n * const port = Envapter.getNumber('PORT', 3000);\n * const url = Envapter.get('API_URL', 'http://localhost');\n * const replica = Envapter.get(['READONLY_URL', 'DATABASE_URL'], 'sqlite://memory');\n *\n * // Instance usage\n * const env = new Envapter();\n * const dbUrl = env.get('DATABASE_URL', 'sqlite://memory');\n * const primaryHost = env.get(['PRIMARY_HOST', 'SECONDARY_HOST']);\n * ```\n *\n * @public\n */\nexport class Envapter extends AdvancedMethods {\n /**\n * Tagged template literal for resolving environment variables in template strings.\n *\n * @example\n * ```ts\n * // Given API_HOST=api.example.com and API_PORT=8080 in environment\n * const endpoint = Envapter.resolve`Connecting to ${'API_HOST'}:${'API_PORT'}`;\n * // Returns: \"Connecting to api.example.com:8080\"\n *\n * // Works with template variables in .env too:\n * // API_URL=https://${API_HOST}:${API_PORT}\n * const message = Envapter.resolve`Service endpoint: ${'API_URL'}`;\n * // Returns: \"Service endpoint: https://api.example.com:8080\"\n * ```\n */\n static resolve(strings: TemplateStringsArray, ...keys: string[]): string {\n const strict = Envapter.strict;\n return strings.reduce((result, string, i) => {\n const envKey = keys[i];\n if (!envKey) return result + string;\n const raw = super.get(envKey, '');\n if (strict && raw.trim() === '') {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Cannot resolve template variable \"\\${${envKey}}\": value is missing or empty.`\n );\n }\n return result + string + raw;\n }, '');\n }\n\n /**\n * @see {@link Envapter.resolve}\n */\n resolve(strings: TemplateStringsArray, ...keys: string[]): string {\n return Envapter.resolve(strings, ...keys);\n }\n\n /**\n * Assert that one or more environment variables are present and non-empty (post-trim,\n * after template resolution). Throws `MissingEnvValue` listing every missing key.\n *\n * For typed fail-fast in functional code, use `Envapter.getUsing(key, { converter, required: true })`.\n *\n * @example\n * ```ts\n * Envapter.require('DATABASE_URL');\n * Envapter.require('DATABASE_URL', 'API_KEY', 'SENTRY_DSN');\n * ```\n */\n static require(...keys: [string, ...string[]]): void {\n const missing: string[] = [];\n for (const k of keys) {\n if (Envapter.resolveAndValidate(k) === undefined) missing.push(k);\n }\n\n if (missing.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Missing required environment variables: ${missing.join(', ')}.`\n );\n }\n }\n\n private static resolveAndValidate(key: string): string | undefined {\n const { value } = this.resolveKeyInput(key);\n if (value === undefined) return undefined;\n const resolved = this.templateResolver.resolveTemplate(key, value);\n if (resolved.trim() === '') return undefined;\n return resolved;\n }\n\n /**\n * @see {@link Envapter.require}\n */\n require(...keys: [string, ...string[]]): void {\n Envapter.require(...keys);\n }\n}\n"],"mappings":"uLA4BA,IAAa,EAAb,MAAa,UAAiB,CAAgB,CAgB1C,OAAO,QAAQ,EAA+B,GAAG,EAAwB,CACrE,IAAM,EAAS,EAAS,OACxB,OAAO,EAAQ,QAAQ,EAAQ,EAAQ,IAAM,CACzC,IAAM,EAAS,EAAK,GACpB,GAAI,CAAC,EAAQ,OAAO,EAAS,EAC7B,IAAM,EAAM,MAAM,IAAI,EAAQ,EAAE,EAChC,GAAI,GAAU,EAAI,KAAK,IAAM,GACzB,MAAM,IAAI,EAAA,IAEN,wCAAwC,EAAO,+BACnD,EAEJ,OAAO,EAAS,EAAS,CAC7B,EAAG,EAAE,CACT,CAKA,QAAQ,EAA+B,GAAG,EAAwB,CAC9D,OAAO,EAAS,QAAQ,EAAS,GAAG,CAAI,CAC5C,CAcA,OAAO,QAAQ,GAAG,EAAmC,CACjD,IAAM,EAAoB,CAAC,EAC3B,IAAK,IAAM,KAAK,EACR,EAAS,mBAAmB,CAAC,IAAM,IAAA,IAAW,EAAQ,KAAK,CAAC,EAGpE,GAAI,EAAQ,OAAS,EACjB,MAAM,IAAI,EAAA,IAEN,2CAA2C,EAAQ,KAAK,IAAI,EAAE,EAClE,CAER,CAEA,OAAe,mBAAmB,EAAiC,CAC/D,GAAM,CAAE,SAAU,KAAK,gBAAgB,CAAG,EAC1C,GAAI,IAAU,IAAA,GAAW,OACzB,IAAM,EAAW,KAAK,iBAAiB,gBAAgB,EAAK,CAAK,EAC7D,KAAS,KAAK,IAAM,GACxB,OAAO,CACX,CAKA,QAAQ,GAAG,EAAmC,CAC1C,EAAS,QAAQ,GAAG,CAAI,CAC5B,CACJ"}
1
+ {"version":3,"file":"Envapter.mjs","names":[],"sources":["../../../src/engine/Envapter.ts"],"sourcesContent":["import { AdvancedMethods } from '../core';\nimport { resolveRequired } from '../core/AdvancedMethods';\nimport { resolveKeyInput, templateResolver } from '../core/engine';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nexport { Environment } from '../core';\n\n/**\n * Main configuration class for environment variable management.\n *\n * Provides both static and instance methods for retrieving typed environment variables\n * with support for template resolution, multiple .env files, and environment detection.\n *\n * Extend your own classes from this to define properties with \\@Envapt decorators and get access to environment-variable methods.\n *\n * @example\n * ```ts\n * // Static usage\n * const port = Envapter.getNumber('PORT', 3000);\n * const url = Envapter.get('API_URL', 'http://localhost');\n * const replica = Envapter.get(['READONLY_URL', 'DATABASE_URL'], 'sqlite://memory');\n *\n * // Instance usage\n * const env = new Envapter();\n * const dbUrl = env.get('DATABASE_URL', 'sqlite://memory');\n * const primaryHost = env.get(['PRIMARY_HOST', 'SECONDARY_HOST']);\n * ```\n *\n * @public\n */\nexport class Envapter extends AdvancedMethods {\n /**\n * Tagged template literal for resolving environment variables in template strings.\n *\n * @example\n * ```ts\n * // Given API_HOST=api.example.com and API_PORT=8080 in environment\n * const endpoint = Envapter.resolve`Connecting to ${'API_HOST'}:${'API_PORT'}`;\n * // Returns: \"Connecting to api.example.com:8080\"\n *\n * // Works with template variables in .env too:\n * // API_URL=https://${API_HOST}:${API_PORT}\n * const message = Envapter.resolve`Service endpoint: ${'API_URL'}`;\n * // Returns: \"Service endpoint: https://api.example.com:8080\"\n * ```\n * @see {@link https://envapt.materwelon.dev/docs/templates#the-resolve-tagged-template}\n */\n static resolve(strings: TemplateStringsArray, ...keys: string[]): string {\n const strict = Envapter.strict;\n return strings.reduce((result, string, i) => {\n const envKey = keys[i];\n if (!envKey) return result + string;\n const raw = super.get(envKey, '');\n if (strict && raw.trim() === '') {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Cannot resolve template variable \"\\${${envKey}}\": value is missing or empty.`\n );\n }\n return result + string + raw;\n }, '');\n }\n\n /**\n * @see {@link Envapter.resolve}\n */\n resolve(strings: TemplateStringsArray, ...keys: string[]): string {\n return Envapter.resolve(strings, ...keys);\n }\n\n /**\n * Assert that one or more environment variables are present and non-empty after template\n * resolution. Throws `MissingEnvValue` listing every missing key. A whitespace-only value\n * counts as missing only under strict mode.\n *\n * For a typed required read in functional code, use `Envapter.getRequired(key, converter)`.\n *\n * @example\n * ```ts\n * Envapter.require('DATABASE_URL');\n * Envapter.require('DATABASE_URL', 'API_KEY', 'SENTRY_DSN');\n * ```\n */\n static require(...keys: [string, ...string[]]): void {\n const missing = keys.filter((k) => resolveRequired(resolveKeyInput(k), templateResolver).value === undefined);\n\n if (missing.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Missing required environment variables: ${missing.join(', ')}.`\n );\n }\n }\n\n /**\n * @see {@link Envapter.require}\n */\n require(...keys: [string, ...string[]]): void {\n Envapter.require(...keys);\n }\n}\n"],"mappings":"+OA8BA,IAAa,EAAb,MAAa,UAAiB,CAAgB,CAiB1C,OAAO,QAAQ,EAA+B,GAAG,EAAwB,CACrE,IAAM,EAAS,EAAS,OACxB,OAAO,EAAQ,QAAQ,EAAQ,EAAQ,IAAM,CACzC,IAAM,EAAS,EAAK,GACpB,GAAI,CAAC,EAAQ,OAAO,EAAS,EAC7B,IAAM,EAAM,MAAM,IAAI,EAAQ,EAAE,EAChC,GAAI,GAAU,EAAI,KAAK,IAAM,GACzB,MAAM,IAAI,EAAA,IAEN,wCAAwC,EAAO,+BACnD,EAEJ,OAAO,EAAS,EAAS,CAC7B,EAAG,EAAE,CACT,CAKA,QAAQ,EAA+B,GAAG,EAAwB,CAC9D,OAAO,EAAS,QAAQ,EAAS,GAAG,CAAI,CAC5C,CAeA,OAAO,QAAQ,GAAG,EAAmC,CACjD,IAAM,EAAU,EAAK,OAAQ,GAAM,EAAgB,EAAgB,CAAC,EAAG,CAAgB,CAAC,CAAC,QAAU,IAAA,EAAS,EAE5G,GAAI,EAAQ,OAAS,EACjB,MAAM,IAAI,EAAA,IAEN,2CAA2C,EAAQ,KAAK,IAAI,EAAE,EAClE,CAER,CAKA,QAAQ,GAAG,EAAmC,CAC1C,EAAS,QAAQ,GAAG,CAAI,CAC5B,CACJ"}
@@ -1,2 +1,2 @@
1
- const e=require("../_virtual/_rolldown/runtime.cjs"),t=require("./Validators.cjs"),n=require("../infra/runtime.cjs"),r=require("../core/EnvapterBase.cjs"),i=require("../core/EnvironmentMethods.cjs"),a=require("./Envapter.cjs"),o=require("../sources/NodeEnvSource.cjs");let s=require("node:process");s=e.__toESM(s,1);var c=class e extends a.Envapter{static{n.setRuntimeSink(e=>s.default.stderr.write(`${e}\n`)),e.useSource(new o.NodeEnvSource)}static set envPaths(e){this.assertFileApiSupported(`envPaths`,r.EnvapterBase._source);let n=Array.isArray(e)?e:[e];t.Validator.validateEnvFilesExist(n.map(e=>this.resolveAgainstBase(e)),e=>this.sourceFileExists(e)),r.EnvapterBase._envPaths=n,r.EnvapterBase._envPathsExplicitlySet=!0,this.refreshCache()}static get envPaths(){return r.EnvapterBase._envPaths}static set baseDir(e){let t=r.EnvapterBase._source;this.assertFileApiSupported(`baseDir`,t),r.EnvapterBase._baseDir=e===void 0?void 0:t.normalizeBaseDir(e),this.refreshCache()}static get baseDir(){return r.EnvapterBase._baseDir}static set envFileOptions(e){t.Validator.validateEnvFileOptions(e),r.EnvapterBase._userDefinedEnvFileOptions=e,this.refreshCache()}static get envFileOptions(){return r.EnvapterBase._userDefinedEnvFileOptions}static configureProfiles(e){this.assertFileApiSupported(`configureProfiles`,r.EnvapterBase._source),i.EnvironmentMethods._profiles=e,this.refreshCache()}static resetProfiles(){i.EnvironmentMethods._profiles=void 0,r.EnvapterBase._envPaths=[`.env`],r.EnvapterBase._envPathsExplicitlySet=!1,this._environmentExplicitlySet=!1,this._environment=void 0,this.refreshCache()}};exports.NodeEnvapter=c;
1
+ const e=require("../_virtual/_rolldown/runtime.cjs"),t=require("../core/state.cjs"),n=require("./Validators.cjs"),r=require("../infra/runtime.cjs"),i=require("../core/paths.cjs"),a=require("../core/engine.cjs"),o=require("./Envapter.cjs"),s=require("../sources/FileSource.cjs");let c=require("node:process");c=e.__toESM(c,1);var l=class e extends o.Envapter{static{r.setRuntimeSink(e=>c.default.stderr.write(`${e}\n`)),e.useSource(new s.FileSource)}static set envPaths(e){i.assertFileApiSupported(`envPaths`,t.state.source);let r=Array.isArray(e)?e:[e];n.Validator.validateEnvFilesExist(r.map(e=>i.resolveAgainstBase(e)),e=>i.sourceFileExists(e)),t.state.envPaths=r,t.state.envPathsExplicitlySet=!0,a.refreshCache()}static get envPaths(){return t.state.envPaths}static set baseDir(e){let n=t.state.source;i.assertFileApiSupported(`baseDir`,n),t.state.baseDir=e===void 0?void 0:n.normalizeBaseDir(e),a.refreshCache()}static get baseDir(){return t.state.baseDir}static set envFileOptions(e){n.Validator.validateEnvFileOptions(e),t.state.userDefinedEnvFileOptions=e,a.refreshCache()}static get envFileOptions(){return t.state.userDefinedEnvFileOptions}static configureProfiles(e){i.assertFileApiSupported(`configureProfiles`,t.state.source),t.state.profiles=e,a.refreshCache()}static resetProfiles(){t.state.profiles=void 0,t.state.envPaths=[`.env`],t.state.envPathsExplicitlySet=!1,t.state.environmentExplicitlySet=!1,t.state.environment=void 0,a.refreshCache()}};exports.NodeEnvapter=l;
2
2
  //# sourceMappingURL=NodeEnvapter.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NodeEnvapter.cjs","names":["Envapter","process","NodeEnvSource","EnvapterBase"],"sources":["../../../src/engine/NodeEnvapter.ts"],"sourcesContent":["import process from 'node:process';\n\nimport { Envapter } from './Envapter';\nimport { Validator } from './Validators';\nimport { EnvapterBase } from '../core/EnvapterBase';\nimport { EnvironmentMethods } from '../core/EnvironmentMethods';\nimport { setRuntimeSink } from '../infra/runtime';\nimport { NodeEnvSource } from '../sources/NodeEnvSource';\n\nimport type { EnvFileOptions } from '../infra/Dotenv';\nimport type { ProfilesConfig } from '../types';\n\n/**\n * The Node/Bun/Deno facade: {@link Envapter} plus the filesystem-only configuration APIs (`.env`\n * path selection, base directory, dotenv options, and per-environment profiles). The browser and\n * Workers builds export the base {@link Envapter} without these, so calling one where there is no\n * filesystem is a compile error (and a thrown {@link EnvaptError} when types are bypassed).\n *\n * Writes target the state-owning class (`EnvapterBase`/`EnvironmentMethods`), not `this`: the engine\n * reads that state through `EnvapterBase`-anchored paths, so a subclass own-property would be invisible.\n * @public\n */\nexport class NodeEnvapter extends Envapter {\n // A static block (not a top-level statement in a separate entry) keeps the bind intrinsic to this\n // class: tree-shaken out of `import { EnvaptError }`, run whenever `Envapter` is referenced, with no\n // sideEffects entry. Depends on the es2022 native static-block emit; lowering the target defeats it.\n static {\n setRuntimeSink((line) => process.stderr.write(`${line}\\n`));\n NodeEnvapter.useSource(new NodeEnvSource());\n }\n\n /**\n * Set custom .env file paths. Accepts either a single path or array of paths.\n * Setting new paths clears the cache and reloads environment variables.\n *\n * When set, this takes absolute precedence. The dotenv-flow auto-cascade and any\n * `Envapter.configureProfiles` configuration are ignored.\n */\n static set envPaths(paths: string[] | string) {\n this.assertFileApiSupported('envPaths', EnvapterBase._source);\n const newPaths = Array.isArray(paths) ? paths : [paths];\n Validator.validateEnvFilesExist(\n newPaths.map((p) => this.resolveAgainstBase(p)),\n (p) => this.sourceFileExists(p)\n );\n\n EnvapterBase._envPaths = newPaths;\n EnvapterBase._envPathsExplicitlySet = true;\n this.refreshCache();\n }\n\n /**\n * Get currently configured .env file paths\n */\n static get envPaths(): string[] {\n return EnvapterBase._envPaths;\n }\n\n /**\n * Set a base directory that relative `.env` paths resolve against instead of\n * `process.cwd()`: the auto-cascade, `Envapter.configureProfiles` paths, and relative\n * `envPaths`. Absolute paths always bypass it. Pass a directory, or a module URL\n * (`import.meta.url`, ESM) / `import.meta.dirname` / `__dirname` (CJS) to anchor\n * resolution next to the calling file regardless of launch directory.\n *\n * Set this before `envPaths` so relative `envPaths` validate against the right directory.\n * Unset (`undefined`) restores `process.cwd()` resolution.\n */\n static set baseDir(value: string | URL | undefined) {\n const source = EnvapterBase._source;\n this.assertFileApiSupported('baseDir', source);\n EnvapterBase._baseDir = value === undefined ? undefined : source.normalizeBaseDir(value);\n this.refreshCache();\n }\n\n /** The configured base directory, or `undefined` when relative paths resolve against the working directory. */\n static get baseDir(): string | undefined {\n return EnvapterBase._baseDir;\n }\n\n /** Set the env file loader options (`encoding`, `override`). Refreshes the cache. */\n static set envFileOptions(config: EnvFileOptions) {\n Validator.validateEnvFileOptions(config);\n EnvapterBase._userDefinedEnvFileOptions = config;\n this.refreshCache();\n }\n\n /**\n * Get current env file loader options\n */\n static get envFileOptions(): EnvFileOptions {\n return EnvapterBase._userDefinedEnvFileOptions;\n }\n\n /**\n * Configure per-environment `.env` path overrides on top of the dotenv-flow auto-cascade.\n *\n * When set, each `Environment` key's `paths` are loaded at higher precedence than the\n * cascade for that environment. Unspecified environments still use the cascade as-is.\n * Set `useDefaults: false` to disable the cascade entirely (load only the configured paths).\n *\n * Setting an explicit `Envapter.envPaths` value at any point overrides this configuration.\n *\n * @example\n * ```ts\n * Envapter.configureProfiles({\n * [Environment.Staging]: { paths: 'config/staging.env' },\n * [Environment.Production]: { paths: ['config/prod.env', 'secrets/prod.env'] }\n * });\n * ```\n */\n static configureProfiles(config: ProfilesConfig): void {\n this.assertFileApiSupported('configureProfiles', EnvapterBase._source);\n EnvironmentMethods._profiles = config;\n this.refreshCache();\n }\n\n /**\n * Reset all path-resolution configuration to defaults: clears any prior\n * `Envapter.configureProfiles` call AND any explicit `Envapter.envPaths` assignment.\n * Returns the resolver to the pure dotenv-flow cascade.\n */\n static resetProfiles(): void {\n EnvironmentMethods._profiles = undefined;\n EnvapterBase._envPaths = ['.env'];\n EnvapterBase._envPathsExplicitlySet = false;\n // Clear via `this`, not EnvironmentMethods: determineEnvironment writes `_environment*` via\n // `this`, so a base-anchored clear would leave a subclass own-property shadowing it.\n this._environmentExplicitlySet = false;\n this._environment = undefined;\n this.refreshCache();\n }\n}\n"],"mappings":"4TAsBA,IAAa,EAAb,MAAa,UAAqBA,EAAAA,QAAS,CAIvC,OACI,EAAA,eAAgB,GAASC,EAAAA,QAAQ,OAAO,MAAM,GAAG,EAAK,GAAG,CAAC,EAC1D,EAAa,UAAU,IAAIC,EAAAA,aAAe,CAC9C,CASA,WAAW,SAAS,EAA0B,CAC1C,KAAK,uBAAuB,WAAYC,EAAAA,aAAa,OAAO,EAC5D,IAAM,EAAW,MAAM,QAAQ,CAAK,EAAI,EAAQ,CAAC,CAAK,EACtD,EAAA,UAAU,sBACN,EAAS,IAAK,GAAM,KAAK,mBAAmB,CAAC,CAAC,EAC7C,GAAM,KAAK,iBAAiB,CAAC,CAClC,EAEA,EAAA,aAAa,UAAY,EACzB,EAAA,aAAa,uBAAyB,GACtC,KAAK,aAAa,CACtB,CAKA,WAAW,UAAqB,CAC5B,OAAOA,EAAAA,aAAa,SACxB,CAYA,WAAW,QAAQ,EAAiC,CAChD,IAAM,EAASA,EAAAA,aAAa,QAC5B,KAAK,uBAAuB,UAAW,CAAM,EAC7C,EAAA,aAAa,SAAW,IAAU,IAAA,GAAY,IAAA,GAAY,EAAO,iBAAiB,CAAK,EACvF,KAAK,aAAa,CACtB,CAGA,WAAW,SAA8B,CACrC,OAAOA,EAAAA,aAAa,QACxB,CAGA,WAAW,eAAe,EAAwB,CAC9C,EAAA,UAAU,uBAAuB,CAAM,EACvC,EAAA,aAAa,2BAA6B,EAC1C,KAAK,aAAa,CACtB,CAKA,WAAW,gBAAiC,CACxC,OAAOA,EAAAA,aAAa,0BACxB,CAmBA,OAAO,kBAAkB,EAA8B,CACnD,KAAK,uBAAuB,oBAAqBA,EAAAA,aAAa,OAAO,EACrE,EAAA,mBAAmB,UAAY,EAC/B,KAAK,aAAa,CACtB,CAOA,OAAO,eAAsB,CACzB,EAAA,mBAAmB,UAAY,IAAA,GAC/B,EAAA,aAAa,UAAY,CAAC,MAAM,EAChC,EAAA,aAAa,uBAAyB,GAGtC,KAAK,0BAA4B,GACjC,KAAK,aAAe,IAAA,GACpB,KAAK,aAAa,CACtB,CACJ"}
1
+ {"version":3,"file":"NodeEnvapter.cjs","names":["Envapter","process","FileSource","state","resolveAgainstBase","sourceFileExists"],"sources":["../../../src/engine/NodeEnvapter.ts"],"sourcesContent":["import process from 'node:process';\n\nimport { Envapter } from './Envapter';\nimport { Validator } from './Validators';\nimport { refreshCache } from '../core/engine';\nimport { assertFileApiSupported, resolveAgainstBase, sourceFileExists } from '../core/paths';\nimport { state } from '../core/state';\nimport { setRuntimeSink } from '../infra/runtime';\nimport { FileSource } from '../sources/FileSource';\n\nimport type { EnvFileOptions } from '../infra/Dotenv';\nimport type { ProfilesConfig } from '../types';\n\n/**\n * The Node/Bun/Deno facade: {@link Envapter} plus the filesystem-only configuration APIs (`.env`\n * path selection, base directory, dotenv options, and per-environment profiles). On the portable\n * build (Workers, the browser, edge) these same APIs warn once and no-op by default, controlled by\n * `Envapter.fileApiMode`.\n * @public\n */\nexport class NodeEnvapter extends Envapter {\n // A static block (not a top-level statement in a separate entry) keeps the bind intrinsic to this\n // class: tree-shaken out of `import { EnvaptError }`, run whenever `Envapter` is referenced, with no\n // sideEffects entry. Depends on the es2022 native static-block emit.\n static {\n setRuntimeSink((line) => process.stderr.write(`${line}\\n`));\n NodeEnvapter.useSource(new FileSource());\n }\n\n /**\n * Set custom .env file paths. Accepts either a single path or array of paths.\n * Setting new paths clears the cache and reloads environment variables.\n *\n * When set, this takes absolute precedence. The dotenv-flow auto-cascade and any\n * `Envapter.configureProfiles` configuration are ignored.\n * @see {@link https://envapt.materwelon.dev/docs/configuration#which-files-load}\n */\n static set envPaths(paths: string[] | string) {\n assertFileApiSupported('envPaths', state.source);\n const newPaths = Array.isArray(paths) ? paths : [paths];\n Validator.validateEnvFilesExist(\n newPaths.map((p) => resolveAgainstBase(p)),\n (p) => sourceFileExists(p)\n );\n\n state.envPaths = newPaths;\n state.envPathsExplicitlySet = true;\n refreshCache();\n }\n\n /**\n * Get currently configured .env file paths\n * @see {@link https://envapt.materwelon.dev/docs/configuration#which-files-load}\n */\n static get envPaths(): string[] {\n return state.envPaths;\n }\n\n /**\n * Set a base directory that relative `.env` paths resolve against instead of\n * `process.cwd()`: the auto-cascade, `Envapter.configureProfiles` paths, and relative\n * `envPaths`. Absolute paths always bypass it. Pass a directory, or a module URL\n * (`import.meta.url`, ESM) / `import.meta.dirname` / `__dirname` (CJS) to anchor\n * resolution next to the calling file regardless of launch directory.\n *\n * Set this before `envPaths` so relative `envPaths` validate against the right directory.\n * Unset (`undefined`) restores `process.cwd()` resolution.\n * @see {@link https://envapt.materwelon.dev/docs/configuration#reading-from-a-fixed-directory}\n */\n static set baseDir(value: string | URL | undefined) {\n const source = state.source;\n assertFileApiSupported('baseDir', source);\n state.baseDir = value === undefined ? undefined : source.normalizeBaseDir(value);\n refreshCache();\n }\n\n /**\n * The configured base directory, or `undefined` when relative paths resolve against the working directory.\n * @see {@link https://envapt.materwelon.dev/docs/configuration#reading-from-a-fixed-directory}\n */\n static get baseDir(): string | undefined {\n return state.baseDir;\n }\n\n /**\n * Set the env file loader options (`encoding`, `override`). Refreshes the cache.\n * @see {@link https://envapt.materwelon.dev/docs/configuration#which-files-load}\n */\n static set envFileOptions(config: EnvFileOptions) {\n Validator.validateEnvFileOptions(config);\n state.userDefinedEnvFileOptions = config;\n refreshCache();\n }\n\n /**\n * Get current env file loader options\n * @see {@link https://envapt.materwelon.dev/docs/configuration#which-files-load}\n */\n static get envFileOptions(): EnvFileOptions {\n return state.userDefinedEnvFileOptions;\n }\n\n /**\n * Configure per-environment `.env` path overrides on top of the dotenv-flow auto-cascade.\n *\n * When set, each `Environment` key's `paths` are loaded at higher precedence than the\n * cascade for that environment. Unspecified environments still use the cascade as-is.\n * Set `useDefaults: false` to disable the cascade entirely (load only the configured paths).\n *\n * Setting an explicit `Envapter.envPaths` value at any point overrides this configuration.\n *\n * @example\n * ```ts\n * Envapter.configureProfiles({\n * [Environment.Staging]: { paths: 'config/staging.env' },\n * [Environment.Production]: { paths: ['config/prod.env', 'secrets/prod.env'] }\n * });\n * ```\n * @see {@link https://envapt.materwelon.dev/docs/environment#custom-profiles}\n */\n static configureProfiles(config: ProfilesConfig): void {\n assertFileApiSupported('configureProfiles', state.source);\n state.profiles = config;\n refreshCache();\n }\n\n /**\n * Reset all path-resolution configuration to defaults: clears any prior\n * `Envapter.configureProfiles` call AND any explicit `Envapter.envPaths` assignment.\n * Returns the resolver to the pure dotenv-flow cascade.\n * @see {@link https://envapt.materwelon.dev/docs/environment#custom-profiles}\n */\n static resetProfiles(): void {\n state.profiles = undefined;\n state.envPaths = ['.env'];\n state.envPathsExplicitlySet = false;\n state.environmentExplicitlySet = false;\n state.environment = undefined;\n refreshCache();\n }\n}\n"],"mappings":"qUAoBA,IAAa,EAAb,MAAa,UAAqBA,EAAAA,QAAS,CAIvC,OACI,EAAA,eAAgB,GAASC,EAAAA,QAAQ,OAAO,MAAM,GAAG,EAAK,GAAG,CAAC,EAC1D,EAAa,UAAU,IAAIC,EAAAA,UAAY,CAC3C,CAUA,WAAW,SAAS,EAA0B,CAC1C,EAAA,uBAAuB,WAAYC,EAAAA,MAAM,MAAM,EAC/C,IAAM,EAAW,MAAM,QAAQ,CAAK,EAAI,EAAQ,CAAC,CAAK,EACtD,EAAA,UAAU,sBACN,EAAS,IAAK,GAAMC,EAAAA,mBAAmB,CAAC,CAAC,EACxC,GAAMC,EAAAA,iBAAiB,CAAC,CAC7B,EAEA,EAAA,MAAM,SAAW,EACjB,EAAA,MAAM,sBAAwB,GAC9B,EAAA,aAAa,CACjB,CAMA,WAAW,UAAqB,CAC5B,OAAOF,EAAAA,MAAM,QACjB,CAaA,WAAW,QAAQ,EAAiC,CAChD,IAAM,EAASA,EAAAA,MAAM,OACrB,EAAA,uBAAuB,UAAW,CAAM,EACxC,EAAA,MAAM,QAAU,IAAU,IAAA,GAAY,IAAA,GAAY,EAAO,iBAAiB,CAAK,EAC/E,EAAA,aAAa,CACjB,CAMA,WAAW,SAA8B,CACrC,OAAOA,EAAAA,MAAM,OACjB,CAMA,WAAW,eAAe,EAAwB,CAC9C,EAAA,UAAU,uBAAuB,CAAM,EACvC,EAAA,MAAM,0BAA4B,EAClC,EAAA,aAAa,CACjB,CAMA,WAAW,gBAAiC,CACxC,OAAOA,EAAAA,MAAM,yBACjB,CAoBA,OAAO,kBAAkB,EAA8B,CACnD,EAAA,uBAAuB,oBAAqBA,EAAAA,MAAM,MAAM,EACxD,EAAA,MAAM,SAAW,EACjB,EAAA,aAAa,CACjB,CAQA,OAAO,eAAsB,CACzB,EAAA,MAAM,SAAW,IAAA,GACjB,EAAA,MAAM,SAAW,CAAC,MAAM,EACxB,EAAA,MAAM,sBAAwB,GAC9B,EAAA,MAAM,yBAA2B,GACjC,EAAA,MAAM,YAAc,IAAA,GACpB,EAAA,aAAa,CACjB,CACJ"}
@@ -1,2 +1,2 @@
1
- import{Validator as e}from"./Validators.mjs";import{setRuntimeSink as t}from"../infra/runtime.mjs";import{EnvapterBase as n}from"../core/EnvapterBase.mjs";import{EnvironmentMethods as r}from"../core/EnvironmentMethods.mjs";import{Envapter as i}from"./Envapter.mjs";import{NodeEnvSource as a}from"../sources/NodeEnvSource.mjs";import o from"node:process";var s=class s extends i{static{t(e=>o.stderr.write(`${e}\n`)),s.useSource(new a)}static set envPaths(t){this.assertFileApiSupported(`envPaths`,n._source);let r=Array.isArray(t)?t:[t];e.validateEnvFilesExist(r.map(e=>this.resolveAgainstBase(e)),e=>this.sourceFileExists(e)),n._envPaths=r,n._envPathsExplicitlySet=!0,this.refreshCache()}static get envPaths(){return n._envPaths}static set baseDir(e){let t=n._source;this.assertFileApiSupported(`baseDir`,t),n._baseDir=e===void 0?void 0:t.normalizeBaseDir(e),this.refreshCache()}static get baseDir(){return n._baseDir}static set envFileOptions(t){e.validateEnvFileOptions(t),n._userDefinedEnvFileOptions=t,this.refreshCache()}static get envFileOptions(){return n._userDefinedEnvFileOptions}static configureProfiles(e){this.assertFileApiSupported(`configureProfiles`,n._source),r._profiles=e,this.refreshCache()}static resetProfiles(){r._profiles=void 0,n._envPaths=[`.env`],n._envPathsExplicitlySet=!1,this._environmentExplicitlySet=!1,this._environment=void 0,this.refreshCache()}};export{s as NodeEnvapter};
1
+ import{state as e}from"../core/state.mjs";import{Validator as t}from"./Validators.mjs";import{setRuntimeSink as n}from"../infra/runtime.mjs";import{assertFileApiSupported as r,resolveAgainstBase as i,sourceFileExists as a}from"../core/paths.mjs";import{refreshCache as o}from"../core/engine.mjs";import{Envapter as s}from"./Envapter.mjs";import{FileSource as c}from"../sources/FileSource.mjs";import l from"node:process";var u=class u extends s{static{n(e=>l.stderr.write(`${e}\n`)),u.useSource(new c)}static set envPaths(n){r(`envPaths`,e.source);let s=Array.isArray(n)?n:[n];t.validateEnvFilesExist(s.map(e=>i(e)),e=>a(e)),e.envPaths=s,e.envPathsExplicitlySet=!0,o()}static get envPaths(){return e.envPaths}static set baseDir(t){let n=e.source;r(`baseDir`,n),e.baseDir=t===void 0?void 0:n.normalizeBaseDir(t),o()}static get baseDir(){return e.baseDir}static set envFileOptions(n){t.validateEnvFileOptions(n),e.userDefinedEnvFileOptions=n,o()}static get envFileOptions(){return e.userDefinedEnvFileOptions}static configureProfiles(t){r(`configureProfiles`,e.source),e.profiles=t,o()}static resetProfiles(){e.profiles=void 0,e.envPaths=[`.env`],e.envPathsExplicitlySet=!1,e.environmentExplicitlySet=!1,e.environment=void 0,o()}};export{u as NodeEnvapter};
2
2
  //# sourceMappingURL=NodeEnvapter.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NodeEnvapter.mjs","names":[],"sources":["../../../src/engine/NodeEnvapter.ts"],"sourcesContent":["import process from 'node:process';\n\nimport { Envapter } from './Envapter';\nimport { Validator } from './Validators';\nimport { EnvapterBase } from '../core/EnvapterBase';\nimport { EnvironmentMethods } from '../core/EnvironmentMethods';\nimport { setRuntimeSink } from '../infra/runtime';\nimport { NodeEnvSource } from '../sources/NodeEnvSource';\n\nimport type { EnvFileOptions } from '../infra/Dotenv';\nimport type { ProfilesConfig } from '../types';\n\n/**\n * The Node/Bun/Deno facade: {@link Envapter} plus the filesystem-only configuration APIs (`.env`\n * path selection, base directory, dotenv options, and per-environment profiles). The browser and\n * Workers builds export the base {@link Envapter} without these, so calling one where there is no\n * filesystem is a compile error (and a thrown {@link EnvaptError} when types are bypassed).\n *\n * Writes target the state-owning class (`EnvapterBase`/`EnvironmentMethods`), not `this`: the engine\n * reads that state through `EnvapterBase`-anchored paths, so a subclass own-property would be invisible.\n * @public\n */\nexport class NodeEnvapter extends Envapter {\n // A static block (not a top-level statement in a separate entry) keeps the bind intrinsic to this\n // class: tree-shaken out of `import { EnvaptError }`, run whenever `Envapter` is referenced, with no\n // sideEffects entry. Depends on the es2022 native static-block emit; lowering the target defeats it.\n static {\n setRuntimeSink((line) => process.stderr.write(`${line}\\n`));\n NodeEnvapter.useSource(new NodeEnvSource());\n }\n\n /**\n * Set custom .env file paths. Accepts either a single path or array of paths.\n * Setting new paths clears the cache and reloads environment variables.\n *\n * When set, this takes absolute precedence. The dotenv-flow auto-cascade and any\n * `Envapter.configureProfiles` configuration are ignored.\n */\n static set envPaths(paths: string[] | string) {\n this.assertFileApiSupported('envPaths', EnvapterBase._source);\n const newPaths = Array.isArray(paths) ? paths : [paths];\n Validator.validateEnvFilesExist(\n newPaths.map((p) => this.resolveAgainstBase(p)),\n (p) => this.sourceFileExists(p)\n );\n\n EnvapterBase._envPaths = newPaths;\n EnvapterBase._envPathsExplicitlySet = true;\n this.refreshCache();\n }\n\n /**\n * Get currently configured .env file paths\n */\n static get envPaths(): string[] {\n return EnvapterBase._envPaths;\n }\n\n /**\n * Set a base directory that relative `.env` paths resolve against instead of\n * `process.cwd()`: the auto-cascade, `Envapter.configureProfiles` paths, and relative\n * `envPaths`. Absolute paths always bypass it. Pass a directory, or a module URL\n * (`import.meta.url`, ESM) / `import.meta.dirname` / `__dirname` (CJS) to anchor\n * resolution next to the calling file regardless of launch directory.\n *\n * Set this before `envPaths` so relative `envPaths` validate against the right directory.\n * Unset (`undefined`) restores `process.cwd()` resolution.\n */\n static set baseDir(value: string | URL | undefined) {\n const source = EnvapterBase._source;\n this.assertFileApiSupported('baseDir', source);\n EnvapterBase._baseDir = value === undefined ? undefined : source.normalizeBaseDir(value);\n this.refreshCache();\n }\n\n /** The configured base directory, or `undefined` when relative paths resolve against the working directory. */\n static get baseDir(): string | undefined {\n return EnvapterBase._baseDir;\n }\n\n /** Set the env file loader options (`encoding`, `override`). Refreshes the cache. */\n static set envFileOptions(config: EnvFileOptions) {\n Validator.validateEnvFileOptions(config);\n EnvapterBase._userDefinedEnvFileOptions = config;\n this.refreshCache();\n }\n\n /**\n * Get current env file loader options\n */\n static get envFileOptions(): EnvFileOptions {\n return EnvapterBase._userDefinedEnvFileOptions;\n }\n\n /**\n * Configure per-environment `.env` path overrides on top of the dotenv-flow auto-cascade.\n *\n * When set, each `Environment` key's `paths` are loaded at higher precedence than the\n * cascade for that environment. Unspecified environments still use the cascade as-is.\n * Set `useDefaults: false` to disable the cascade entirely (load only the configured paths).\n *\n * Setting an explicit `Envapter.envPaths` value at any point overrides this configuration.\n *\n * @example\n * ```ts\n * Envapter.configureProfiles({\n * [Environment.Staging]: { paths: 'config/staging.env' },\n * [Environment.Production]: { paths: ['config/prod.env', 'secrets/prod.env'] }\n * });\n * ```\n */\n static configureProfiles(config: ProfilesConfig): void {\n this.assertFileApiSupported('configureProfiles', EnvapterBase._source);\n EnvironmentMethods._profiles = config;\n this.refreshCache();\n }\n\n /**\n * Reset all path-resolution configuration to defaults: clears any prior\n * `Envapter.configureProfiles` call AND any explicit `Envapter.envPaths` assignment.\n * Returns the resolver to the pure dotenv-flow cascade.\n */\n static resetProfiles(): void {\n EnvironmentMethods._profiles = undefined;\n EnvapterBase._envPaths = ['.env'];\n EnvapterBase._envPathsExplicitlySet = false;\n // Clear via `this`, not EnvironmentMethods: determineEnvironment writes `_environment*` via\n // `this`, so a base-anchored clear would leave a subclass own-property shadowing it.\n this._environmentExplicitlySet = false;\n this._environment = undefined;\n this.refreshCache();\n }\n}\n"],"mappings":"kWAsBA,IAAa,EAAb,MAAa,UAAqB,CAAS,CAIvC,OACI,EAAgB,GAAS,EAAQ,OAAO,MAAM,GAAG,EAAK,GAAG,CAAC,EAC1D,EAAa,UAAU,IAAI,CAAe,CAC9C,CASA,WAAW,SAAS,EAA0B,CAC1C,KAAK,uBAAuB,WAAY,EAAa,OAAO,EAC5D,IAAM,EAAW,MAAM,QAAQ,CAAK,EAAI,EAAQ,CAAC,CAAK,EACtD,EAAU,sBACN,EAAS,IAAK,GAAM,KAAK,mBAAmB,CAAC,CAAC,EAC7C,GAAM,KAAK,iBAAiB,CAAC,CAClC,EAEA,EAAa,UAAY,EACzB,EAAa,uBAAyB,GACtC,KAAK,aAAa,CACtB,CAKA,WAAW,UAAqB,CAC5B,OAAO,EAAa,SACxB,CAYA,WAAW,QAAQ,EAAiC,CAChD,IAAM,EAAS,EAAa,QAC5B,KAAK,uBAAuB,UAAW,CAAM,EAC7C,EAAa,SAAW,IAAU,IAAA,GAAY,IAAA,GAAY,EAAO,iBAAiB,CAAK,EACvF,KAAK,aAAa,CACtB,CAGA,WAAW,SAA8B,CACrC,OAAO,EAAa,QACxB,CAGA,WAAW,eAAe,EAAwB,CAC9C,EAAU,uBAAuB,CAAM,EACvC,EAAa,2BAA6B,EAC1C,KAAK,aAAa,CACtB,CAKA,WAAW,gBAAiC,CACxC,OAAO,EAAa,0BACxB,CAmBA,OAAO,kBAAkB,EAA8B,CACnD,KAAK,uBAAuB,oBAAqB,EAAa,OAAO,EACrE,EAAmB,UAAY,EAC/B,KAAK,aAAa,CACtB,CAOA,OAAO,eAAsB,CACzB,EAAmB,UAAY,IAAA,GAC/B,EAAa,UAAY,CAAC,MAAM,EAChC,EAAa,uBAAyB,GAGtC,KAAK,0BAA4B,GACjC,KAAK,aAAe,IAAA,GACpB,KAAK,aAAa,CACtB,CACJ"}
1
+ {"version":3,"file":"NodeEnvapter.mjs","names":[],"sources":["../../../src/engine/NodeEnvapter.ts"],"sourcesContent":["import process from 'node:process';\n\nimport { Envapter } from './Envapter';\nimport { Validator } from './Validators';\nimport { refreshCache } from '../core/engine';\nimport { assertFileApiSupported, resolveAgainstBase, sourceFileExists } from '../core/paths';\nimport { state } from '../core/state';\nimport { setRuntimeSink } from '../infra/runtime';\nimport { FileSource } from '../sources/FileSource';\n\nimport type { EnvFileOptions } from '../infra/Dotenv';\nimport type { ProfilesConfig } from '../types';\n\n/**\n * The Node/Bun/Deno facade: {@link Envapter} plus the filesystem-only configuration APIs (`.env`\n * path selection, base directory, dotenv options, and per-environment profiles). On the portable\n * build (Workers, the browser, edge) these same APIs warn once and no-op by default, controlled by\n * `Envapter.fileApiMode`.\n * @public\n */\nexport class NodeEnvapter extends Envapter {\n // A static block (not a top-level statement in a separate entry) keeps the bind intrinsic to this\n // class: tree-shaken out of `import { EnvaptError }`, run whenever `Envapter` is referenced, with no\n // sideEffects entry. Depends on the es2022 native static-block emit.\n static {\n setRuntimeSink((line) => process.stderr.write(`${line}\\n`));\n NodeEnvapter.useSource(new FileSource());\n }\n\n /**\n * Set custom .env file paths. Accepts either a single path or array of paths.\n * Setting new paths clears the cache and reloads environment variables.\n *\n * When set, this takes absolute precedence. The dotenv-flow auto-cascade and any\n * `Envapter.configureProfiles` configuration are ignored.\n * @see {@link https://envapt.materwelon.dev/docs/configuration#which-files-load}\n */\n static set envPaths(paths: string[] | string) {\n assertFileApiSupported('envPaths', state.source);\n const newPaths = Array.isArray(paths) ? paths : [paths];\n Validator.validateEnvFilesExist(\n newPaths.map((p) => resolveAgainstBase(p)),\n (p) => sourceFileExists(p)\n );\n\n state.envPaths = newPaths;\n state.envPathsExplicitlySet = true;\n refreshCache();\n }\n\n /**\n * Get currently configured .env file paths\n * @see {@link https://envapt.materwelon.dev/docs/configuration#which-files-load}\n */\n static get envPaths(): string[] {\n return state.envPaths;\n }\n\n /**\n * Set a base directory that relative `.env` paths resolve against instead of\n * `process.cwd()`: the auto-cascade, `Envapter.configureProfiles` paths, and relative\n * `envPaths`. Absolute paths always bypass it. Pass a directory, or a module URL\n * (`import.meta.url`, ESM) / `import.meta.dirname` / `__dirname` (CJS) to anchor\n * resolution next to the calling file regardless of launch directory.\n *\n * Set this before `envPaths` so relative `envPaths` validate against the right directory.\n * Unset (`undefined`) restores `process.cwd()` resolution.\n * @see {@link https://envapt.materwelon.dev/docs/configuration#reading-from-a-fixed-directory}\n */\n static set baseDir(value: string | URL | undefined) {\n const source = state.source;\n assertFileApiSupported('baseDir', source);\n state.baseDir = value === undefined ? undefined : source.normalizeBaseDir(value);\n refreshCache();\n }\n\n /**\n * The configured base directory, or `undefined` when relative paths resolve against the working directory.\n * @see {@link https://envapt.materwelon.dev/docs/configuration#reading-from-a-fixed-directory}\n */\n static get baseDir(): string | undefined {\n return state.baseDir;\n }\n\n /**\n * Set the env file loader options (`encoding`, `override`). Refreshes the cache.\n * @see {@link https://envapt.materwelon.dev/docs/configuration#which-files-load}\n */\n static set envFileOptions(config: EnvFileOptions) {\n Validator.validateEnvFileOptions(config);\n state.userDefinedEnvFileOptions = config;\n refreshCache();\n }\n\n /**\n * Get current env file loader options\n * @see {@link https://envapt.materwelon.dev/docs/configuration#which-files-load}\n */\n static get envFileOptions(): EnvFileOptions {\n return state.userDefinedEnvFileOptions;\n }\n\n /**\n * Configure per-environment `.env` path overrides on top of the dotenv-flow auto-cascade.\n *\n * When set, each `Environment` key's `paths` are loaded at higher precedence than the\n * cascade for that environment. Unspecified environments still use the cascade as-is.\n * Set `useDefaults: false` to disable the cascade entirely (load only the configured paths).\n *\n * Setting an explicit `Envapter.envPaths` value at any point overrides this configuration.\n *\n * @example\n * ```ts\n * Envapter.configureProfiles({\n * [Environment.Staging]: { paths: 'config/staging.env' },\n * [Environment.Production]: { paths: ['config/prod.env', 'secrets/prod.env'] }\n * });\n * ```\n * @see {@link https://envapt.materwelon.dev/docs/environment#custom-profiles}\n */\n static configureProfiles(config: ProfilesConfig): void {\n assertFileApiSupported('configureProfiles', state.source);\n state.profiles = config;\n refreshCache();\n }\n\n /**\n * Reset all path-resolution configuration to defaults: clears any prior\n * `Envapter.configureProfiles` call AND any explicit `Envapter.envPaths` assignment.\n * Returns the resolver to the pure dotenv-flow cascade.\n * @see {@link https://envapt.materwelon.dev/docs/environment#custom-profiles}\n */\n static resetProfiles(): void {\n state.profiles = undefined;\n state.envPaths = ['.env'];\n state.envPathsExplicitlySet = false;\n state.environmentExplicitlySet = false;\n state.environment = undefined;\n refreshCache();\n }\n}\n"],"mappings":"qaAoBA,IAAa,EAAb,MAAa,UAAqB,CAAS,CAIvC,OACI,EAAgB,GAAS,EAAQ,OAAO,MAAM,GAAG,EAAK,GAAG,CAAC,EAC1D,EAAa,UAAU,IAAI,CAAY,CAC3C,CAUA,WAAW,SAAS,EAA0B,CAC1C,EAAuB,WAAY,EAAM,MAAM,EAC/C,IAAM,EAAW,MAAM,QAAQ,CAAK,EAAI,EAAQ,CAAC,CAAK,EACtD,EAAU,sBACN,EAAS,IAAK,GAAM,EAAmB,CAAC,CAAC,EACxC,GAAM,EAAiB,CAAC,CAC7B,EAEA,EAAM,SAAW,EACjB,EAAM,sBAAwB,GAC9B,EAAa,CACjB,CAMA,WAAW,UAAqB,CAC5B,OAAO,EAAM,QACjB,CAaA,WAAW,QAAQ,EAAiC,CAChD,IAAM,EAAS,EAAM,OACrB,EAAuB,UAAW,CAAM,EACxC,EAAM,QAAU,IAAU,IAAA,GAAY,IAAA,GAAY,EAAO,iBAAiB,CAAK,EAC/E,EAAa,CACjB,CAMA,WAAW,SAA8B,CACrC,OAAO,EAAM,OACjB,CAMA,WAAW,eAAe,EAAwB,CAC9C,EAAU,uBAAuB,CAAM,EACvC,EAAM,0BAA4B,EAClC,EAAa,CACjB,CAMA,WAAW,gBAAiC,CACxC,OAAO,EAAM,yBACjB,CAoBA,OAAO,kBAAkB,EAA8B,CACnD,EAAuB,oBAAqB,EAAM,MAAM,EACxD,EAAM,SAAW,EACjB,EAAa,CACjB,CAQA,OAAO,eAAsB,CACzB,EAAM,SAAW,IAAA,GACjB,EAAM,SAAW,CAAC,MAAM,EACxB,EAAM,sBAAwB,GAC9B,EAAM,yBAA2B,GACjC,EAAM,YAAc,IAAA,GACpB,EAAa,CACjB,CACJ"}
@@ -1,2 +1,2 @@
1
- const e=require("../infra/Error.cjs"),t=require("../infra/Debug.cjs");var n=class{envService;TEMPLATE_REGEX=/\${\w*}/g;constructor(e){this.envService=e}resolveTemplate(n,r,i=new Set){i.add(n);let a=this.envService.isStrict(),o=r.replace(this.TEMPLATE_REGEX,r=>{let o=r.slice(2,-1);if(i.has(o))return r;let s=this.envService.getRaw(o);if(s===void 0||s===``||a&&s.trim()===``){if(a)throw new e.EnvaptError(305,`Cannot resolve template variable "\${${o}}": value is missing or empty.`);return t.debugWarn(`unresolved template \${${o}} preserved as literal`),r}let c=this.resolveTemplate(o,s,new Set(i));return c.includes(`\${${n}}`)||c===s&&/\$\{[^}]*\}/.test(c)?r:c});return i.delete(n),o}};exports.TemplateResolver=n;
1
+ const e=require("../infra/Error.cjs"),t=require("../core/state.cjs"),n=require("../core/missing.cjs"),r=require("../infra/Debug.cjs");var i=class{envService;TEMPLATE_REGEX=/\${\w*}/g;constructor(e){this.envService=e}resolveTemplate(i,a,o=new Set){o.add(i);let s=t.state.strict,c=a.replace(this.TEMPLATE_REGEX,t=>{let a=t.slice(2,-1);if(o.has(a))return t;let c=this.envService.getRaw(a);if(c===void 0||n.isMissing(c)){if(s)throw new e.EnvaptError(305,`Cannot resolve template variable "\${${a}}": value is missing or empty.`);return r.debugWarn(`unresolved template \${${a}} preserved as literal`),t}let l=this.resolveTemplate(a,c,new Set(o));return l.includes(`\${${i}}`)||l===c&&/\$\{[^}]*\}/.test(l)?t:l});return o.delete(i),c}};exports.TemplateResolver=i;
2
2
  //# sourceMappingURL=TemplateResolver.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateResolver.cjs","names":["EnvaptError"],"sources":["../../../src/engine/TemplateResolver.ts"],"sourcesContent":["import { debugWarn } from '../infra/Debug';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { EnvapterService } from '../types/Env';\n\n/**\n * Resolve `${VAR}` template references in environment values, guarding against circular\n * references and missing variables.\n * @internal\n */\nexport class TemplateResolver {\n private readonly TEMPLATE_REGEX = /\\${\\w*}/g;\n\n constructor(private readonly envService: EnvapterService) {}\n\n resolveTemplate(key: string, value: string, stack: Set<string> = new Set<string>()): string {\n stack.add(key);\n const strict = this.envService.isStrict();\n\n const out = value.replace(this.TEMPLATE_REGEX, (template) => {\n const variable = template.slice(2, -1);\n\n if (stack.has(variable)) return template; // cycle, preserve\n\n const raw = this.envService.getRaw(variable);\n const isMissing = raw === undefined || raw === '' || (strict && raw.trim() === '');\n if (isMissing) {\n if (strict) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Cannot resolve template variable \"\\${${variable}}\": value is missing or empty.`\n );\n }\n debugWarn(`unresolved template \\${${variable}} preserved as literal`);\n return template; // missing or empty, preserve\n }\n\n const resolved = this.resolveTemplate(variable, raw, new Set(stack));\n\n // If resolution still references the current key, skip replacement (indirect cycle)\n if (resolved.includes(`\\${${key}}`)) return template;\n\n // If nothing changed (unresolved placeholders stayed), also preserve original template\n if (resolved === raw && /\\$\\{[^}]*\\}/.test(resolved)) return template;\n\n return resolved;\n });\n\n stack.delete(key);\n return out;\n }\n}\n"],"mappings":"sEAUA,IAAa,EAAb,KAA8B,CAGG,WAF7B,eAAkC,WAElC,YAAY,EAA8C,CAA7B,KAAA,WAAA,CAA8B,CAE3D,gBAAgB,EAAa,EAAe,EAAqB,IAAI,IAAuB,CACxF,EAAM,IAAI,CAAG,EACb,IAAM,EAAS,KAAK,WAAW,SAAS,EAElC,EAAM,EAAM,QAAQ,KAAK,eAAiB,GAAa,CACzD,IAAM,EAAW,EAAS,MAAM,EAAG,EAAE,EAErC,GAAI,EAAM,IAAI,CAAQ,EAAG,OAAO,EAEhC,IAAM,EAAM,KAAK,WAAW,OAAO,CAAQ,EAE3C,GADkB,IAAQ,IAAA,IAAa,IAAQ,IAAO,GAAU,EAAI,KAAK,IAAM,GAChE,CACX,GAAI,EACA,MAAM,IAAIA,EAAAA,YAAAA,IAEN,wCAAwC,EAAS,+BACrD,EAGJ,OADA,EAAA,UAAU,0BAA0B,EAAS,uBAAuB,EAC7D,CACX,CAEA,IAAM,EAAW,KAAK,gBAAgB,EAAU,EAAK,IAAI,IAAI,CAAK,CAAC,EAQnE,OALI,EAAS,SAAS,MAAM,EAAI,EAAE,GAG9B,IAAa,GAAO,cAAc,KAAK,CAAQ,EAAU,EAEtD,CACX,CAAC,EAGD,OADA,EAAM,OAAO,CAAG,EACT,CACX,CACJ"}
1
+ {"version":3,"file":"TemplateResolver.cjs","names":["state","isMissing","EnvaptError"],"sources":["../../../src/engine/TemplateResolver.ts"],"sourcesContent":["import { isMissing } from '../core/missing';\nimport { state } from '../core/state';\nimport { debugWarn } from '../infra/Debug';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { EnvapterService } from '../types/Env';\n\n/**\n * Resolve `${VAR}` template references in environment values, guarding against circular\n * references and missing variables.\n * @internal\n */\nexport class TemplateResolver {\n private readonly TEMPLATE_REGEX = /\\${\\w*}/g;\n\n constructor(private readonly envService: EnvapterService) {}\n\n resolveTemplate(key: string, value: string, stack: Set<string> = new Set<string>()): string {\n stack.add(key);\n const strict = state.strict;\n\n const out = value.replace(this.TEMPLATE_REGEX, (template) => {\n const variable = template.slice(2, -1);\n\n if (stack.has(variable)) return template; // cycle, preserve\n\n const raw = this.envService.getRaw(variable);\n if (raw === undefined || isMissing(raw)) {\n if (strict) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Cannot resolve template variable \"\\${${variable}}\": value is missing or empty.`\n );\n }\n debugWarn(`unresolved template \\${${variable}} preserved as literal`);\n return template; // missing or empty, preserve\n }\n\n const resolved = this.resolveTemplate(variable, raw, new Set(stack));\n\n // If resolution still references the current key, skip replacement (indirect cycle)\n if (resolved.includes(`\\${${key}}`)) return template;\n\n // If nothing changed (unresolved placeholders stayed), also preserve original template\n if (resolved === raw && /\\$\\{[^}]*\\}/.test(resolved)) return template;\n\n return resolved;\n });\n\n stack.delete(key);\n return out;\n }\n}\n"],"mappings":"sIAYA,IAAa,EAAb,KAA8B,CAGG,WAF7B,eAAkC,WAElC,YAAY,EAA8C,CAA7B,KAAA,WAAA,CAA8B,CAE3D,gBAAgB,EAAa,EAAe,EAAqB,IAAI,IAAuB,CACxF,EAAM,IAAI,CAAG,EACb,IAAM,EAASA,EAAAA,MAAM,OAEf,EAAM,EAAM,QAAQ,KAAK,eAAiB,GAAa,CACzD,IAAM,EAAW,EAAS,MAAM,EAAG,EAAE,EAErC,GAAI,EAAM,IAAI,CAAQ,EAAG,OAAO,EAEhC,IAAM,EAAM,KAAK,WAAW,OAAO,CAAQ,EAC3C,GAAI,IAAQ,IAAA,IAAaC,EAAAA,UAAU,CAAG,EAAG,CACrC,GAAI,EACA,MAAM,IAAIC,EAAAA,YAAAA,IAEN,wCAAwC,EAAS,+BACrD,EAGJ,OADA,EAAA,UAAU,0BAA0B,EAAS,uBAAuB,EAC7D,CACX,CAEA,IAAM,EAAW,KAAK,gBAAgB,EAAU,EAAK,IAAI,IAAI,CAAK,CAAC,EAQnE,OALI,EAAS,SAAS,MAAM,EAAI,EAAE,GAG9B,IAAa,GAAO,cAAc,KAAK,CAAQ,EAAU,EAEtD,CACX,CAAC,EAGD,OADA,EAAM,OAAO,CAAG,EACT,CACX,CACJ"}
@@ -1,2 +1,2 @@
1
- import{EnvaptError as e}from"../infra/Error.mjs";import{debugWarn as t}from"../infra/Debug.mjs";var n=class{envService;TEMPLATE_REGEX=/\${\w*}/g;constructor(e){this.envService=e}resolveTemplate(n,r,i=new Set){i.add(n);let a=this.envService.isStrict(),o=r.replace(this.TEMPLATE_REGEX,r=>{let o=r.slice(2,-1);if(i.has(o))return r;let s=this.envService.getRaw(o);if(s===void 0||s===``||a&&s.trim()===``){if(a)throw new e(305,`Cannot resolve template variable "\${${o}}": value is missing or empty.`);return t(`unresolved template \${${o}} preserved as literal`),r}let c=this.resolveTemplate(o,s,new Set(i));return c.includes(`\${${n}}`)||c===s&&/\$\{[^}]*\}/.test(c)?r:c});return i.delete(n),o}};export{n as TemplateResolver};
1
+ import{EnvaptError as e}from"../infra/Error.mjs";import{state as t}from"../core/state.mjs";import{isMissing as n}from"../core/missing.mjs";import{debugWarn as r}from"../infra/Debug.mjs";var i=class{envService;TEMPLATE_REGEX=/\${\w*}/g;constructor(e){this.envService=e}resolveTemplate(i,a,o=new Set){o.add(i);let s=t.strict,c=a.replace(this.TEMPLATE_REGEX,t=>{let a=t.slice(2,-1);if(o.has(a))return t;let c=this.envService.getRaw(a);if(c===void 0||n(c)){if(s)throw new e(305,`Cannot resolve template variable "\${${a}}": value is missing or empty.`);return r(`unresolved template \${${a}} preserved as literal`),t}let l=this.resolveTemplate(a,c,new Set(o));return l.includes(`\${${i}}`)||l===c&&/\$\{[^}]*\}/.test(l)?t:l});return o.delete(i),c}};export{i as TemplateResolver};
2
2
  //# sourceMappingURL=TemplateResolver.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateResolver.mjs","names":[],"sources":["../../../src/engine/TemplateResolver.ts"],"sourcesContent":["import { debugWarn } from '../infra/Debug';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { EnvapterService } from '../types/Env';\n\n/**\n * Resolve `${VAR}` template references in environment values, guarding against circular\n * references and missing variables.\n * @internal\n */\nexport class TemplateResolver {\n private readonly TEMPLATE_REGEX = /\\${\\w*}/g;\n\n constructor(private readonly envService: EnvapterService) {}\n\n resolveTemplate(key: string, value: string, stack: Set<string> = new Set<string>()): string {\n stack.add(key);\n const strict = this.envService.isStrict();\n\n const out = value.replace(this.TEMPLATE_REGEX, (template) => {\n const variable = template.slice(2, -1);\n\n if (stack.has(variable)) return template; // cycle, preserve\n\n const raw = this.envService.getRaw(variable);\n const isMissing = raw === undefined || raw === '' || (strict && raw.trim() === '');\n if (isMissing) {\n if (strict) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Cannot resolve template variable \"\\${${variable}}\": value is missing or empty.`\n );\n }\n debugWarn(`unresolved template \\${${variable}} preserved as literal`);\n return template; // missing or empty, preserve\n }\n\n const resolved = this.resolveTemplate(variable, raw, new Set(stack));\n\n // If resolution still references the current key, skip replacement (indirect cycle)\n if (resolved.includes(`\\${${key}}`)) return template;\n\n // If nothing changed (unresolved placeholders stayed), also preserve original template\n if (resolved === raw && /\\$\\{[^}]*\\}/.test(resolved)) return template;\n\n return resolved;\n });\n\n stack.delete(key);\n return out;\n }\n}\n"],"mappings":"gGAUA,IAAa,EAAb,KAA8B,CAGG,WAF7B,eAAkC,WAElC,YAAY,EAA8C,CAA7B,KAAA,WAAA,CAA8B,CAE3D,gBAAgB,EAAa,EAAe,EAAqB,IAAI,IAAuB,CACxF,EAAM,IAAI,CAAG,EACb,IAAM,EAAS,KAAK,WAAW,SAAS,EAElC,EAAM,EAAM,QAAQ,KAAK,eAAiB,GAAa,CACzD,IAAM,EAAW,EAAS,MAAM,EAAG,EAAE,EAErC,GAAI,EAAM,IAAI,CAAQ,EAAG,OAAO,EAEhC,IAAM,EAAM,KAAK,WAAW,OAAO,CAAQ,EAE3C,GADkB,IAAQ,IAAA,IAAa,IAAQ,IAAO,GAAU,EAAI,KAAK,IAAM,GAChE,CACX,GAAI,EACA,MAAM,IAAI,EAAA,IAEN,wCAAwC,EAAS,+BACrD,EAGJ,OADA,EAAU,0BAA0B,EAAS,uBAAuB,EAC7D,CACX,CAEA,IAAM,EAAW,KAAK,gBAAgB,EAAU,EAAK,IAAI,IAAI,CAAK,CAAC,EAQnE,OALI,EAAS,SAAS,MAAM,EAAI,EAAE,GAG9B,IAAa,GAAO,cAAc,KAAK,CAAQ,EAAU,EAEtD,CACX,CAAC,EAGD,OADA,EAAM,OAAO,CAAG,EACT,CACX,CACJ"}
1
+ {"version":3,"file":"TemplateResolver.mjs","names":[],"sources":["../../../src/engine/TemplateResolver.ts"],"sourcesContent":["import { isMissing } from '../core/missing';\nimport { state } from '../core/state';\nimport { debugWarn } from '../infra/Debug';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { EnvapterService } from '../types/Env';\n\n/**\n * Resolve `${VAR}` template references in environment values, guarding against circular\n * references and missing variables.\n * @internal\n */\nexport class TemplateResolver {\n private readonly TEMPLATE_REGEX = /\\${\\w*}/g;\n\n constructor(private readonly envService: EnvapterService) {}\n\n resolveTemplate(key: string, value: string, stack: Set<string> = new Set<string>()): string {\n stack.add(key);\n const strict = state.strict;\n\n const out = value.replace(this.TEMPLATE_REGEX, (template) => {\n const variable = template.slice(2, -1);\n\n if (stack.has(variable)) return template; // cycle, preserve\n\n const raw = this.envService.getRaw(variable);\n if (raw === undefined || isMissing(raw)) {\n if (strict) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingEnvValue,\n `Cannot resolve template variable \"\\${${variable}}\": value is missing or empty.`\n );\n }\n debugWarn(`unresolved template \\${${variable}} preserved as literal`);\n return template; // missing or empty, preserve\n }\n\n const resolved = this.resolveTemplate(variable, raw, new Set(stack));\n\n // If resolution still references the current key, skip replacement (indirect cycle)\n if (resolved.includes(`\\${${key}}`)) return template;\n\n // If nothing changed (unresolved placeholders stayed), also preserve original template\n if (resolved === raw && /\\$\\{[^}]*\\}/.test(resolved)) return template;\n\n return resolved;\n });\n\n stack.delete(key);\n return out;\n }\n}\n"],"mappings":"0LAYA,IAAa,EAAb,KAA8B,CAGG,WAF7B,eAAkC,WAElC,YAAY,EAA8C,CAA7B,KAAA,WAAA,CAA8B,CAE3D,gBAAgB,EAAa,EAAe,EAAqB,IAAI,IAAuB,CACxF,EAAM,IAAI,CAAG,EACb,IAAM,EAAS,EAAM,OAEf,EAAM,EAAM,QAAQ,KAAK,eAAiB,GAAa,CACzD,IAAM,EAAW,EAAS,MAAM,EAAG,EAAE,EAErC,GAAI,EAAM,IAAI,CAAQ,EAAG,OAAO,EAEhC,IAAM,EAAM,KAAK,WAAW,OAAO,CAAQ,EAC3C,GAAI,IAAQ,IAAA,IAAa,EAAU,CAAG,EAAG,CACrC,GAAI,EACA,MAAM,IAAI,EAAA,IAEN,wCAAwC,EAAS,+BACrD,EAGJ,OADA,EAAU,0BAA0B,EAAS,uBAAuB,EAC7D,CACX,CAEA,IAAM,EAAW,KAAK,gBAAgB,EAAU,EAAK,IAAI,IAAI,CAAK,CAAC,EAQnE,OALI,EAAS,SAAS,MAAM,EAAI,EAAE,GAG9B,IAAa,GAAO,cAAc,KAAK,CAAQ,EAAU,EAEtD,CACX,CAAC,EAGD,OADA,EAAM,OAAO,CAAG,EACT,CACX,CACJ"}
@@ -1,2 +1,2 @@
1
- const e=require("../converters/Converters.cjs"),t=require("../converters/ListOfBuiltInConverters.cjs"),n=require("../infra/Error.cjs");var r=class{static isBuiltInConverter(e){return typeof e==`string`?t.ListOfBuiltInConverters.includes(e):!1}static isArrayConverter(t){return e.isArrayOf(t)}static isStandardSchema(e){if(typeof e!=`object`||!e||!(`~standard`in e))return!1;let t=e[`~standard`];if(typeof t!=`object`||!t)return!1;let n=t;return n.version===1&&typeof n.validate==`function`}static customConvertor(e){if(typeof e!=`function`)throw new n.EnvaptError(203,`Custom converter must be a function, got ${typeof e}.`)}static arrayConverter(r){if(!e.isArrayOf(r))throw new n.EnvaptError(201,`Expected an ArrayOf<...> token produced by Converters.array(...)`);if(typeof r.delimiter!=`string`||r.delimiter.length===0)throw new n.EnvaptError(301,`ArrayOf<...> requires a non-empty string delimiter, got ${typeof r.delimiter}`);let i=r.of;if(!(typeof i==`string`&&t.ListOfBuiltInConverters.includes(i))&&typeof i!=`function`)throw new n.EnvaptError(201,`ArrayOf<...> element ("of") must be a built-in scalar token or a function, got ${typeof i}`)}static builtInConverter(e){if(typeof e!=`string`)throw new n.EnvaptError(204,`Expected string, got ${typeof e}`);if(!t.ListOfBuiltInConverters.includes(e))throw new n.EnvaptError(202,`"${e}" is not a valid converter type. Valid types are: ${t.ListOfBuiltInConverters.join(`,`)}`)}static validateBuiltInConverterFallback(e,r){let i=t.BuiltInConverterTypeCheckers[e];if(!i(r))throw new n.EnvaptError(104,`Fallback type does not match converter "${e}". Expected ${e} compatible type.`)}static validateArrayFallbackElementTypes(e){if(e.length===0)return;let t=typeof e[0];if(e.some((e,n)=>n===0?!1:typeof e!==t))throw new n.EnvaptError(103,`All elements in array fallback must have the same type. Found mixed types.`)}static validateArrayConverterElementTypeMatch(e,r){if(r.length===0||typeof e==`function`)return;let i=e;if(i===`time`){let e=r.every(e=>typeof e==`number`),t=r.every(e=>typeof e==`string`);if(!e&&!t)throw new n.EnvaptError(103,`Time array fallback must be all numbers or all time-string entries.`);return}let a=t.BuiltInConverterTypeCheckers[i],o=r[0];if(!a(o))throw new n.EnvaptError(103,`Array converter type "${i}" does not match fallback element type. Expected ${i} compatible elements.`)}static isPrimitiveConstructor(e){return e===String||e===Number||e===Boolean||e===BigInt||e===Symbol}static coercePrimitiveFallback(e,t){return this.isCorrectPrimitiveType(e,t)?t:this.performPrimitiveCoercion(e,t)}static isCorrectPrimitiveType(e,t){return e===String&&typeof t==`string`||e===Number&&typeof t==`number`||e===Boolean&&typeof t==`boolean`||e===BigInt&&typeof t==`bigint`||e===Symbol&&typeof t==`symbol`}static performPrimitiveCoercion(e,t){try{if(e===String)return String(t);if(e===Number)return Number(t);if(e===Boolean)return!!t;if(e===BigInt)return BigInt(t);if(e===Symbol)return Symbol.for(String(t))}catch(t){throw new n.EnvaptError(205,`Failed to coerce fallback value using ${e.name}: ${t.message}`)}throw new n.EnvaptError(205,`Unknown primitive converter: ${e.name}`)}static validateSyncProcessEnv(e){if(typeof e!=`boolean`)throw new n.EnvaptError(302,`Envapter.syncProcessEnv must be a boolean, got ${typeof e}.`)}static validateEnvFileOptions(e){let t=new Set([`encoding`,`override`]),r=Object.keys(e).filter(e=>!t.has(e));if(r.length>0)throw new n.EnvaptError(302,`Invalid envFileOptions: ${r.join(`, `)}. Allowed options: ${Array.from(t).join(`, `)}. For debug output, use Envapter.debug or the ENVAPT_DEBUG env var.`);return!0}static validateEnvFilesExist(e,t){let r=e.filter(e=>!t(e));if(r.length>0)throw new n.EnvaptError(303,`Environment file not found at path: ${r.join(`, `)}`)}};exports.Validator=r;
1
+ const e=require("../infra/Error.cjs"),t=require("../converters/Converters.cjs"),n=require("../converters/ListOfBuiltInConverters.cjs");var r=class{static isBuiltInConverter(e){return typeof e==`string`?n.ListOfBuiltInConverters.includes(e):!1}static isArrayConverter(e){return t.isArrayOf(e)}static isStandardSchema(e){if(typeof e!=`object`||!e||!(`~standard`in e))return!1;let t=e[`~standard`];if(typeof t!=`object`||!t)return!1;let n=t;return n.version===1&&typeof n.validate==`function`}static customConvertor(t){if(typeof t!=`function`)throw new e.EnvaptError(203,`Custom converter must be a function, got ${typeof t}.`)}static arrayConverter(r){if(!t.isArrayOf(r))throw new e.EnvaptError(201,`Expected an ArrayOf<...> token produced by Converters.array(...)`);if(typeof r.delimiter!=`string`||r.delimiter.length===0)throw new e.EnvaptError(301,`ArrayOf<...> requires a non-empty string delimiter, got ${typeof r.delimiter}`);let i=r.of;if(!(typeof i==`string`&&n.ListOfBuiltInConverters.includes(i))&&typeof i!=`function`)throw new e.EnvaptError(201,`ArrayOf<...> element ("of") must be a built-in scalar token or a function, got ${typeof i}`)}static builtInConverter(t){if(typeof t!=`string`)throw new e.EnvaptError(204,`Expected string, got ${typeof t}`);if(!n.ListOfBuiltInConverters.includes(t))throw new e.EnvaptError(202,`"${t}" is not a valid converter type. Valid types are: ${n.ListOfBuiltInConverters.join(`,`)}`)}static validateBuiltInConverterFallback(t,r){let i=n.BuiltInConverterTypeCheckers[t];if(!i(r))throw new e.EnvaptError(104,`Fallback type does not match converter "${t}". Expected ${t} compatible type.`)}static validateArrayFallbackElementTypes(t){if(t.length===0)return;let n=typeof t[0];if(t.some((e,t)=>t===0?!1:typeof e!==n))throw new e.EnvaptError(103,`All elements in array fallback must have the same type. Found mixed types.`)}static validateArrayConverterElementTypeMatch(t,r){if(r.length===0||typeof t==`function`)return;let i=t;if(i===`time`){let t=r.every(e=>typeof e==`number`),n=r.every(e=>typeof e==`string`);if(!t&&!n)throw new e.EnvaptError(103,`Time array fallback must be all numbers or all time-string entries.`);return}let a=n.BuiltInConverterTypeCheckers[i],o=r[0];if(!a(o))throw new e.EnvaptError(103,`Array converter type "${i}" does not match fallback element type. Expected ${i} compatible elements.`)}static isPrimitiveConstructor(e){return e===String||e===Number||e===Boolean||e===BigInt||e===Symbol}static coercePrimitiveFallback(e,t){return this.isCorrectPrimitiveType(e,t)?t:this.performPrimitiveCoercion(e,t)}static isCorrectPrimitiveType(e,t){return e===String&&typeof t==`string`||e===Number&&typeof t==`number`||e===Boolean&&typeof t==`boolean`||e===BigInt&&typeof t==`bigint`||e===Symbol&&typeof t==`symbol`}static performPrimitiveCoercion(t,n){try{if(t===String)return String(n);if(t===Number)return Number(n);if(t===Boolean)return!!n;if(t===BigInt)return BigInt(n);if(t===Symbol)return Symbol.for(String(n))}catch(n){throw new e.EnvaptError(205,`Failed to coerce fallback value using ${t.name}: ${n.message}`)}throw new e.EnvaptError(205,`Unknown primitive converter: ${t.name}`)}static validateSyncProcessEnv(t){if(typeof t!=`boolean`)throw new e.EnvaptError(302,`Envapter.syncProcessEnv must be a boolean, got ${typeof t}.`)}static validateFileApiMode(t){if(t!==`warn`&&t!==`throw`){let n=typeof t==`string`?`'${t}'`:typeof t;throw new e.EnvaptError(302,`Envapter.fileApiMode must be 'warn' or 'throw', got ${n}.`)}}static validateEnvFileOptions(t){let n=new Set([`encoding`,`override`]),r=Object.keys(t).filter(e=>!n.has(e));if(r.length>0)throw new e.EnvaptError(302,`Invalid envFileOptions: ${r.join(`, `)}. Allowed options: ${Array.from(n).join(`, `)}. For debug output, use Envapter.debug or the ENVAPT_DEBUG env var.`);return!0}static validateEnvFilesExist(t,n){let r=t.filter(e=>!n(e));if(r.length>0)throw new e.EnvaptError(303,`Environment file not found at path: ${r.join(`, `)}`)}};exports.Validator=r;
2
2
  //# sourceMappingURL=Validators.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Validators.cjs","names":["ListOfBuiltInConverters","isArrayOf","EnvaptError","BuiltInConverterTypeCheckers"],"sources":["../../../src/engine/Validators.ts"],"sourcesContent":["// Import the converter modules directly, not via the `./converters` barrel: that barrel pulls in\n// ValueConverter, which imports this Validator, so a barrel import here would cycle.\nimport { isArrayOf } from '../converters/Converters';\nimport { ListOfBuiltInConverters, BuiltInConverterTypeCheckers } from '../converters/ListOfBuiltInConverters';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { ArrayOf, ConverterToken } from '../converters/Converters';\nimport type { EnvFileOptions } from '../infra/Dotenv';\nimport type { StandardSchemaV1 } from '../infra/StandardSchema';\nimport type { BuiltInConverter, ConverterFunction, EnvaptConverter } from '../types';\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class -- cohesive dispatch of stateless type guards, same shape as BuiltInConverters\nexport class Validator {\n /**\n * Check if a value is a built-in scalar converter token\n */\n static isBuiltInConverter<TFallback>(value: EnvaptConverter<TFallback>): value is BuiltInConverter {\n if (typeof value === 'string') return ListOfBuiltInConverters.includes(value);\n return false;\n }\n\n /**\n * Check if a value is an `ArrayOf<...>` token produced by {@link Converters.array}.\n */\n static isArrayConverter(value: unknown): value is ArrayOf {\n return isArrayOf(value);\n }\n\n // Structural check: `version === 1` + callable `validate` is the minimum dispatchable\n // shape per the Standard Schema spec.\n static isStandardSchema(value: unknown): value is StandardSchemaV1 {\n if (typeof value !== 'object' || value === null) return false;\n if (!('~standard' in value)) return false;\n const slot = value['~standard'];\n if (typeof slot !== 'object' || slot === null) return false;\n const props = slot as { version?: unknown; validate?: unknown };\n return props.version === 1 && typeof props.validate === 'function';\n }\n\n static customConvertor<TFallback>(\n converter: EnvaptConverter<TFallback>\n ): asserts converter is ConverterFunction<TFallback> {\n if (typeof converter !== 'function') {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidCustomConverter,\n `Custom converter must be a function, got ${typeof converter}.`\n );\n }\n }\n\n /**\n * Runtime validation that the `ArrayOf<...>` configuration is well-formed.\n */\n static arrayConverter(value: unknown): asserts value is ArrayOf {\n if (!isArrayOf(value)) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidArrayConverterType,\n 'Expected an ArrayOf<...> token produced by Converters.array(...)'\n );\n }\n\n if (typeof value.delimiter !== 'string' || value.delimiter.length === 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingDelimiter,\n `ArrayOf<...> requires a non-empty string delimiter, got ${typeof value.delimiter}`\n );\n }\n\n const elementOf = value.of;\n const isScalar = typeof elementOf === 'string' && ListOfBuiltInConverters.includes(elementOf);\n const isCustomFn = typeof elementOf === 'function';\n if (!isScalar && !isCustomFn) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidArrayConverterType,\n `ArrayOf<...> element (\"of\") must be a built-in scalar token or a function, got ${typeof elementOf}`\n );\n }\n }\n\n /**\n * Validate that a string is a valid built-in scalar converter token\n */\n static builtInConverter(value: unknown): asserts value is BuiltInConverter {\n if (typeof value !== 'string') {\n throw new EnvaptError(EnvaptErrorCodes.InvalidConverterType, `Expected string, got ${typeof value}`);\n }\n\n if (!ListOfBuiltInConverters.includes(value as ConverterToken)) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidBuiltInConverter,\n `\"${value}\" is not a valid converter type. Valid types are: ${ListOfBuiltInConverters.join(',')}`\n );\n }\n }\n\n /**\n * Validate that fallback type matches the converter's return type for built-in converters\n */\n static validateBuiltInConverterFallback(converter: BuiltInConverter, fallback: unknown): void {\n const typeChecker = BuiltInConverterTypeCheckers[converter];\n if (!typeChecker(fallback)) {\n throw new EnvaptError(\n EnvaptErrorCodes.FallbackConverterTypeMismatch,\n `Fallback type does not match converter \"${converter}\". Expected ${converter} compatible type.`\n );\n }\n }\n\n /**\n * Validate that all elements in an array fallback have consistent types\n */\n static validateArrayFallbackElementTypes(fallback: unknown[]): void {\n if (fallback.length === 0) return;\n\n const firstElementType = typeof fallback[0];\n const hasInconsistentTypes = fallback.some((element, index) => {\n if (index === 0) return false;\n return typeof element !== firstElementType;\n });\n\n if (hasInconsistentTypes) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n `All elements in array fallback must have the same type. Found mixed types.`\n );\n }\n }\n\n /**\n * Validate that an `ArrayOf<...>` element converter matches the runtime types of its\n * fallback elements. For `Converters.Time` arrays the element-time-string format is also\n * checked here.\n */\n static validateArrayConverterElementTypeMatch(elementOf: ArrayOf['of'], fallback: unknown[]): void {\n if (fallback.length === 0) return;\n\n if (typeof elementOf === 'function') {\n // Custom element converters can return anything; we can't statically validate the fallback shape.\n return;\n }\n\n const elementToken = elementOf;\n\n // Time array fallbacks may be number[] OR string[] (TimeFallback[]).\n if (elementToken === 'time') {\n const everyNumber = fallback.every((v) => typeof v === 'number');\n const everyString = fallback.every((v) => typeof v === 'string');\n if (!everyNumber && !everyString) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n 'Time array fallback must be all numbers or all time-string entries.'\n );\n }\n return;\n }\n\n const typeChecker = BuiltInConverterTypeCheckers[elementToken];\n const firstElement = fallback[0];\n if (!typeChecker(firstElement)) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n `Array converter type \"${elementToken}\" does not match fallback element type. Expected ${elementToken} compatible elements.`\n );\n }\n }\n\n /**\n * Check if a value is a primitive constructor\n */\n static isPrimitiveConstructor(\n value: unknown\n ): value is typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol {\n return value === String || value === Number || value === Boolean || value === BigInt || value === Symbol;\n }\n\n /**\n * Safely coerce a fallback value using a primitive constructor\n */\n static coercePrimitiveFallback<CoercedType>(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): CoercedType {\n if (this.isCorrectPrimitiveType(converter, fallback)) return fallback as CoercedType;\n return this.performPrimitiveCoercion<CoercedType>(converter, fallback);\n }\n\n private static isCorrectPrimitiveType(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): boolean {\n if (converter === String && typeof fallback === 'string') return true;\n if (converter === Number && typeof fallback === 'number') return true;\n if (converter === Boolean && typeof fallback === 'boolean') return true;\n if (converter === BigInt && typeof fallback === 'bigint') return true;\n if (converter === Symbol && typeof fallback === 'symbol') return true;\n return false;\n }\n\n private static performPrimitiveCoercion<CoercedType>(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): CoercedType {\n try {\n if (converter === String) return String(fallback) as CoercedType;\n if (converter === Number) return Number(fallback) as CoercedType;\n if (converter === Boolean) return Boolean(fallback) as CoercedType;\n if (converter === BigInt) return BigInt(fallback as string | number | bigint) as CoercedType;\n /* v8 ignore next -- @preserve */\n if (converter === Symbol) return Symbol.for(String(fallback)) as CoercedType;\n } catch (error) {\n throw new EnvaptError(\n EnvaptErrorCodes.PrimitiveCoercionFailed,\n `Failed to coerce fallback value using ${converter.name}: ${(error as Error).message}`\n );\n }\n\n /* v8 ignore next -- @preserve */\n throw new EnvaptError(\n EnvaptErrorCodes.PrimitiveCoercionFailed,\n `Unknown primitive converter: ${converter.name}`\n );\n }\n\n /**\n * Reject non-boolean inputs to `Envapter.syncProcessEnv` so a truthy typo\n * (`'true'`, `1`, etc.) does not silently enable the mirror.\n */\n static validateSyncProcessEnv(value: unknown): asserts value is boolean {\n if (typeof value !== 'boolean') {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Envapter.syncProcessEnv must be a boolean, got ${typeof value}.`\n );\n }\n }\n\n /**\n * Make sure the user hasn't provided prohibited options in their dotenv config\n */\n static validateEnvFileOptions(config: object): config is EnvFileOptions {\n const validKeys = new Set(['encoding', 'override']);\n const invalidKeys = Object.keys(config).filter((key) => !validKeys.has(key));\n\n if (invalidKeys.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Invalid envFileOptions: ${invalidKeys.join(', ')}. Allowed options: ${Array.from(validKeys).join(', ')}. For debug output, use Envapter.debug or the ENVAPT_DEBUG env var.`\n );\n }\n\n return true;\n }\n\n // Existence is probed through the caller-supplied `fileExists` (backed by the bound source) so\n // this stays free of `node:fs`.\n static validateEnvFilesExist(paths: string[], fileExists: (path: string) => boolean): void {\n const missing = paths.filter((p) => !fileExists(p));\n\n if (missing.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.EnvFilesNotFound,\n `Environment file not found at path: ${missing.join(', ')}`\n );\n }\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"Validators.cjs","names":["ListOfBuiltInConverters","isArrayOf","EnvaptError","BuiltInConverterTypeCheckers"],"sources":["../../../src/engine/Validators.ts"],"sourcesContent":["// Import the converter modules directly, not via the `./converters` barrel: that barrel pulls in\n// ValueConverter, which imports this Validator, so a barrel import here would cycle.\nimport { isArrayOf } from '../converters/Converters';\nimport { ListOfBuiltInConverters, BuiltInConverterTypeCheckers } from '../converters/ListOfBuiltInConverters';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { ArrayOf, ConverterToken } from '../converters/Converters';\nimport type { EnvFileOptions } from '../infra/Dotenv';\nimport type { StandardSchemaV1 } from '../infra/StandardSchema';\nimport type { BuiltInConverter, ConverterFunction, EnvaptConverter, FileApiMode } from '../types';\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class -- cohesive dispatch of stateless type guards, same shape as BuiltInConverters\nexport class Validator {\n /**\n * Check if a value is a built-in scalar converter token\n */\n static isBuiltInConverter<TFallback>(value: EnvaptConverter<TFallback>): value is BuiltInConverter {\n if (typeof value === 'string') return ListOfBuiltInConverters.includes(value);\n return false;\n }\n\n /**\n * Check if a value is an `ArrayOf<...>` token produced by {@link Converters.array}.\n */\n static isArrayConverter(value: unknown): value is ArrayOf {\n return isArrayOf(value);\n }\n\n // Structural check: `version === 1` + callable `validate` is the minimum dispatchable\n // shape per the Standard Schema spec.\n static isStandardSchema(value: unknown): value is StandardSchemaV1 {\n if (typeof value !== 'object' || value === null) return false;\n if (!('~standard' in value)) return false;\n const slot = value['~standard'];\n if (typeof slot !== 'object' || slot === null) return false;\n const props = slot as { version?: unknown; validate?: unknown };\n return props.version === 1 && typeof props.validate === 'function';\n }\n\n static customConvertor<TFallback>(\n converter: EnvaptConverter<TFallback>\n ): asserts converter is ConverterFunction<TFallback> {\n if (typeof converter !== 'function') {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidCustomConverter,\n `Custom converter must be a function, got ${typeof converter}.`\n );\n }\n }\n\n /**\n * Runtime validation that the `ArrayOf<...>` configuration is well-formed.\n */\n static arrayConverter(value: unknown): asserts value is ArrayOf {\n if (!isArrayOf(value)) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidArrayConverterType,\n 'Expected an ArrayOf<...> token produced by Converters.array(...)'\n );\n }\n\n if (typeof value.delimiter !== 'string' || value.delimiter.length === 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingDelimiter,\n `ArrayOf<...> requires a non-empty string delimiter, got ${typeof value.delimiter}`\n );\n }\n\n const elementOf = value.of;\n const isScalar = typeof elementOf === 'string' && ListOfBuiltInConverters.includes(elementOf);\n const isCustomFn = typeof elementOf === 'function';\n if (!isScalar && !isCustomFn) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidArrayConverterType,\n `ArrayOf<...> element (\"of\") must be a built-in scalar token or a function, got ${typeof elementOf}`\n );\n }\n }\n\n /**\n * Validate that a string is a valid built-in scalar converter token\n */\n static builtInConverter(value: unknown): asserts value is BuiltInConverter {\n if (typeof value !== 'string') {\n throw new EnvaptError(EnvaptErrorCodes.InvalidConverterType, `Expected string, got ${typeof value}`);\n }\n\n if (!ListOfBuiltInConverters.includes(value as ConverterToken)) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidBuiltInConverter,\n `\"${value}\" is not a valid converter type. Valid types are: ${ListOfBuiltInConverters.join(',')}`\n );\n }\n }\n\n /**\n * Validate that fallback type matches the converter's return type for built-in converters\n */\n static validateBuiltInConverterFallback(converter: BuiltInConverter, fallback: unknown): void {\n const typeChecker = BuiltInConverterTypeCheckers[converter];\n if (!typeChecker(fallback)) {\n throw new EnvaptError(\n EnvaptErrorCodes.FallbackConverterTypeMismatch,\n `Fallback type does not match converter \"${converter}\". Expected ${converter} compatible type.`\n );\n }\n }\n\n /**\n * Validate that all elements in an array fallback have consistent types\n */\n static validateArrayFallbackElementTypes(fallback: unknown[]): void {\n if (fallback.length === 0) return;\n\n const firstElementType = typeof fallback[0];\n const hasInconsistentTypes = fallback.some((element, index) => {\n if (index === 0) return false;\n return typeof element !== firstElementType;\n });\n\n if (hasInconsistentTypes) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n `All elements in array fallback must have the same type. Found mixed types.`\n );\n }\n }\n\n /**\n * Validate that an `ArrayOf<...>` element converter matches the runtime types of its\n * fallback elements. For `Converters.Time` arrays the element-time-string format is also\n * checked here.\n */\n static validateArrayConverterElementTypeMatch(elementOf: ArrayOf['of'], fallback: unknown[]): void {\n if (fallback.length === 0) return;\n\n if (typeof elementOf === 'function') {\n // Custom element converters can return anything; we can't statically validate the fallback shape.\n return;\n }\n\n const elementToken = elementOf;\n\n // Time array fallbacks may be number[] OR string[] (TimeFallback[]).\n if (elementToken === 'time') {\n const everyNumber = fallback.every((v) => typeof v === 'number');\n const everyString = fallback.every((v) => typeof v === 'string');\n if (!everyNumber && !everyString) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n 'Time array fallback must be all numbers or all time-string entries.'\n );\n }\n return;\n }\n\n const typeChecker = BuiltInConverterTypeCheckers[elementToken];\n const firstElement = fallback[0];\n if (!typeChecker(firstElement)) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n `Array converter type \"${elementToken}\" does not match fallback element type. Expected ${elementToken} compatible elements.`\n );\n }\n }\n\n /**\n * Check if a value is a primitive constructor\n */\n static isPrimitiveConstructor(\n value: unknown\n ): value is typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol {\n return value === String || value === Number || value === Boolean || value === BigInt || value === Symbol;\n }\n\n /**\n * Safely coerce a fallback value using a primitive constructor\n */\n static coercePrimitiveFallback<CoercedType>(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): CoercedType {\n if (this.isCorrectPrimitiveType(converter, fallback)) return fallback as CoercedType;\n return this.performPrimitiveCoercion<CoercedType>(converter, fallback);\n }\n\n private static isCorrectPrimitiveType(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): boolean {\n if (converter === String && typeof fallback === 'string') return true;\n if (converter === Number && typeof fallback === 'number') return true;\n if (converter === Boolean && typeof fallback === 'boolean') return true;\n if (converter === BigInt && typeof fallback === 'bigint') return true;\n if (converter === Symbol && typeof fallback === 'symbol') return true;\n return false;\n }\n\n private static performPrimitiveCoercion<CoercedType>(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): CoercedType {\n try {\n if (converter === String) return String(fallback) as CoercedType;\n if (converter === Number) return Number(fallback) as CoercedType;\n if (converter === Boolean) return Boolean(fallback) as CoercedType;\n if (converter === BigInt) return BigInt(fallback as string | number | bigint) as CoercedType;\n /* v8 ignore next -- @preserve */\n if (converter === Symbol) return Symbol.for(String(fallback)) as CoercedType;\n } catch (error) {\n throw new EnvaptError(\n EnvaptErrorCodes.PrimitiveCoercionFailed,\n `Failed to coerce fallback value using ${converter.name}: ${(error as Error).message}`\n );\n }\n\n /* v8 ignore next -- @preserve */\n throw new EnvaptError(\n EnvaptErrorCodes.PrimitiveCoercionFailed,\n `Unknown primitive converter: ${converter.name}`\n );\n }\n\n /**\n * Reject non-boolean inputs to `Envapter.syncProcessEnv` so a truthy typo\n * (`'true'`, `1`, etc.) does not silently enable the mirror.\n */\n static validateSyncProcessEnv(value: unknown): asserts value is boolean {\n if (typeof value !== 'boolean') {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Envapter.syncProcessEnv must be a boolean, got ${typeof value}.`\n );\n }\n }\n\n static validateFileApiMode(value: unknown): asserts value is FileApiMode {\n if (value !== 'warn' && value !== 'throw') {\n const got = typeof value === 'string' ? `'${value}'` : typeof value;\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Envapter.fileApiMode must be 'warn' or 'throw', got ${got}.`\n );\n }\n }\n\n /**\n * Make sure the user hasn't provided prohibited options in their dotenv config\n */\n static validateEnvFileOptions(config: object): config is EnvFileOptions {\n const validKeys = new Set(['encoding', 'override']);\n const invalidKeys = Object.keys(config).filter((key) => !validKeys.has(key));\n\n if (invalidKeys.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Invalid envFileOptions: ${invalidKeys.join(', ')}. Allowed options: ${Array.from(validKeys).join(', ')}. For debug output, use Envapter.debug or the ENVAPT_DEBUG env var.`\n );\n }\n\n return true;\n }\n\n // Existence is probed through the caller-supplied `fileExists` (backed by the bound source) so\n // this stays free of `node:fs`.\n static validateEnvFilesExist(paths: string[], fileExists: (path: string) => boolean): void {\n const missing = paths.filter((p) => !fileExists(p));\n\n if (missing.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.EnvFilesNotFound,\n `Environment file not found at path: ${missing.join(', ')}`\n );\n }\n }\n}\n"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{isArrayOf as e}from"../converters/Converters.mjs";import{BuiltInConverterTypeCheckers as t,ListOfBuiltInConverters as n}from"../converters/ListOfBuiltInConverters.mjs";import{EnvaptError as r}from"../infra/Error.mjs";var i=class{static isBuiltInConverter(e){return typeof e==`string`?n.includes(e):!1}static isArrayConverter(t){return e(t)}static isStandardSchema(e){if(typeof e!=`object`||!e||!(`~standard`in e))return!1;let t=e[`~standard`];if(typeof t!=`object`||!t)return!1;let n=t;return n.version===1&&typeof n.validate==`function`}static customConvertor(e){if(typeof e!=`function`)throw new r(203,`Custom converter must be a function, got ${typeof e}.`)}static arrayConverter(t){if(!e(t))throw new r(201,`Expected an ArrayOf<...> token produced by Converters.array(...)`);if(typeof t.delimiter!=`string`||t.delimiter.length===0)throw new r(301,`ArrayOf<...> requires a non-empty string delimiter, got ${typeof t.delimiter}`);let i=t.of;if(!(typeof i==`string`&&n.includes(i))&&typeof i!=`function`)throw new r(201,`ArrayOf<...> element ("of") must be a built-in scalar token or a function, got ${typeof i}`)}static builtInConverter(e){if(typeof e!=`string`)throw new r(204,`Expected string, got ${typeof e}`);if(!n.includes(e))throw new r(202,`"${e}" is not a valid converter type. Valid types are: ${n.join(`,`)}`)}static validateBuiltInConverterFallback(e,n){let i=t[e];if(!i(n))throw new r(104,`Fallback type does not match converter "${e}". Expected ${e} compatible type.`)}static validateArrayFallbackElementTypes(e){if(e.length===0)return;let t=typeof e[0];if(e.some((e,n)=>n===0?!1:typeof e!==t))throw new r(103,`All elements in array fallback must have the same type. Found mixed types.`)}static validateArrayConverterElementTypeMatch(e,n){if(n.length===0||typeof e==`function`)return;let i=e;if(i===`time`){let e=n.every(e=>typeof e==`number`),t=n.every(e=>typeof e==`string`);if(!e&&!t)throw new r(103,`Time array fallback must be all numbers or all time-string entries.`);return}let a=t[i],o=n[0];if(!a(o))throw new r(103,`Array converter type "${i}" does not match fallback element type. Expected ${i} compatible elements.`)}static isPrimitiveConstructor(e){return e===String||e===Number||e===Boolean||e===BigInt||e===Symbol}static coercePrimitiveFallback(e,t){return this.isCorrectPrimitiveType(e,t)?t:this.performPrimitiveCoercion(e,t)}static isCorrectPrimitiveType(e,t){return e===String&&typeof t==`string`||e===Number&&typeof t==`number`||e===Boolean&&typeof t==`boolean`||e===BigInt&&typeof t==`bigint`||e===Symbol&&typeof t==`symbol`}static performPrimitiveCoercion(e,t){try{if(e===String)return String(t);if(e===Number)return Number(t);if(e===Boolean)return!!t;if(e===BigInt)return BigInt(t);if(e===Symbol)return Symbol.for(String(t))}catch(t){throw new r(205,`Failed to coerce fallback value using ${e.name}: ${t.message}`)}throw new r(205,`Unknown primitive converter: ${e.name}`)}static validateSyncProcessEnv(e){if(typeof e!=`boolean`)throw new r(302,`Envapter.syncProcessEnv must be a boolean, got ${typeof e}.`)}static validateEnvFileOptions(e){let t=new Set([`encoding`,`override`]),n=Object.keys(e).filter(e=>!t.has(e));if(n.length>0)throw new r(302,`Invalid envFileOptions: ${n.join(`, `)}. Allowed options: ${Array.from(t).join(`, `)}. For debug output, use Envapter.debug or the ENVAPT_DEBUG env var.`);return!0}static validateEnvFilesExist(e,t){let n=e.filter(e=>!t(e));if(n.length>0)throw new r(303,`Environment file not found at path: ${n.join(`, `)}`)}};export{i as Validator};
1
+ import{EnvaptError as e}from"../infra/Error.mjs";import{isArrayOf as t}from"../converters/Converters.mjs";import{BuiltInConverterTypeCheckers as n,ListOfBuiltInConverters as r}from"../converters/ListOfBuiltInConverters.mjs";var i=class{static isBuiltInConverter(e){return typeof e==`string`?r.includes(e):!1}static isArrayConverter(e){return t(e)}static isStandardSchema(e){if(typeof e!=`object`||!e||!(`~standard`in e))return!1;let t=e[`~standard`];if(typeof t!=`object`||!t)return!1;let n=t;return n.version===1&&typeof n.validate==`function`}static customConvertor(t){if(typeof t!=`function`)throw new e(203,`Custom converter must be a function, got ${typeof t}.`)}static arrayConverter(n){if(!t(n))throw new e(201,`Expected an ArrayOf<...> token produced by Converters.array(...)`);if(typeof n.delimiter!=`string`||n.delimiter.length===0)throw new e(301,`ArrayOf<...> requires a non-empty string delimiter, got ${typeof n.delimiter}`);let i=n.of;if(!(typeof i==`string`&&r.includes(i))&&typeof i!=`function`)throw new e(201,`ArrayOf<...> element ("of") must be a built-in scalar token or a function, got ${typeof i}`)}static builtInConverter(t){if(typeof t!=`string`)throw new e(204,`Expected string, got ${typeof t}`);if(!r.includes(t))throw new e(202,`"${t}" is not a valid converter type. Valid types are: ${r.join(`,`)}`)}static validateBuiltInConverterFallback(t,r){let i=n[t];if(!i(r))throw new e(104,`Fallback type does not match converter "${t}". Expected ${t} compatible type.`)}static validateArrayFallbackElementTypes(t){if(t.length===0)return;let n=typeof t[0];if(t.some((e,t)=>t===0?!1:typeof e!==n))throw new e(103,`All elements in array fallback must have the same type. Found mixed types.`)}static validateArrayConverterElementTypeMatch(t,r){if(r.length===0||typeof t==`function`)return;let i=t;if(i===`time`){let t=r.every(e=>typeof e==`number`),n=r.every(e=>typeof e==`string`);if(!t&&!n)throw new e(103,`Time array fallback must be all numbers or all time-string entries.`);return}let a=n[i],o=r[0];if(!a(o))throw new e(103,`Array converter type "${i}" does not match fallback element type. Expected ${i} compatible elements.`)}static isPrimitiveConstructor(e){return e===String||e===Number||e===Boolean||e===BigInt||e===Symbol}static coercePrimitiveFallback(e,t){return this.isCorrectPrimitiveType(e,t)?t:this.performPrimitiveCoercion(e,t)}static isCorrectPrimitiveType(e,t){return e===String&&typeof t==`string`||e===Number&&typeof t==`number`||e===Boolean&&typeof t==`boolean`||e===BigInt&&typeof t==`bigint`||e===Symbol&&typeof t==`symbol`}static performPrimitiveCoercion(t,n){try{if(t===String)return String(n);if(t===Number)return Number(n);if(t===Boolean)return!!n;if(t===BigInt)return BigInt(n);if(t===Symbol)return Symbol.for(String(n))}catch(n){throw new e(205,`Failed to coerce fallback value using ${t.name}: ${n.message}`)}throw new e(205,`Unknown primitive converter: ${t.name}`)}static validateSyncProcessEnv(t){if(typeof t!=`boolean`)throw new e(302,`Envapter.syncProcessEnv must be a boolean, got ${typeof t}.`)}static validateFileApiMode(t){if(t!==`warn`&&t!==`throw`)throw new e(302,`Envapter.fileApiMode must be 'warn' or 'throw', got ${typeof t==`string`?`'${t}'`:typeof t}.`)}static validateEnvFileOptions(t){let n=new Set([`encoding`,`override`]),r=Object.keys(t).filter(e=>!n.has(e));if(r.length>0)throw new e(302,`Invalid envFileOptions: ${r.join(`, `)}. Allowed options: ${Array.from(n).join(`, `)}. For debug output, use Envapter.debug or the ENVAPT_DEBUG env var.`);return!0}static validateEnvFilesExist(t,n){let r=t.filter(e=>!n(e));if(r.length>0)throw new e(303,`Environment file not found at path: ${r.join(`, `)}`)}};export{i as Validator};
2
2
  //# sourceMappingURL=Validators.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Validators.mjs","names":[],"sources":["../../../src/engine/Validators.ts"],"sourcesContent":["// Import the converter modules directly, not via the `./converters` barrel: that barrel pulls in\n// ValueConverter, which imports this Validator, so a barrel import here would cycle.\nimport { isArrayOf } from '../converters/Converters';\nimport { ListOfBuiltInConverters, BuiltInConverterTypeCheckers } from '../converters/ListOfBuiltInConverters';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { ArrayOf, ConverterToken } from '../converters/Converters';\nimport type { EnvFileOptions } from '../infra/Dotenv';\nimport type { StandardSchemaV1 } from '../infra/StandardSchema';\nimport type { BuiltInConverter, ConverterFunction, EnvaptConverter } from '../types';\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class -- cohesive dispatch of stateless type guards, same shape as BuiltInConverters\nexport class Validator {\n /**\n * Check if a value is a built-in scalar converter token\n */\n static isBuiltInConverter<TFallback>(value: EnvaptConverter<TFallback>): value is BuiltInConverter {\n if (typeof value === 'string') return ListOfBuiltInConverters.includes(value);\n return false;\n }\n\n /**\n * Check if a value is an `ArrayOf<...>` token produced by {@link Converters.array}.\n */\n static isArrayConverter(value: unknown): value is ArrayOf {\n return isArrayOf(value);\n }\n\n // Structural check: `version === 1` + callable `validate` is the minimum dispatchable\n // shape per the Standard Schema spec.\n static isStandardSchema(value: unknown): value is StandardSchemaV1 {\n if (typeof value !== 'object' || value === null) return false;\n if (!('~standard' in value)) return false;\n const slot = value['~standard'];\n if (typeof slot !== 'object' || slot === null) return false;\n const props = slot as { version?: unknown; validate?: unknown };\n return props.version === 1 && typeof props.validate === 'function';\n }\n\n static customConvertor<TFallback>(\n converter: EnvaptConverter<TFallback>\n ): asserts converter is ConverterFunction<TFallback> {\n if (typeof converter !== 'function') {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidCustomConverter,\n `Custom converter must be a function, got ${typeof converter}.`\n );\n }\n }\n\n /**\n * Runtime validation that the `ArrayOf<...>` configuration is well-formed.\n */\n static arrayConverter(value: unknown): asserts value is ArrayOf {\n if (!isArrayOf(value)) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidArrayConverterType,\n 'Expected an ArrayOf<...> token produced by Converters.array(...)'\n );\n }\n\n if (typeof value.delimiter !== 'string' || value.delimiter.length === 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingDelimiter,\n `ArrayOf<...> requires a non-empty string delimiter, got ${typeof value.delimiter}`\n );\n }\n\n const elementOf = value.of;\n const isScalar = typeof elementOf === 'string' && ListOfBuiltInConverters.includes(elementOf);\n const isCustomFn = typeof elementOf === 'function';\n if (!isScalar && !isCustomFn) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidArrayConverterType,\n `ArrayOf<...> element (\"of\") must be a built-in scalar token or a function, got ${typeof elementOf}`\n );\n }\n }\n\n /**\n * Validate that a string is a valid built-in scalar converter token\n */\n static builtInConverter(value: unknown): asserts value is BuiltInConverter {\n if (typeof value !== 'string') {\n throw new EnvaptError(EnvaptErrorCodes.InvalidConverterType, `Expected string, got ${typeof value}`);\n }\n\n if (!ListOfBuiltInConverters.includes(value as ConverterToken)) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidBuiltInConverter,\n `\"${value}\" is not a valid converter type. Valid types are: ${ListOfBuiltInConverters.join(',')}`\n );\n }\n }\n\n /**\n * Validate that fallback type matches the converter's return type for built-in converters\n */\n static validateBuiltInConverterFallback(converter: BuiltInConverter, fallback: unknown): void {\n const typeChecker = BuiltInConverterTypeCheckers[converter];\n if (!typeChecker(fallback)) {\n throw new EnvaptError(\n EnvaptErrorCodes.FallbackConverterTypeMismatch,\n `Fallback type does not match converter \"${converter}\". Expected ${converter} compatible type.`\n );\n }\n }\n\n /**\n * Validate that all elements in an array fallback have consistent types\n */\n static validateArrayFallbackElementTypes(fallback: unknown[]): void {\n if (fallback.length === 0) return;\n\n const firstElementType = typeof fallback[0];\n const hasInconsistentTypes = fallback.some((element, index) => {\n if (index === 0) return false;\n return typeof element !== firstElementType;\n });\n\n if (hasInconsistentTypes) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n `All elements in array fallback must have the same type. Found mixed types.`\n );\n }\n }\n\n /**\n * Validate that an `ArrayOf<...>` element converter matches the runtime types of its\n * fallback elements. For `Converters.Time` arrays the element-time-string format is also\n * checked here.\n */\n static validateArrayConverterElementTypeMatch(elementOf: ArrayOf['of'], fallback: unknown[]): void {\n if (fallback.length === 0) return;\n\n if (typeof elementOf === 'function') {\n // Custom element converters can return anything; we can't statically validate the fallback shape.\n return;\n }\n\n const elementToken = elementOf;\n\n // Time array fallbacks may be number[] OR string[] (TimeFallback[]).\n if (elementToken === 'time') {\n const everyNumber = fallback.every((v) => typeof v === 'number');\n const everyString = fallback.every((v) => typeof v === 'string');\n if (!everyNumber && !everyString) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n 'Time array fallback must be all numbers or all time-string entries.'\n );\n }\n return;\n }\n\n const typeChecker = BuiltInConverterTypeCheckers[elementToken];\n const firstElement = fallback[0];\n if (!typeChecker(firstElement)) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n `Array converter type \"${elementToken}\" does not match fallback element type. Expected ${elementToken} compatible elements.`\n );\n }\n }\n\n /**\n * Check if a value is a primitive constructor\n */\n static isPrimitiveConstructor(\n value: unknown\n ): value is typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol {\n return value === String || value === Number || value === Boolean || value === BigInt || value === Symbol;\n }\n\n /**\n * Safely coerce a fallback value using a primitive constructor\n */\n static coercePrimitiveFallback<CoercedType>(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): CoercedType {\n if (this.isCorrectPrimitiveType(converter, fallback)) return fallback as CoercedType;\n return this.performPrimitiveCoercion<CoercedType>(converter, fallback);\n }\n\n private static isCorrectPrimitiveType(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): boolean {\n if (converter === String && typeof fallback === 'string') return true;\n if (converter === Number && typeof fallback === 'number') return true;\n if (converter === Boolean && typeof fallback === 'boolean') return true;\n if (converter === BigInt && typeof fallback === 'bigint') return true;\n if (converter === Symbol && typeof fallback === 'symbol') return true;\n return false;\n }\n\n private static performPrimitiveCoercion<CoercedType>(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): CoercedType {\n try {\n if (converter === String) return String(fallback) as CoercedType;\n if (converter === Number) return Number(fallback) as CoercedType;\n if (converter === Boolean) return Boolean(fallback) as CoercedType;\n if (converter === BigInt) return BigInt(fallback as string | number | bigint) as CoercedType;\n /* v8 ignore next -- @preserve */\n if (converter === Symbol) return Symbol.for(String(fallback)) as CoercedType;\n } catch (error) {\n throw new EnvaptError(\n EnvaptErrorCodes.PrimitiveCoercionFailed,\n `Failed to coerce fallback value using ${converter.name}: ${(error as Error).message}`\n );\n }\n\n /* v8 ignore next -- @preserve */\n throw new EnvaptError(\n EnvaptErrorCodes.PrimitiveCoercionFailed,\n `Unknown primitive converter: ${converter.name}`\n );\n }\n\n /**\n * Reject non-boolean inputs to `Envapter.syncProcessEnv` so a truthy typo\n * (`'true'`, `1`, etc.) does not silently enable the mirror.\n */\n static validateSyncProcessEnv(value: unknown): asserts value is boolean {\n if (typeof value !== 'boolean') {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Envapter.syncProcessEnv must be a boolean, got ${typeof value}.`\n );\n }\n }\n\n /**\n * Make sure the user hasn't provided prohibited options in their dotenv config\n */\n static validateEnvFileOptions(config: object): config is EnvFileOptions {\n const validKeys = new Set(['encoding', 'override']);\n const invalidKeys = Object.keys(config).filter((key) => !validKeys.has(key));\n\n if (invalidKeys.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Invalid envFileOptions: ${invalidKeys.join(', ')}. Allowed options: ${Array.from(validKeys).join(', ')}. For debug output, use Envapter.debug or the ENVAPT_DEBUG env var.`\n );\n }\n\n return true;\n }\n\n // Existence is probed through the caller-supplied `fileExists` (backed by the bound source) so\n // this stays free of `node:fs`.\n static validateEnvFilesExist(paths: string[], fileExists: (path: string) => boolean): void {\n const missing = paths.filter((p) => !fileExists(p));\n\n if (missing.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.EnvFilesNotFound,\n `Environment file not found at path: ${missing.join(', ')}`\n );\n }\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"Validators.mjs","names":[],"sources":["../../../src/engine/Validators.ts"],"sourcesContent":["// Import the converter modules directly, not via the `./converters` barrel: that barrel pulls in\n// ValueConverter, which imports this Validator, so a barrel import here would cycle.\nimport { isArrayOf } from '../converters/Converters';\nimport { ListOfBuiltInConverters, BuiltInConverterTypeCheckers } from '../converters/ListOfBuiltInConverters';\nimport { EnvaptError, EnvaptErrorCodes } from '../infra/Error';\n\nimport type { ArrayOf, ConverterToken } from '../converters/Converters';\nimport type { EnvFileOptions } from '../infra/Dotenv';\nimport type { StandardSchemaV1 } from '../infra/StandardSchema';\nimport type { BuiltInConverter, ConverterFunction, EnvaptConverter, FileApiMode } from '../types';\n\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class -- cohesive dispatch of stateless type guards, same shape as BuiltInConverters\nexport class Validator {\n /**\n * Check if a value is a built-in scalar converter token\n */\n static isBuiltInConverter<TFallback>(value: EnvaptConverter<TFallback>): value is BuiltInConverter {\n if (typeof value === 'string') return ListOfBuiltInConverters.includes(value);\n return false;\n }\n\n /**\n * Check if a value is an `ArrayOf<...>` token produced by {@link Converters.array}.\n */\n static isArrayConverter(value: unknown): value is ArrayOf {\n return isArrayOf(value);\n }\n\n // Structural check: `version === 1` + callable `validate` is the minimum dispatchable\n // shape per the Standard Schema spec.\n static isStandardSchema(value: unknown): value is StandardSchemaV1 {\n if (typeof value !== 'object' || value === null) return false;\n if (!('~standard' in value)) return false;\n const slot = value['~standard'];\n if (typeof slot !== 'object' || slot === null) return false;\n const props = slot as { version?: unknown; validate?: unknown };\n return props.version === 1 && typeof props.validate === 'function';\n }\n\n static customConvertor<TFallback>(\n converter: EnvaptConverter<TFallback>\n ): asserts converter is ConverterFunction<TFallback> {\n if (typeof converter !== 'function') {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidCustomConverter,\n `Custom converter must be a function, got ${typeof converter}.`\n );\n }\n }\n\n /**\n * Runtime validation that the `ArrayOf<...>` configuration is well-formed.\n */\n static arrayConverter(value: unknown): asserts value is ArrayOf {\n if (!isArrayOf(value)) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidArrayConverterType,\n 'Expected an ArrayOf<...> token produced by Converters.array(...)'\n );\n }\n\n if (typeof value.delimiter !== 'string' || value.delimiter.length === 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.MissingDelimiter,\n `ArrayOf<...> requires a non-empty string delimiter, got ${typeof value.delimiter}`\n );\n }\n\n const elementOf = value.of;\n const isScalar = typeof elementOf === 'string' && ListOfBuiltInConverters.includes(elementOf);\n const isCustomFn = typeof elementOf === 'function';\n if (!isScalar && !isCustomFn) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidArrayConverterType,\n `ArrayOf<...> element (\"of\") must be a built-in scalar token or a function, got ${typeof elementOf}`\n );\n }\n }\n\n /**\n * Validate that a string is a valid built-in scalar converter token\n */\n static builtInConverter(value: unknown): asserts value is BuiltInConverter {\n if (typeof value !== 'string') {\n throw new EnvaptError(EnvaptErrorCodes.InvalidConverterType, `Expected string, got ${typeof value}`);\n }\n\n if (!ListOfBuiltInConverters.includes(value as ConverterToken)) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidBuiltInConverter,\n `\"${value}\" is not a valid converter type. Valid types are: ${ListOfBuiltInConverters.join(',')}`\n );\n }\n }\n\n /**\n * Validate that fallback type matches the converter's return type for built-in converters\n */\n static validateBuiltInConverterFallback(converter: BuiltInConverter, fallback: unknown): void {\n const typeChecker = BuiltInConverterTypeCheckers[converter];\n if (!typeChecker(fallback)) {\n throw new EnvaptError(\n EnvaptErrorCodes.FallbackConverterTypeMismatch,\n `Fallback type does not match converter \"${converter}\". Expected ${converter} compatible type.`\n );\n }\n }\n\n /**\n * Validate that all elements in an array fallback have consistent types\n */\n static validateArrayFallbackElementTypes(fallback: unknown[]): void {\n if (fallback.length === 0) return;\n\n const firstElementType = typeof fallback[0];\n const hasInconsistentTypes = fallback.some((element, index) => {\n if (index === 0) return false;\n return typeof element !== firstElementType;\n });\n\n if (hasInconsistentTypes) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n `All elements in array fallback must have the same type. Found mixed types.`\n );\n }\n }\n\n /**\n * Validate that an `ArrayOf<...>` element converter matches the runtime types of its\n * fallback elements. For `Converters.Time` arrays the element-time-string format is also\n * checked here.\n */\n static validateArrayConverterElementTypeMatch(elementOf: ArrayOf['of'], fallback: unknown[]): void {\n if (fallback.length === 0) return;\n\n if (typeof elementOf === 'function') {\n // Custom element converters can return anything; we can't statically validate the fallback shape.\n return;\n }\n\n const elementToken = elementOf;\n\n // Time array fallbacks may be number[] OR string[] (TimeFallback[]).\n if (elementToken === 'time') {\n const everyNumber = fallback.every((v) => typeof v === 'number');\n const everyString = fallback.every((v) => typeof v === 'string');\n if (!everyNumber && !everyString) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n 'Time array fallback must be all numbers or all time-string entries.'\n );\n }\n return;\n }\n\n const typeChecker = BuiltInConverterTypeCheckers[elementToken];\n const firstElement = fallback[0];\n if (!typeChecker(firstElement)) {\n throw new EnvaptError(\n EnvaptErrorCodes.ArrayFallbackElementTypeMismatch,\n `Array converter type \"${elementToken}\" does not match fallback element type. Expected ${elementToken} compatible elements.`\n );\n }\n }\n\n /**\n * Check if a value is a primitive constructor\n */\n static isPrimitiveConstructor(\n value: unknown\n ): value is typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol {\n return value === String || value === Number || value === Boolean || value === BigInt || value === Symbol;\n }\n\n /**\n * Safely coerce a fallback value using a primitive constructor\n */\n static coercePrimitiveFallback<CoercedType>(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): CoercedType {\n if (this.isCorrectPrimitiveType(converter, fallback)) return fallback as CoercedType;\n return this.performPrimitiveCoercion<CoercedType>(converter, fallback);\n }\n\n private static isCorrectPrimitiveType(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): boolean {\n if (converter === String && typeof fallback === 'string') return true;\n if (converter === Number && typeof fallback === 'number') return true;\n if (converter === Boolean && typeof fallback === 'boolean') return true;\n if (converter === BigInt && typeof fallback === 'bigint') return true;\n if (converter === Symbol && typeof fallback === 'symbol') return true;\n return false;\n }\n\n private static performPrimitiveCoercion<CoercedType>(\n converter: typeof String | typeof Number | typeof Boolean | typeof BigInt | typeof Symbol,\n fallback: unknown\n ): CoercedType {\n try {\n if (converter === String) return String(fallback) as CoercedType;\n if (converter === Number) return Number(fallback) as CoercedType;\n if (converter === Boolean) return Boolean(fallback) as CoercedType;\n if (converter === BigInt) return BigInt(fallback as string | number | bigint) as CoercedType;\n /* v8 ignore next -- @preserve */\n if (converter === Symbol) return Symbol.for(String(fallback)) as CoercedType;\n } catch (error) {\n throw new EnvaptError(\n EnvaptErrorCodes.PrimitiveCoercionFailed,\n `Failed to coerce fallback value using ${converter.name}: ${(error as Error).message}`\n );\n }\n\n /* v8 ignore next -- @preserve */\n throw new EnvaptError(\n EnvaptErrorCodes.PrimitiveCoercionFailed,\n `Unknown primitive converter: ${converter.name}`\n );\n }\n\n /**\n * Reject non-boolean inputs to `Envapter.syncProcessEnv` so a truthy typo\n * (`'true'`, `1`, etc.) does not silently enable the mirror.\n */\n static validateSyncProcessEnv(value: unknown): asserts value is boolean {\n if (typeof value !== 'boolean') {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Envapter.syncProcessEnv must be a boolean, got ${typeof value}.`\n );\n }\n }\n\n static validateFileApiMode(value: unknown): asserts value is FileApiMode {\n if (value !== 'warn' && value !== 'throw') {\n const got = typeof value === 'string' ? `'${value}'` : typeof value;\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Envapter.fileApiMode must be 'warn' or 'throw', got ${got}.`\n );\n }\n }\n\n /**\n * Make sure the user hasn't provided prohibited options in their dotenv config\n */\n static validateEnvFileOptions(config: object): config is EnvFileOptions {\n const validKeys = new Set(['encoding', 'override']);\n const invalidKeys = Object.keys(config).filter((key) => !validKeys.has(key));\n\n if (invalidKeys.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.InvalidUserDefinedConfig,\n `Invalid envFileOptions: ${invalidKeys.join(', ')}. Allowed options: ${Array.from(validKeys).join(', ')}. For debug output, use Envapter.debug or the ENVAPT_DEBUG env var.`\n );\n }\n\n return true;\n }\n\n // Existence is probed through the caller-supplied `fileExists` (backed by the bound source) so\n // this stays free of `node:fs`.\n static validateEnvFilesExist(paths: string[], fileExists: (path: string) => boolean): void {\n const missing = paths.filter((p) => !fileExists(p));\n\n if (missing.length > 0) {\n throw new EnvaptError(\n EnvaptErrorCodes.EnvFilesNotFound,\n `Environment file not found at path: ${missing.join(', ')}`\n );\n }\n }\n}\n"],"mappings":"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"}
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./converters/Converters.cjs"),t=require("./infra/Error.cjs"),n=require("./core/EnvironmentMethods.cjs"),r=require("./sources/PortableSource.cjs"),i=require("./sources/ManualEnvSource.cjs"),a=require("./sources/WorkerEnvSource.cjs"),o=require("./decorators/modern/Envapt.cjs"),s=require("./decorators/modern/SugarDecorators.cjs"),c=require("./sources/NodeEnvSource.cjs"),l=require("./engine/NodeEnvapter.cjs");exports.Converters=e.Converters,exports.EnvBool=s.EnvBool,exports.EnvNum=s.EnvNum,exports.EnvStr=s.EnvStr,exports.EnvTime=s.EnvTime,exports.EnvUrl=s.EnvUrl,exports.Envapt=o.Envapt,exports.EnvaptError=t.EnvaptError,exports.EnvaptErrorCodes=t.EnvaptErrorCodes,exports.Envapter=l.NodeEnvapter,exports.Environment=n.Environment,exports.ManualEnvSource=i.ManualEnvSource,exports.NodeEnvSource=c.NodeEnvSource,exports.PortableSource=r.PortableSource,exports.WorkerEnvSource=a.WorkerEnvSource,exports.isArrayOf=e.isArrayOf;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./infra/Error.cjs"),t=require("./core/Environment.cjs"),n=require("./converters/Converters.cjs"),r=require("./sources/PortableSource.cjs"),i=require("./sources/merge.cjs"),a=require("./decorators/modern/Envapt.cjs"),o=require("./decorators/modern/SugarDecorators.cjs"),s=require("./sources/FileSource.cjs"),c=require("./engine/NodeEnvapter.cjs");exports.Converters=n.Converters,exports.EnvBool=o.EnvBool,exports.EnvNum=o.EnvNum,exports.EnvStr=o.EnvStr,exports.EnvTime=o.EnvTime,exports.EnvUrl=o.EnvUrl,exports.Envapt=a.Envapt,exports.EnvaptError=e.EnvaptError,exports.EnvaptErrorCodes=e.EnvaptErrorCodes,exports.Envapter=c.NodeEnvapter,exports.Environment=t.Environment,exports.FileSource=s.FileSource,exports.PortableSource=r.PortableSource,exports.merge=i.merge;
@@ -1 +1 @@
1
- import{Converters as e,isArrayOf as t}from"./converters/Converters.mjs";import{EnvaptError as n,EnvaptErrorCodes as r}from"./infra/Error.mjs";import{Environment as i}from"./core/EnvironmentMethods.mjs";import{PortableSource as a}from"./sources/PortableSource.mjs";import{ManualEnvSource as o}from"./sources/ManualEnvSource.mjs";import{WorkerEnvSource as s}from"./sources/WorkerEnvSource.mjs";import{Envapt as c}from"./decorators/modern/Envapt.mjs";import{EnvBool as l,EnvNum as u,EnvStr as d,EnvTime as f,EnvUrl as p}from"./decorators/modern/SugarDecorators.mjs";import{NodeEnvSource as m}from"./sources/NodeEnvSource.mjs";import{NodeEnvapter as h}from"./engine/NodeEnvapter.mjs";export{e as Converters,l as EnvBool,u as EnvNum,d as EnvStr,f as EnvTime,p as EnvUrl,c as Envapt,n as EnvaptError,r as EnvaptErrorCodes,h as Envapter,i as Environment,o as ManualEnvSource,m as NodeEnvSource,a as PortableSource,s as WorkerEnvSource,t as isArrayOf};
1
+ import{EnvaptError as e,EnvaptErrorCodes as t}from"./infra/Error.mjs";import{Environment as n}from"./core/Environment.mjs";import{Converters as r}from"./converters/Converters.mjs";import{PortableSource as i}from"./sources/PortableSource.mjs";import{merge as a}from"./sources/merge.mjs";import{Envapt as o}from"./decorators/modern/Envapt.mjs";import{EnvBool as s,EnvNum as c,EnvStr as l,EnvTime as u,EnvUrl as d}from"./decorators/modern/SugarDecorators.mjs";import{FileSource as f}from"./sources/FileSource.mjs";import{NodeEnvapter as p}from"./engine/NodeEnvapter.mjs";export{r as Converters,s as EnvBool,c as EnvNum,l as EnvStr,u as EnvTime,d as EnvUrl,o as Envapt,e as EnvaptError,t as EnvaptErrorCodes,p as Envapter,n as Environment,f as FileSource,i as PortableSource,a as merge};
@@ -1,2 +1,2 @@
1
- const e=require("./Error.cjs"),t=require("./runtime.cjs"),n=new Set([`silent`,`warn`,`verbose`]);let r=`silent`,i=!1;function a(e){return e!==void 0&&n.has(e)}function o(){if(!i){let e=t.readRuntimeEnv().ENVAPT_DEBUG;r=a(e)?e:`silent`,i=!0}return r}function s(t){if(!a(t))throw new e.EnvaptError(302,`Invalid debug level "${String(t)}". Expected 'silent' | 'warn' | 'verbose'.`);r=t,i=!0}function c(){return o()}function l(e){let n=o();(n===`warn`||n===`verbose`)&&t.writeRuntimeLine(`[envapt] ${e}`)}function u(e){o()===`verbose`&&t.writeRuntimeLine(`[envapt] ${e}`)}exports.debugVerbose=u,exports.debugWarn=l,exports.getDebugLevel=c,exports.setDebugLevel=s;
1
+ const e=require("./Error.cjs"),t=require("./runtime.cjs"),n=new Set([`silent`,`warn`,`verbose`]);let r=`silent`,i=!1;function a(e){return e!==void 0&&n.has(e)}function o(){if(!i){let e=t.readRuntimeVar(`ENVAPT_DEBUG`);r=a(e)?e:`silent`,i=!0}return r}function s(t){if(!a(t))throw new e.EnvaptError(302,`Invalid debug level "${String(t)}". Expected 'silent' | 'warn' | 'verbose'.`);r=t,i=!0}function c(){return o()}function l(e){let n=o();(n===`warn`||n===`verbose`)&&t.writeRuntimeLine(`[envapt] ${e}`)}function u(e){o()===`verbose`&&t.writeRuntimeLine(`[envapt] ${e}`)}exports.debugVerbose=u,exports.debugWarn=l,exports.getDebugLevel=c,exports.setDebugLevel=s;
2
2
  //# sourceMappingURL=Debug.cjs.map