envapt 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,206 @@
1
+ # envapt
2
+
3
+ ## 4.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 1244fb1: bump deps
8
+
9
+ ## 4.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - a87c8e5: allow passing a list of env as the first arg to Envapt or Envapter methods. envapt will look for the env left-to-right and pick the first available one. passing a string still works and everything that worked before will work the same right now
14
+
15
+ ## 4.0.2
16
+
17
+ ### Patch Changes
18
+
19
+ - 9c7b728: bump versions
20
+ - 9c7b728: add examples for each overload of the Envapt decorator
21
+
22
+ ## 4.0.1
23
+
24
+ ### Patch Changes
25
+
26
+ - bump deps
27
+
28
+ ## 4.0.0
29
+
30
+ ### Major Changes
31
+
32
+ - **BREAKING:** Simplify exports and type definitions for ESM and CJS. Replaced the nested exports map with flat fields import, require, and default. Types are now only at ./dist/index.d.ts. Removed the build step that renamed index.d.cts to index.d.mts.
33
+
34
+ ## 3.0.2
35
+
36
+ ### Patch Changes
37
+
38
+ - 063703c: bump deps
39
+
40
+ ## 3.0.1
41
+
42
+ ### Patch Changes
43
+
44
+ - bump deps and refactor regexes to use String.raw and RegExp obj in BuiltInConverters to avoid disabling eslint rules
45
+
46
+ ## 3.0.0
47
+
48
+ ### Major Changes
49
+
50
+ - 482eb6d: **BREAKING:** Custom Converters will now execute even if an env variable is not present in the source env file(s). This allows for using `@Envapt` to validate the existence of variables by throwing errors inside the user-defined Custom Converters
51
+
52
+ ### Patch Changes
53
+
54
+ - 5d1df34: update README to include new things and better navigation
55
+
56
+ ## 2.2.10
57
+
58
+ ### Patch Changes
59
+
60
+ - remove codecov config
61
+
62
+ ## 2.2.9
63
+
64
+ ### Patch Changes
65
+
66
+ - b263044: Ensure expected behavior to reject non ISO strings for Date converters
67
+ - 953bcb2: Improve test coverage by ignoring unreachable defensive programming blocks
68
+ - 8f0722d: Linting for TSDoc
69
+ - bc945d4: Safety when attempting to coerce to Symbol
70
+ - a21de8c: Augment ImportMeta instead of exporting a method
71
+ - dbd99b9: Cleanup files and configure vitest extension
72
+
73
+ ## 2.2.8
74
+
75
+ ### Patch Changes
76
+
77
+ - e9e359e: Port tests to vitest
78
+
79
+ ## 2.2.7
80
+
81
+ ### Patch Changes
82
+
83
+ - Fix readme badge for tests CI and make file ext consistent in workflows dir
84
+
85
+ ## 2.2.6
86
+
87
+ ### Patch Changes
88
+
89
+ - 01b1ba0: Fix deno missing mocha types error by explicitly importing mocha types in test files
90
+ - 0be2af4: Better test names and some badge formatting in README. Also condensed NOTICE and the other license file into one NOTICE.md file.
91
+
92
+ ## 2.2.5
93
+
94
+ ### Patch Changes
95
+
96
+ - 7bb1923: Fixing types and removing `Error.captureStackTrace` to follow ECMAScript specifications
97
+
98
+ ## 2.2.4
99
+
100
+ ### Patch Changes
101
+
102
+ - 435a738: Add jsr publishing support and a test for the previous version's type-error patch
103
+ - f17ca67: Bump deps: @types/node
104
+ - 6d47364: Bump deps: @typescript-eslint/parser
105
+ - fe12794: Bump deps: typescript-eslint
106
+
107
+ ## 2.2.3
108
+
109
+ ### Patch Changes
110
+
111
+ - 73162d8: `undefined` as fallback causing type errors when provided with a BuiltIn or Array Converter
112
+ - d56fe89: Fix incorrect example in the README for URL converter and add some comments for `@Envapt` overloads
113
+
114
+ ## 2.2.2
115
+
116
+ ### Patch Changes
117
+
118
+ - 6c1caaa: Fix grammar mistake in README
119
+
120
+ ## 2.2.1
121
+
122
+ ### Patch Changes
123
+
124
+ - f1c81cc: Make clear that Envapt can be used with JavaScript too
125
+
126
+ ## 2.2.0
127
+
128
+ ### Minor Changes
129
+
130
+ - a74e97d: Tagged Template resolver for a easily "one-lining" multiple parsed envs in a string literal. It also supports template variables like `${VAR}`! Check README for usage and examples.
131
+
132
+ ### Patch Changes
133
+
134
+ - c479505: Missing export for `EnvaptError`
135
+ - f15ddc9: Fix cache collisions on Envapt used on a static property in one class, and an instance property in another class with the property name being the same for both
136
+ - 447aaa4: Fix incorrect "main" export in package.json
137
+
138
+ ## 2.1.1
139
+
140
+ ### Patch Changes
141
+
142
+ - "boilerplate of parsing" → "boilerplate of transforming parsed" in README
143
+
144
+ ## 2.1.0
145
+
146
+ ### Minor Changes
147
+
148
+ - Fix missing `.mjs` build
149
+
150
+ ## 2.0.0
151
+
152
+ ### Major Changes
153
+
154
+ - 7e3a440: Strict Runtime Validation
155
+ - **BREAKING:** Runtime type validation between converter return types and fallback values exists now... and it's strict!
156
+ - But only for built-in and array converters. You are free to do what you want with custom converters.
157
+ - EnvaptError codes actually make sense now instead of the random numbers they were before
158
+ - Added primitive type coercion validation and better error handling
159
+
160
+ Since this didn't exist before, it will break existing code that was previously passing incorrect types.
161
+
162
+ - 7e3a440: Major Type Inference Improvements
163
+ - **BREAKING:** Improved type inference for `@Envapt` decorator with better type safety
164
+ - Fallbacks and Converters are also validated against each other
165
+ - Fallback always decides the type and converter has to match it, except when using a Primitive constructor.
166
+ - Fixed incorrect type inference in **many** cases
167
+ - **BREAKING:** `@Envapt` won't allow you to use its Classic API for any custom converters anymore. Please use the decorator's Modern API, or the Functional API instead.
168
+ - I updated the overloads for `@Envapt` which fixed most of the type inference issues and also the point above.
169
+
170
+ Improved type checking may break existing code that was previously passing incorrect types. Typecheck your files after you update pls.
171
+
172
+ Decorators don't exactly set the value they return to the property they decorate, so the inferred type you see on hover for `@Envapt` will be the type of the converter rather than the type of the property it'll set. Although, for the functional API, the type will be the type of the property it'll set.
173
+
174
+ ### Minor Changes
175
+
176
+ - 7e3a440: Enums for Built-in Converters
177
+ - Added `Converters` enum because they look better than string literals and provide better DX
178
+ - Allows using `Converters.String`, `Converters.Number`, etc. instead of string literals
179
+ - Maintains backward compatibility with string literal converter names
180
+
181
+ - 7e3a440: Customize Dotenv Configs
182
+ - Change how dotenv loads your env files. (Excludes the `path` and `processEnv` options because Envapter handles those)
183
+ - `Envapter.dotenvConfig` property for setting encoding, debug, override, and other dotenv options
184
+ - Now validates the file paths you provide to ensure they exist
185
+
186
+ - 7e3a440: New Functional API Methods
187
+ - Added `getUsing()` method for using built-in converters functionally
188
+ - Type overrides in `getUsing<T>()` if you need to specify a different type than the converter's inferred return type
189
+ - Added `getWith()` method for using custom converter functions functionally
190
+ - Functional API actually knows that a value won't be undefined if you pass a fallback value now
191
+
192
+ ### Patch Changes
193
+
194
+ - 7e3a440: Dev and Testing Improvements
195
+ - Coverage for codecov
196
+ - Tests for BigInt and Symbol types
197
+ - Tests for primitive type coercion and multi-line environment variables
198
+ - LOTS more tests I don't remember
199
+
200
+ - 7e3a440: Refactored Some Code
201
+ - Envapter went over 400 lines and eslint started crying. It was a sign.
202
+ - It's basically a mixin using inheritance now. Nothing changed for the user though.
203
+ - Some Types were removed from the public API because they didn't have any use outside of internal code.
204
+
205
+ - 7e3a440: Make README.md pretty 🙏🏻
206
+ - Also shorten some scripts in package.json and update files that use these scripts
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="/.github/assets/banner.png" alt="Envapt – The apt way to handle environment variables" width="100%" />
2
+ <img src="https://raw.githubusercontent.com/materwelonDhruv/envapt/main/.github/assets/banner.png" alt="Envapt – The apt way to handle environment variables" width="100%" />
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -10,7 +10,7 @@
10
10
  <div align="center">
11
11
  <a href="https://www.npmjs.com/package/envapt"><img alt="npm" src="https://img.shields.io/npm/v/envapt?logo=npm&logoColor=cb3838&label=%20&labelColor=103544&color=cb3838"></a>
12
12
  <a href="https://jsr.io/@materwelon/envapt"><img alt="jsr" src="https://jsr.io/badges/@materwelon/envapt"></a>
13
- <img alt="CI" src="https://img.shields.io/github/actions/workflow/status/materwelonDhruv/envapt/check.yml?branch=main&label=tests&style=flat&logo=github&color=3fb950&labelColor=103544"></a>
13
+ <img alt="CI" src="https://img.shields.io/github/actions/workflow/status/materwelonDhruv/envapt/checks.yml?branch=main&label=tests&style=flat&logo=github&color=3fb950&labelColor=103544"></a>
14
14
  <a href="https://codecov.io/github/materwelonDhruv/envapt"><img alt="codecov" src="https://img.shields.io/codecov/c/github/materwelonDhruv/envapt/main?token=IQ4GC645LO&logo=codecov&color=f01f7a&labelColor=103544"/></a>
15
15
  <br>
16
16
  <a href="LICENSE"><img alt="License" src="https://img.shields.io/npm/l/envapt?style=flat&color=e97826&logo=apache&label="></a>
@@ -19,7 +19,7 @@
19
19
  <a href="https://nodejs.org/api/modules.html"><img alt="CJS" src="https://img.shields.io/badge/CJS-ff6b35?style=flat"></a>
20
20
  <a href="https://nodejs.org/"><img alt="Node" src="https://img.shields.io/badge/node-%3E=22.0.0-339933?style=flat&logo=node.js&logoColor=white"></a>
21
21
  <a href="https://bundlephobia.com/package/envapt"><img alt="Bundle Size" src="https://img.shields.io/bundlephobia/minzip/envapt?style=flat&color=212121"></a>
22
- <a href="https://www.npmjs.com/package/envapt"><img alt="Downloads" src="https://img.shields.io/npm/dm/envapt?style=flat&color=f7f6e8"></a>
22
+ <a href="https://www.npmjs.com/package/envapt"><img alt="Downloads (total)" src="https://img.shields.io/npm/dt/envapt?style=flat&color=f7f6e8"></a>
23
23
  <a href="https://github.com/materwelonDhruv/envapt/stargazers"><img alt="GitHub Stars" src="https://img.shields.io/github/stars/materwelondhruv/envapt?style=flat&color=e3b341"></a>
24
24
  </div>
25
25