@agnostack/env 1.3.0 → 1.4.0-beta.2

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,209 @@
1
+ # [1.3.0](https://github.com/agnostack/env/compare/v1.2.6...v1.3.0) (2025-08-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * added package exports/updated version ([b2dd4cc](https://github.com/agnostack/env/commit/b2dd4cc2d940b910a86fb01eb356cfbf5a5b99f0))
7
+
8
+ ## [1.2.6](https://github.com/agnostack/env/compare/v1.2.5...v1.2.6) (2025-07-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * added optionalDependencies/browserDependencies ([35156d8](https://github.com/agnostack/env/commit/35156d85f3974157587b1750f7f1885b6167142f))
14
+
15
+ ## [1.2.5](https://github.com/agnostack/env/compare/v1.2.4...v1.2.5) (2025-03-12)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * added parsePackageInfo and parseProjectName ([bb4ee3b](https://github.com/agnostack/env/commit/bb4ee3b4e155a006ed7557289e36b734a8a5fd23))
21
+ * updated handling of nested param ([4caa08f](https://github.com/agnostack/env/commit/4caa08f200978c0eac0355c17978d2367768f363))
22
+ * updated handling of nested param ([13f5711](https://github.com/agnostack/env/commit/13f5711dac795cb15aafae05d65134b3a76e8387))
23
+ * updated handling of nested param ([9f75c08](https://github.com/agnostack/env/commit/9f75c083488bff0511f399054b4bf9eb8bedc20c))
24
+ * updated handling of nested param ([48ac233](https://github.com/agnostack/env/commit/48ac233720ee5c8e00fd26c45d1938a98543dac7))
25
+ * updated handling of nested param ([633c7f6](https://github.com/agnostack/env/commit/633c7f66d1b0cf603d72adfcf5800c197eccad51))
26
+ * updated handling of nested param ([f0e368d](https://github.com/agnostack/env/commit/f0e368d2b193dd3ed62e070fde45fb902f51029f))
27
+ * updated handling of nested param ([d9b04c0](https://github.com/agnostack/env/commit/d9b04c09a43cbf2547628271839e27d51161d07c))
28
+ * updated merge ([85bcdc9](https://github.com/agnostack/env/commit/85bcdc9f9661b39d1dc78ae298cc5f8d3cf67274))
29
+
30
+ ## [1.2.4](https://github.com/agnostack/env/compare/v1.2.3...v1.2.4) (2025-02-27)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * added lowerKeyValidator/cleanLowerEnvv ([b16575a](https://github.com/agnostack/env/commit/b16575ad8a1ea6f9b7c7a5459c37b4855c3b33cc))
36
+
37
+ ## [1.2.3](https://github.com/agnostack/env/compare/v1.2.2...v1.2.3) (2025-02-13)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * updated versions for babel ([8f715a4](https://github.com/agnostack/env/commit/8f715a44f8a112fccebf830b0a44b0889c304961))
43
+ * updated versions for babel ([d0f4a92](https://github.com/agnostack/env/commit/d0f4a92dd3df49c70bba289df619d12067317921))
44
+
45
+ ## [1.2.2](https://github.com/agnostack/env/compare/v1.2.1...v1.2.2) (2025-02-11)
46
+
47
+
48
+ ### Bug Fixes
49
+
50
+ * merge branch 'develop' into beta ([932feca](https://github.com/agnostack/env/commit/932fecae8d113c2f00d4cce4eb68431a8a428008))
51
+ * testing moving to isReleaseRef ([f7a84d7](https://github.com/agnostack/env/commit/f7a84d7b36a4966a7f6e45481d0b11ebd4ba045e))
52
+ * testing moving to isReleaseRef ([4cb44ed](https://github.com/agnostack/env/commit/4cb44ed4a59b4d478bbb122a3dd5a60f0054d340))
53
+ * testing moving to releaserc.js ([9b5dbf5](https://github.com/agnostack/env/commit/9b5dbf5fa20b8be4561fa1e2d9d8f7a007a52979))
54
+ * testing moving to releaserc.js ([c4ee50d](https://github.com/agnostack/env/commit/c4ee50debbfdeb09fd09f3cece80f623d99abdd0))
55
+ * testing moving to releaserc.js ([bd3cc5f](https://github.com/agnostack/env/commit/bd3cc5f94416abe0291ff0f55feffcb401092f58))
56
+ * testing moving to releaserc.js ([cc11a02](https://github.com/agnostack/env/commit/cc11a02be8c9fd15955fc44b14523f364dd03842))
57
+ * testing moving to releaserc.js ([7f1b528](https://github.com/agnostack/env/commit/7f1b52816f9171e7a3dd788fbe11871d66793d50))
58
+ * testing moving to releaserc.js ([e57c104](https://github.com/agnostack/env/commit/e57c104334b6b9e8d13650aa61dc5991faadce8d))
59
+
60
+ ## [1.2.1](https://github.com/agnostack/env/compare/v1.2.0...v1.2.1) (2025-02-11)
61
+
62
+
63
+ ### Bug Fixes
64
+
65
+ * testing moving to .releaserc.json ([dc40ecf](https://github.com/agnostack/env/commit/dc40ecf14ee4bfd8b47103c7422439bff5092b23))
66
+ * testing moving to publish ([e5a7b25](https://github.com/agnostack/env/commit/e5a7b25db6f10f25a09b921291ac6da5807f8b98))
67
+ * testing moving to publish ([9f9b75b](https://github.com/agnostack/env/commit/9f9b75b8deca17155eb3461dff4f3b2ca99c2aba))
68
+ * updated npx semantic-release version ([d9a259f](https://github.com/agnostack/env/commit/d9a259f17b95b35d32a23d9011c80f9287b38e7c))
69
+ * updated to add semantic-release/github ([5345e39](https://github.com/agnostack/env/commit/5345e39d37191c7157386d8699f48f26c695f82a))
70
+ * updated to limit branches for semantic-release/github ([7b6c1d9](https://github.com/agnostack/env/commit/7b6c1d946cfe9ad185f3b6a0d80b9b9279b7042b))
71
+ * updated to limit branches for semantic-release/github ([a112947](https://github.com/agnostack/env/commit/a1129470a09edde3fc98200835ddc7a02823b08c))
72
+
73
+
74
+ # [1.2.0](https://github.com/agnostack/env/compare/v1.1.3...v1.2.0) (2025-02-11)
75
+
76
+
77
+ ### Features
78
+
79
+ * updated to new semantic release versions ([6a3043e](https://github.com/agnostack/env/commit/6a3043e35026b6e49a75403a29fbef753f7b92a4))
80
+ * updated to new semantic release versions ([5e060ec](https://github.com/agnostack/env/commit/5e060ec5fd9dd704b08949e33aa4ada108afae6a))
81
+ * updated to new semantic release versions ([e89a8ce](https://github.com/agnostack/env/commit/e89a8ce13ea7b4fdd90851c04947be292a551523))
82
+
83
+ ## [1.1.3](https://github.com/agnostack/env/compare/v1.1.2...v1.1.3) (2025-02-11)
84
+
85
+
86
+ ### Bug Fixes
87
+
88
+ * updated releaserc ([2ed3b0e](https://github.com/agnostack/env/commit/2ed3b0e70a3ebd61554b7e9099b683d834dc12df))
89
+ * updated releaserc ([e04840e](https://github.com/agnostack/env/commit/e04840e5bbaef160fbec2da09701fdb37063d247))
90
+
91
+ ## [1.1.2](https://github.com/agnostack/env/compare/v1.1.1...v1.1.2) (2025-02-11)
92
+
93
+
94
+ ### Bug Fixes
95
+
96
+ * downgraded ts-jest, added config ([897971b](https://github.com/agnostack/env/commit/897971bdd053546ba08247b4ad4ac96309911f17))
97
+
98
+ ## [1.1.1](https://github.com/agnostack/env/compare/v1.1.0...v1.1.1) (2025-02-05)
99
+
100
+
101
+ ### Bug Fixes
102
+
103
+ * updated logic on precedence of ENVIRONMENT ([fdf1ed4](https://github.com/agnostack/env/commit/fdf1ed413ec6de045eeba909a3d92fb70a1559ea))
104
+ * updated logic on precedence of ENVIRONMENT ([cd40341](https://github.com/agnostack/env/commit/cd40341e4b13b8b85009de2cbb0cc64c51c7f37d))
105
+
106
+ # [1.1.0](https://github.com/agnostack/env/compare/v1.0.11...v1.1.0) (2025-02-05)
107
+
108
+
109
+ ### Features
110
+
111
+ * added replaceEnvTemplate ([02db0ab](https://github.com/agnostack/env/commit/02db0abe659682babc1304b630b15f7f0e703d1c))
112
+
113
+ ## [1.0.11](https://github.com/agnostack/env/compare/v1.0.10...v1.0.11) (2025-02-03)
114
+
115
+
116
+ ### Bug Fixes
117
+
118
+ * updated cleanParams ([f23c2a4](https://github.com/agnostack/env/commit/f23c2a430264d125a76947806ea6b785596c3a02))
119
+
120
+ ## [1.0.10](https://github.com/agnostack/env/compare/v1.0.9...v1.0.10) (2025-01-31)
121
+
122
+
123
+ ### Bug Fixes
124
+
125
+ * updated params ([d92a3f4](https://github.com/agnostack/env/commit/d92a3f44cebbd14f6fc269493eabcf8751eeca04))
126
+
127
+ ## [1.0.9](https://github.com/agnostack/env/compare/v1.0.8...v1.0.9) (2025-01-30)
128
+
129
+
130
+ ### Bug Fixes
131
+
132
+ * added argsParams vs params ([a29b5ab](https://github.com/agnostack/env/commit/a29b5ab1f72a78f271e33509cff20a9854f74810))
133
+
134
+ ## [1.0.8](https://github.com/agnostack/env/compare/v1.0.7...v1.0.8) (2025-01-30)
135
+
136
+
137
+ ### Bug Fixes
138
+
139
+ * updated broken/incorrect logic ([dd7eb28](https://github.com/agnostack/env/commit/dd7eb282025b22efdbe0862b680df47585872408))
140
+
141
+ ## [1.0.7](https://github.com/agnostack/env/compare/v1.0.6...v1.0.7) (2025-01-21)
142
+
143
+
144
+ ### Bug Fixes
145
+
146
+ * update package.json and yarn.lock ([46ec0e5](https://github.com/agnostack/env/commit/46ec0e5158fb83af9f6df5a9c484fd3e3e081c16))
147
+ * update package.json and yarn.lock ([73d85b7](https://github.com/agnostack/env/commit/73d85b75243f395c322cd6db052b97ddcab19da5))
148
+
149
+ ## [1.0.6](https://github.com/agnostack/env/compare/v1.0.5...v1.0.6) (2025-01-20)
150
+
151
+
152
+ ### Bug Fixes
153
+
154
+ * nvmrc ([ad7cec3](https://github.com/agnostack/env/commit/ad7cec3de9271140f156f9da2afa472de94983ed))
155
+
156
+ ## [1.0.5](https://github.com/agnostack/env/compare/v1.0.4...v1.0.5) (2025-01-20)
157
+
158
+
159
+ ### Bug Fixes
160
+
161
+ * updated [@babel](https://github.com/babel) ([755f127](https://github.com/agnostack/env/commit/755f1279ecbca83e4a1a68a49b3723575b135fb2))
162
+
163
+ ## [1.0.4](https://github.com/agnostack/env/compare/v1.0.3...v1.0.4) (2025-01-20)
164
+
165
+
166
+ ### Bug Fixes
167
+
168
+ * base version updates ([3738b3b](https://github.com/agnostack/env/commit/3738b3ba57a2dfc7546da546950208a5420364b0))
169
+ * initial building commit ([a7fac7b](https://github.com/agnostack/env/commit/a7fac7bc0264032415f78aa43d5c72947b91a17f))
170
+ * version bumps ([92d126b](https://github.com/agnostack/env/commit/92d126bd4f5f503b7262966ca7a4d25ef1992988))
171
+
172
+ ## [1.0.3](https://github.com/agnostack/env/compare/v1.0.2...v1.0.3) (2025-01-14)
173
+
174
+
175
+ ### Bug Fixes
176
+
177
+ * initial working version? ([94876f7](https://github.com/agnostack/env/commit/94876f7b00ad7199c16d844dfcae80485c2072a8))
178
+
179
+ ## [1.0.2](https://github.com/agnostack/env/compare/v1.0.1...v1.0.2) (2025-01-14)
180
+
181
+
182
+ ### Bug Fixes
183
+
184
+ * initial working version? ([3a52ee1](https://github.com/agnostack/env/commit/3a52ee1f31326c3d51b6af74a4198a3554119781))
185
+ * initial working version? ([f8624b0](https://github.com/agnostack/env/commit/f8624b07b89b17c1f737d5f1e3b7bdf73b0ed3ff))
186
+
187
+ ## [1.0.1](https://github.com/agnostack/env/compare/v1.0.0...v1.0.1) (2025-01-14)
188
+
189
+
190
+ ### Bug Fixes
191
+
192
+ * initial working version? ([6643eb4](https://github.com/agnostack/env/commit/6643eb4b58755dab192b5f0b59e6be3efbb3c7ad))
193
+
194
+ # 1.0.0 (2025-01-14)
195
+
196
+
197
+ ### Bug Fixes
198
+
199
+ * initial building commit ([f48fe37](https://github.com/agnostack/env/commit/f48fe37c94ea9e969894c02fbeb30fb9d1c51328))
200
+ * initial building commit ([07cdc92](https://github.com/agnostack/env/commit/07cdc9268cc71dbcfcfdf2964def003ee28cbd2b))
201
+ * initial building commit ([6cc3ffe](https://github.com/agnostack/env/commit/6cc3ffe54bff694486478d4292c651c74042fc40))
202
+ * initial building commit ([213a26b](https://github.com/agnostack/env/commit/213a26b8a04c23cdd3f424b0a45f28b9242ede0f))
203
+ * initial building commit ([7207e1e](https://github.com/agnostack/env/commit/7207e1ea0308fc35f9740d8911185e8f18e8cd54))
204
+ * initial building commit ([d14dbb3](https://github.com/agnostack/env/commit/d14dbb3be33541563cb34ef1e3e760d75c7fac49))
205
+ * initial building commit ([e16f32c](https://github.com/agnostack/env/commit/e16f32cf408698625ca1642f26bd690003bdbcf0))
206
+ * initial building commit ([d6d1c80](https://github.com/agnostack/env/commit/d6d1c80ca063c2d9130a3716f50e45a73c41dc26))
207
+ * initial building commit ([9528029](https://github.com/agnostack/env/commit/95280296fbe3592c3daa9d3ffd9eacfcc5b4f994))
208
+ * initial commit ([aaeaa71](https://github.com/agnostack/env/commit/aaeaa7199470fff5030f82fd16af7122fd1ab93e))
209
+ * initial commit ([f279ed7](https://github.com/agnostack/env/commit/f279ed7f0aa3c3dca771e38066b78f9198136f58))
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at info@agnostack.com.
63
+
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
126
+ at [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
package/SECURITY.md ADDED
@@ -0,0 +1,18 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ We release patches for security vulnerabilities. Which versions are eligible
6
+ receiving such patches depend on the CVSS v3.0 Rating:
7
+
8
+ | CVSS v3.0 | Supported Versions |
9
+ | --------- | ----------------------------------------- |
10
+ | X.y.y | Current Major Release |
11
+ | X.y.z | Recent Minor Releases |
12
+
13
+ ## Reporting a Vulnerability
14
+
15
+ Please report (suspected) security vulnerabilities to
16
+ **[info@agnostack.com](mailto:info@agnostack.com)**. If the issue is confirmed,
17
+ we will release a patch as soon as possible depending on complexity but
18
+ historically within a few days.
package/dist/display.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export function ensureStringOnly(string: any): string;
2
- export function stringNotEmptyOnly(stringable: any): boolean;
3
- export function stringEmptyOnly(stringable: any): boolean;
1
+ export function ensureStringOnly(string: unknown): string;
2
+ export function stringNotEmptyOnly(stringable: unknown): boolean;
3
+ export function stringEmptyOnly(stringable: unknown): boolean;
package/dist/display.js CHANGED
@@ -2,15 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stringEmptyOnly = exports.stringNotEmptyOnly = exports.ensureStringOnly = void 0;
4
4
  // HMMM: what if 'string' is an object?
5
+ /** @param {unknown} string @returns {string} */
5
6
  const ensureStringOnly = (string) => (
6
7
  // eslint-disable-next-line eqeqeq
7
8
  (string != undefined) ? `${string}` : '');
8
9
  exports.ensureStringOnly = ensureStringOnly;
10
+ /** @param {unknown} stringable @returns {boolean} */
9
11
  const stringNotEmptyOnly = (stringable) => {
10
12
  const string = (0, exports.ensureStringOnly)(stringable);
11
13
  return ((string.length > 0) && !['null', 'undefined'].includes(string));
12
14
  };
13
15
  exports.stringNotEmptyOnly = stringNotEmptyOnly;
16
+ /** @param {unknown} stringable @returns {boolean} */
14
17
  const stringEmptyOnly = (stringable) => (!(0, exports.stringNotEmptyOnly)(stringable));
15
18
  exports.stringEmptyOnly = stringEmptyOnly;
16
- //# sourceMappingURL=display.js.map
package/dist/env.d.ts CHANGED
@@ -5,29 +5,30 @@ export namespace ENV_PREFIX {
5
5
  let DEFAULT: string;
6
6
  }
7
7
  export const ENV_PREFIXES: string[];
8
- export function nextKeyValidator(envKey: any): boolean;
9
- export function lowerKeyValidator(envKey: any): boolean;
10
- export function publicKeyValidator(envKey: any): boolean;
11
- export function cleanLowerEnv(_env: any, keyValidator?: (envKey: any) => boolean): {};
12
- export function cleanPublicEnv(_env: any, keyValidator?: (envKey: any) => boolean): {};
8
+ export function nextKeyValidator(envKey: string): boolean;
9
+ export function lowerKeyValidator(envKey: string): boolean;
10
+ export function publicKeyValidator(envKey: string): boolean;
11
+ export function cleanLowerEnv(_env: Record<string, string | undefined> | undefined, keyValidator?: ((envKey: string) => boolean) | undefined): Record<string, string | undefined>;
12
+ export function cleanPublicEnv(_env: Record<string, string | undefined> | undefined, keyValidator?: ((envKey: string) => boolean) | undefined): Record<string, string | undefined>;
13
13
  export function parseEnvData(_env?: NodeJS.ProcessEnv): {
14
- env: {
14
+ env: Record<string, string> & {
15
15
  ENVIRONMENT: string;
16
- TZ?: string;
17
16
  };
18
- nextEnv: {};
19
- publicEnv: {};
20
- stringifiedEnv: {};
21
- argParams: {};
17
+ nextEnv: Record<string, string | undefined>;
18
+ publicEnv: Record<string, string | undefined>;
19
+ stringifiedEnv: Record<string, string>;
20
+ argParams: {
21
+ [x: string]: string | undefined;
22
+ };
22
23
  params: {
24
+ [x: string]: string | undefined;
23
25
  ENVIRONMENT: string;
24
- TZ?: string;
25
26
  };
26
- args: any[];
27
+ args: string[];
27
28
  };
28
- export function getPublicEnvValue(publicEnv: any, key: any): any;
29
- export function replaceEnvTemplate(replaceable: any, { env: _env, template, callback, }?: {
30
- env?: NodeJS.ProcessEnv;
31
- template?: RegExp;
32
- callback?: (replacedValue: any) => any;
33
- }): string;
29
+ export function getPublicEnvValue(publicEnv: Record<string, string | undefined> | undefined, key: string): string | undefined;
30
+ export function replaceEnvTemplate(replaceable: unknown, { env: _env, template, callback, }?: {
31
+ env?: Record<string, string | undefined> | undefined;
32
+ template?: RegExp | undefined;
33
+ callback?: ((replacedValue: string, replaceable: string) => string) | undefined;
34
+ } | undefined): string;
package/dist/env.js CHANGED
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.replaceEnvTemplate = exports.getPublicEnvValue = exports.parseEnvData = exports.cleanPublicEnv = exports.cleanLowerEnv = exports.publicKeyValidator = exports.lowerKeyValidator = exports.nextKeyValidator = exports.ENV_PREFIXES = exports.ENV_PREFIX = void 0;
15
- const display_1 = require("./display");
15
+ const display_js_1 = require("./display.js");
16
16
  exports.ENV_PREFIX = {
17
17
  NEXT: 'NEXT_PUBLIC_',
18
18
  VITE: 'VITE_PUBLIC_',
@@ -20,48 +20,84 @@ exports.ENV_PREFIX = {
20
20
  DEFAULT: 'PUBLIC_',
21
21
  };
22
22
  exports.ENV_PREFIXES = Object.values(exports.ENV_PREFIX);
23
+ /** @param {string} envKey @returns {boolean} */
23
24
  const nextKeyValidator = (envKey) => (
24
25
  // NOTE: not allowed by NEXT: https://nextjs.org/docs/messages/env-key-not-allowed
25
26
  !(envKey.startsWith('__') || envKey.startsWith('NODE_')));
26
27
  exports.nextKeyValidator = nextKeyValidator;
28
+ /** @param {string} envKey @returns {boolean} */
27
29
  const lowerKeyValidator = (envKey) => ((0, exports.nextKeyValidator)(envKey) &&
28
30
  /^[^A-Z]*$/.test(envKey));
29
31
  exports.lowerKeyValidator = lowerKeyValidator;
32
+ /** @param {string} envKey @returns {boolean} */
30
33
  const publicKeyValidator = (envKey) => (exports.ENV_PREFIXES.some((envPrefix) => envKey === null || envKey === void 0 ? void 0 : envKey.startsWith(envPrefix)) ||
31
34
  ['NODE_ENV', 'PORT', 'ENVIRONMENT', 'DEBUG', 'SCOPES', 'SHOPIFY_API_SCOPES'].includes(envKey));
32
35
  exports.publicKeyValidator = publicKeyValidator;
33
36
  // TODO: move to processBatch???
37
+ /** @param {Record<string, string | undefined> | undefined} _env @returns {Record<string, string>} */
34
38
  const stringifyEnv = (_env) => (Object.entries(_env !== null && _env !== void 0 ? _env : {}).reduce((__env, [key, val]) => (Object.assign(Object.assign({}, __env), {
35
39
  // NOTE: DefinePlugin requires stringified
36
- [key]: JSON.stringify(val) })), {}));
40
+ [key]: JSON.stringify(val) })), /** @type {Record<string, string>} */ ({})));
37
41
  // TODO: move to processBatch???
42
+ /**
43
+ * @param {Record<string, string | undefined> | undefined} _env
44
+ * @param {(envKey: string) => boolean} [keyValidator]
45
+ * @returns {Record<string, string | undefined>}
46
+ */
38
47
  const cleanEnv = (_env, keyValidator = exports.nextKeyValidator) => (Object.entries(_env !== null && _env !== void 0 ? _env : []).reduce((__env, [key, val]) => (Object.assign(Object.assign({}, __env), keyValidator(key) && {
39
48
  [key]: val,
40
- })), {}));
49
+ })), /** @type {Record<string, string | undefined>} */ ({})));
50
+ /**
51
+ * @param {Record<string, string | undefined> | undefined} _env
52
+ * @param {(envKey: string) => boolean} [keyValidator]
53
+ * @returns {Record<string, string | undefined>}
54
+ */
41
55
  const cleanLowerEnv = (_env, keyValidator = exports.lowerKeyValidator) => (cleanEnv(process.env, keyValidator));
42
56
  exports.cleanLowerEnv = cleanLowerEnv;
57
+ /**
58
+ * @param {Record<string, string | undefined> | undefined} _env
59
+ * @param {(envKey: string) => boolean} [keyValidator]
60
+ * @returns {Record<string, string | undefined>}
61
+ */
43
62
  const cleanPublicEnv = (_env, keyValidator = exports.publicKeyValidator) => (cleanEnv(_env, keyValidator));
44
63
  exports.cleanPublicEnv = cleanPublicEnv;
45
64
  const parseEnvData = (_env = process.env) => {
65
+ var _a;
46
66
  const { ENVIRONMENT, SITE_ENV, BUILD_ENV, NODE_ENV } = _env;
47
- const _environment = [SITE_ENV, BUILD_ENV, NODE_ENV, 'development'].find((value) => (0, display_1.stringNotEmptyOnly)(value));
67
+ // NOTE: the trailing ?? mirrors the 'development' already last in the list — find() is always
68
+ // satisfied by it, but the fallback is what lets this type as string rather than string|undefined.
69
+ const _environment = (_a = [SITE_ENV, BUILD_ENV, NODE_ENV, 'development'].find((value) => (0, display_js_1.stringNotEmptyOnly)(value))) !== null && _a !== void 0 ? _a : 'development';
70
+ // NOTE: annotated so the index signature survives the spread — without it consumers get
71
+ // a type with only ENVIRONMENT on it and every other `env.SOME_VAR` lookup is an error.
72
+ /** @type {Record<string, string> & { ENVIRONMENT: string }} */
48
73
  const mergedEnv = Object.assign(Object.assign({}, _env), {
49
74
  // NOTE: intentionally giving precedence to ENVIRONMENT
50
75
  ENVIRONMENT: ENVIRONMENT || _environment });
51
- const _a = process.argv.reduce(({ args: _args, argParams: _argParams, }, arg) => {
52
- var _a, _b;
53
- const [__param, _value, __value] = (_a = arg === null || arg === void 0 ? void 0 : arg.split('=')) !== null && _a !== void 0 ? _a : [];
54
- const _param = (_b = __param === null || __param === void 0 ? void 0 : __param.replace) === null || _b === void 0 ? void 0 : _b.call(__param, '--', '');
55
- if ((0, display_1.stringEmptyOnly)(_param)) {
76
+ const _b = process.argv.reduce(({ args: _args, argParams: _argParams, }, arg) => {
77
+ var _a, _b, _c, _d, _e;
78
+ // NOTE: split on the FIRST '=' only everything after it is the value, verbatim.
79
+ // Splitting on every '=' truncated any value that contained one, so `--context=env=prod`
80
+ // silently became `{ context: 'env' }` and the rest was dropped.
81
+ const separatorIndex = (_b = (_a = arg === null || arg === void 0 ? void 0 : arg.indexOf) === null || _a === void 0 ? void 0 : _a.call(arg, '=')) !== null && _b !== void 0 ? _b : -1;
82
+ const [__param, _value] = (separatorIndex === -1)
83
+ ? [arg, undefined]
84
+ : [arg.slice(0, separatorIndex), arg.slice(separatorIndex + 1)];
85
+ const _param = (_c = __param === null || __param === void 0 ? void 0 : __param.replace) === null || _c === void 0 ? void 0 : _c.call(__param, '--', '');
86
+ if ((0, display_js_1.stringEmptyOnly)(_param)) {
56
87
  return {
57
88
  args: _args,
58
89
  argParams: _argParams,
59
90
  };
60
91
  }
92
+ /** @type {[string, string | undefined]} */
61
93
  let entry = [_param, _value];
62
- // NOTE: this handles serverless args similar to "--param=env=development"
63
- if ((_param === 'param') && (0, display_1.stringNotEmptyOnly)(_value) && (0, display_1.stringNotEmptyOnly)(__value)) {
64
- entry = [_value, __value];
94
+ // NOTE: this handles serverless args similar to "--param=env=development" — the value is
95
+ // itself a key=value pair, so it splits on its own first '=' for the same reason.
96
+ if (_param === 'param') {
97
+ const valueSeparatorIndex = (_e = (_d = _value === null || _value === void 0 ? void 0 : _value.indexOf) === null || _d === void 0 ? void 0 : _d.call(_value, '=')) !== null && _e !== void 0 ? _e : -1;
98
+ if (_value && (valueSeparatorIndex > 0)) {
99
+ entry = [_value.slice(0, valueSeparatorIndex), _value.slice(valueSeparatorIndex + 1)];
100
+ }
65
101
  }
66
102
  const [param, value] = entry;
67
103
  return {
@@ -69,26 +105,32 @@ const parseEnvData = (_env = process.env) => {
69
105
  ..._args,
70
106
  ...(value == undefined) ? [__param] : []
71
107
  ],
72
- argParams: Object.assign(Object.assign({}, _argParams), (0, display_1.stringNotEmptyOnly)(value) && {
108
+ argParams: Object.assign(Object.assign({}, _argParams), (0, display_js_1.stringNotEmptyOnly)(value) && {
73
109
  [param]: value,
74
110
  }),
75
111
  };
76
112
  }, {
77
- args: [],
78
- argParams: {},
79
- }), { argParams } = _a, output = __rest(_a, ["argParams"]);
113
+ args: /** @type {string[]} */ ([]),
114
+ argParams: /** @type {Record<string, string>} */ ({}),
115
+ }), { argParams } = _b, output = __rest(_b, ["argParams"]);
80
116
  const nextEnv = cleanEnv(mergedEnv);
81
117
  const publicEnv = (0, exports.cleanPublicEnv)(mergedEnv);
82
118
  return Object.assign(Object.assign({}, output), { env: mergedEnv, nextEnv,
83
119
  publicEnv, stringifiedEnv: stringifyEnv(publicEnv), argParams, params: Object.assign(Object.assign({}, mergedEnv), argParams) });
84
120
  };
85
121
  exports.parseEnvData = parseEnvData;
122
+ /**
123
+ * @param {Record<string, string | undefined> | undefined} publicEnv
124
+ * @param {string} key
125
+ * @returns {string | undefined}
126
+ */
86
127
  const getPublicEnvValue = (publicEnv, key) => {
128
+ /** @type {string | undefined} */
87
129
  let envValue;
88
- if ((0, display_1.stringEmptyOnly)(key) || !publicEnv) {
130
+ if ((0, display_js_1.stringEmptyOnly)(key) || !publicEnv) {
89
131
  return envValue;
90
132
  }
91
- if ((0, display_1.stringNotEmptyOnly)(publicEnv === null || publicEnv === void 0 ? void 0 : publicEnv[key])) {
133
+ if ((0, display_js_1.stringNotEmptyOnly)(publicEnv === null || publicEnv === void 0 ? void 0 : publicEnv[key])) {
92
134
  return publicEnv[key];
93
135
  }
94
136
  let baseKey = key;
@@ -97,7 +139,7 @@ const getPublicEnvValue = (publicEnv, key) => {
97
139
  for (const envPrefix of exports.ENV_PREFIXES) {
98
140
  if (key.startsWith(envPrefix)) {
99
141
  const trimmedKey = key.slice(envPrefix.length);
100
- if ((0, display_1.stringNotEmptyOnly)(trimmedKey)) {
142
+ if ((0, display_js_1.stringNotEmptyOnly)(trimmedKey)) {
101
143
  baseKey = trimmedKey;
102
144
  break;
103
145
  }
@@ -108,19 +150,30 @@ const getPublicEnvValue = (publicEnv, key) => {
108
150
  // eslint-disable-next-line no-restricted-syntax
109
151
  for (const matchableEnvKey of matchableEnvKeys) {
110
152
  envValue = publicEnv[matchableEnvKey];
111
- if ((0, display_1.stringNotEmptyOnly)(envValue)) {
153
+ if ((0, display_js_1.stringNotEmptyOnly)(envValue)) {
112
154
  break;
113
155
  }
114
156
  }
115
157
  return envValue;
116
158
  };
117
159
  exports.getPublicEnvValue = getPublicEnvValue;
118
- const replaceEnvTemplate = (replaceable, { env: _env = process.env, template = /\{\{process\.env\.(\w+)\}\}/g, callback = (replacedValue) => replacedValue, } = {}) => ((0, display_1.ensureStringOnly)(replaceable).replace(template, (replaceable, variable) => {
160
+ /**
161
+ * @param {unknown} replaceable
162
+ * @param {{
163
+ * env?: Record<string, string | undefined>,
164
+ * template?: RegExp,
165
+ * callback?: (replacedValue: string, replaceable: string) => string,
166
+ * }} [options]
167
+ * @returns {string}
168
+ */
169
+ const replaceEnvTemplate = (replaceable, { env: _env = process.env, template = /\{\{process\.env\.(\w+)\}\}/g,
170
+ // NOTE: the second arg is the matched token — declared so the default's signature matches
171
+ // how it is actually invoked below, even though the default ignores it.
172
+ callback = (replacedValue, _replaceable) => replacedValue, } = {}) => ((0, display_js_1.ensureStringOnly)(replaceable).replace(template, (replaceable, variable) => {
119
173
  const replacedValue = (0, exports.getPublicEnvValue)(_env, variable.trim());
120
- if ((0, display_1.stringEmptyOnly)(replacedValue)) {
174
+ if ((0, display_js_1.stringEmptyOnly)(replacedValue)) {
121
175
  return replaceable;
122
176
  }
123
- return callback(replacedValue, replaceable);
177
+ return callback(/** @type {string} */ (replacedValue), replaceable);
124
178
  }));
125
179
  exports.replaceEnvTemplate = replaceEnvTemplate;
126
- //# sourceMappingURL=env.js.map
@@ -0,0 +1,12 @@
1
+ // HMMM: what if 'string' is an object?
2
+ /** @param {unknown} string @returns {string} */
3
+ export const ensureStringOnly = (string) => (
4
+ // eslint-disable-next-line eqeqeq
5
+ (string != undefined) ? `${string}` : '');
6
+ /** @param {unknown} stringable @returns {boolean} */
7
+ export const stringNotEmptyOnly = (stringable) => {
8
+ const string = ensureStringOnly(stringable);
9
+ return ((string.length > 0) && !['null', 'undefined'].includes(string));
10
+ };
11
+ /** @param {unknown} stringable @returns {boolean} */
12
+ export const stringEmptyOnly = (stringable) => (!stringNotEmptyOnly(stringable));
@@ -0,0 +1,168 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { ensureStringOnly, stringEmptyOnly, stringNotEmptyOnly } from './display.js';
13
+ export const ENV_PREFIX = {
14
+ NEXT: 'NEXT_PUBLIC_',
15
+ VITE: 'VITE_PUBLIC_',
16
+ GATSBY: 'GATSBY_',
17
+ DEFAULT: 'PUBLIC_',
18
+ };
19
+ export const ENV_PREFIXES = Object.values(ENV_PREFIX);
20
+ /** @param {string} envKey @returns {boolean} */
21
+ export const nextKeyValidator = (envKey) => (
22
+ // NOTE: not allowed by NEXT: https://nextjs.org/docs/messages/env-key-not-allowed
23
+ !(envKey.startsWith('__') || envKey.startsWith('NODE_')));
24
+ /** @param {string} envKey @returns {boolean} */
25
+ export const lowerKeyValidator = (envKey) => (nextKeyValidator(envKey) &&
26
+ /^[^A-Z]*$/.test(envKey));
27
+ /** @param {string} envKey @returns {boolean} */
28
+ export const publicKeyValidator = (envKey) => (ENV_PREFIXES.some((envPrefix) => envKey === null || envKey === void 0 ? void 0 : envKey.startsWith(envPrefix)) ||
29
+ ['NODE_ENV', 'PORT', 'ENVIRONMENT', 'DEBUG', 'SCOPES', 'SHOPIFY_API_SCOPES'].includes(envKey));
30
+ // TODO: move to processBatch???
31
+ /** @param {Record<string, string | undefined> | undefined} _env @returns {Record<string, string>} */
32
+ const stringifyEnv = (_env) => (Object.entries(_env !== null && _env !== void 0 ? _env : {}).reduce((__env, [key, val]) => (Object.assign(Object.assign({}, __env), {
33
+ // NOTE: DefinePlugin requires stringified
34
+ [key]: JSON.stringify(val) })), /** @type {Record<string, string>} */ ({})));
35
+ // TODO: move to processBatch???
36
+ /**
37
+ * @param {Record<string, string | undefined> | undefined} _env
38
+ * @param {(envKey: string) => boolean} [keyValidator]
39
+ * @returns {Record<string, string | undefined>}
40
+ */
41
+ const cleanEnv = (_env, keyValidator = nextKeyValidator) => (Object.entries(_env !== null && _env !== void 0 ? _env : []).reduce((__env, [key, val]) => (Object.assign(Object.assign({}, __env), keyValidator(key) && {
42
+ [key]: val,
43
+ })), /** @type {Record<string, string | undefined>} */ ({})));
44
+ /**
45
+ * @param {Record<string, string | undefined> | undefined} _env
46
+ * @param {(envKey: string) => boolean} [keyValidator]
47
+ * @returns {Record<string, string | undefined>}
48
+ */
49
+ export const cleanLowerEnv = (_env, keyValidator = lowerKeyValidator) => (cleanEnv(process.env, keyValidator));
50
+ /**
51
+ * @param {Record<string, string | undefined> | undefined} _env
52
+ * @param {(envKey: string) => boolean} [keyValidator]
53
+ * @returns {Record<string, string | undefined>}
54
+ */
55
+ export const cleanPublicEnv = (_env, keyValidator = publicKeyValidator) => (cleanEnv(_env, keyValidator));
56
+ export const parseEnvData = (_env = process.env) => {
57
+ var _a;
58
+ const { ENVIRONMENT, SITE_ENV, BUILD_ENV, NODE_ENV } = _env;
59
+ // NOTE: the trailing ?? mirrors the 'development' already last in the list — find() is always
60
+ // satisfied by it, but the fallback is what lets this type as string rather than string|undefined.
61
+ const _environment = (_a = [SITE_ENV, BUILD_ENV, NODE_ENV, 'development'].find((value) => stringNotEmptyOnly(value))) !== null && _a !== void 0 ? _a : 'development';
62
+ // NOTE: annotated so the index signature survives the spread — without it consumers get
63
+ // a type with only ENVIRONMENT on it and every other `env.SOME_VAR` lookup is an error.
64
+ /** @type {Record<string, string> & { ENVIRONMENT: string }} */
65
+ const mergedEnv = Object.assign(Object.assign({}, _env), {
66
+ // NOTE: intentionally giving precedence to ENVIRONMENT
67
+ ENVIRONMENT: ENVIRONMENT || _environment });
68
+ const _b = process.argv.reduce(({ args: _args, argParams: _argParams, }, arg) => {
69
+ var _a, _b, _c, _d, _e;
70
+ // NOTE: split on the FIRST '=' only — everything after it is the value, verbatim.
71
+ // Splitting on every '=' truncated any value that contained one, so `--context=env=prod`
72
+ // silently became `{ context: 'env' }` and the rest was dropped.
73
+ const separatorIndex = (_b = (_a = arg === null || arg === void 0 ? void 0 : arg.indexOf) === null || _a === void 0 ? void 0 : _a.call(arg, '=')) !== null && _b !== void 0 ? _b : -1;
74
+ const [__param, _value] = (separatorIndex === -1)
75
+ ? [arg, undefined]
76
+ : [arg.slice(0, separatorIndex), arg.slice(separatorIndex + 1)];
77
+ const _param = (_c = __param === null || __param === void 0 ? void 0 : __param.replace) === null || _c === void 0 ? void 0 : _c.call(__param, '--', '');
78
+ if (stringEmptyOnly(_param)) {
79
+ return {
80
+ args: _args,
81
+ argParams: _argParams,
82
+ };
83
+ }
84
+ /** @type {[string, string | undefined]} */
85
+ let entry = [_param, _value];
86
+ // NOTE: this handles serverless args similar to "--param=env=development" — the value is
87
+ // itself a key=value pair, so it splits on its own first '=' for the same reason.
88
+ if (_param === 'param') {
89
+ const valueSeparatorIndex = (_e = (_d = _value === null || _value === void 0 ? void 0 : _value.indexOf) === null || _d === void 0 ? void 0 : _d.call(_value, '=')) !== null && _e !== void 0 ? _e : -1;
90
+ if (_value && (valueSeparatorIndex > 0)) {
91
+ entry = [_value.slice(0, valueSeparatorIndex), _value.slice(valueSeparatorIndex + 1)];
92
+ }
93
+ }
94
+ const [param, value] = entry;
95
+ return {
96
+ args: [
97
+ ..._args,
98
+ ...(value == undefined) ? [__param] : []
99
+ ],
100
+ argParams: Object.assign(Object.assign({}, _argParams), stringNotEmptyOnly(value) && {
101
+ [param]: value,
102
+ }),
103
+ };
104
+ }, {
105
+ args: /** @type {string[]} */ ([]),
106
+ argParams: /** @type {Record<string, string>} */ ({}),
107
+ }), { argParams } = _b, output = __rest(_b, ["argParams"]);
108
+ const nextEnv = cleanEnv(mergedEnv);
109
+ const publicEnv = cleanPublicEnv(mergedEnv);
110
+ return Object.assign(Object.assign({}, output), { env: mergedEnv, nextEnv,
111
+ publicEnv, stringifiedEnv: stringifyEnv(publicEnv), argParams, params: Object.assign(Object.assign({}, mergedEnv), argParams) });
112
+ };
113
+ /**
114
+ * @param {Record<string, string | undefined> | undefined} publicEnv
115
+ * @param {string} key
116
+ * @returns {string | undefined}
117
+ */
118
+ export const getPublicEnvValue = (publicEnv, key) => {
119
+ /** @type {string | undefined} */
120
+ let envValue;
121
+ if (stringEmptyOnly(key) || !publicEnv) {
122
+ return envValue;
123
+ }
124
+ if (stringNotEmptyOnly(publicEnv === null || publicEnv === void 0 ? void 0 : publicEnv[key])) {
125
+ return publicEnv[key];
126
+ }
127
+ let baseKey = key;
128
+ // NOTE: intentionally using for/of loop instead of map so we can break to exit quickly soon as matched
129
+ // eslint-disable-next-line no-restricted-syntax
130
+ for (const envPrefix of ENV_PREFIXES) {
131
+ if (key.startsWith(envPrefix)) {
132
+ const trimmedKey = key.slice(envPrefix.length);
133
+ if (stringNotEmptyOnly(trimmedKey)) {
134
+ baseKey = trimmedKey;
135
+ break;
136
+ }
137
+ }
138
+ }
139
+ const matchableEnvKeys = ENV_PREFIXES.map((envPrefix) => `${envPrefix}${baseKey}`);
140
+ // NOTE: intentionally using for/of loop instead of map so we can break to exit quickly soon as matched
141
+ // eslint-disable-next-line no-restricted-syntax
142
+ for (const matchableEnvKey of matchableEnvKeys) {
143
+ envValue = publicEnv[matchableEnvKey];
144
+ if (stringNotEmptyOnly(envValue)) {
145
+ break;
146
+ }
147
+ }
148
+ return envValue;
149
+ };
150
+ /**
151
+ * @param {unknown} replaceable
152
+ * @param {{
153
+ * env?: Record<string, string | undefined>,
154
+ * template?: RegExp,
155
+ * callback?: (replacedValue: string, replaceable: string) => string,
156
+ * }} [options]
157
+ * @returns {string}
158
+ */
159
+ export const replaceEnvTemplate = (replaceable, { env: _env = process.env, template = /\{\{process\.env\.(\w+)\}\}/g,
160
+ // NOTE: the second arg is the matched token — declared so the default's signature matches
161
+ // how it is actually invoked below, even though the default ignores it.
162
+ callback = (replacedValue, _replaceable) => replacedValue, } = {}) => (ensureStringOnly(replaceable).replace(template, (replaceable, variable) => {
163
+ const replacedValue = getPublicEnvValue(_env, variable.trim());
164
+ if (stringEmptyOnly(replacedValue)) {
165
+ return replaceable;
166
+ }
167
+ return callback(/** @type {string} */ (replacedValue), replaceable);
168
+ }));
@@ -0,0 +1,4 @@
1
+ // NOTE: explicit .js extensions are required — node's native ESM resolver does not probe for
2
+ // them, and tsc emits relative specifiers verbatim into the dist/esm build.
3
+ export * from './env.js';
4
+ export * from './project.js';
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,69 @@
1
+ import { ensureStringOnly } from './display.js';
2
+ /** @param {unknown} _name */
3
+ export const parseProjectName = (_name) => {
4
+ var _a;
5
+ const name = ensureStringOnly(_name);
6
+ const [, organization, ...parts] = (_a = /(@.*)([\\]+|\/)+(.*)/.exec(name)) !== null && _a !== void 0 ? _a : [];
7
+ const projectName = organization ? name.replace(organization, '').replace('/', '') : name;
8
+ return {
9
+ name,
10
+ parts,
11
+ organization,
12
+ projectName,
13
+ };
14
+ };
15
+ /**
16
+ * The subset of a package.json this reads. Everything is optional — callers pass raw
17
+ * manifests, and the parser is deliberately tolerant of a missing or partial object.
18
+ *
19
+ * @typedef {object} PackageInfo
20
+ * @property {string} [name]
21
+ * @property {string} [version]
22
+ * @property {string[]} [keywords]
23
+ * @property {string} [owner]
24
+ * @property {string} [appName]
25
+ * @property {string} [siteName]
26
+ * @property {string} [shortName]
27
+ * @property {string} [siteHandle]
28
+ * @property {string} [siteAuthor]
29
+ * @property {Record<string, string>} [dependencies]
30
+ * @property {Record<string, string>} [devDependencies]
31
+ * @property {Record<string, string>} [peerDependencies]
32
+ * @property {Record<string, string>} [optionalDependencies]
33
+ * @property {string[]} [bundleDependencies]
34
+ * @property {string[]} [bundledDependencies]
35
+ * @property {string[]} [browserDependencies]
36
+ */
37
+ /** @param {PackageInfo} [packageInfo] */
38
+ export const parsePackageInfo = (packageInfo) => {
39
+ const { version, keywords, shortName, siteHandle, siteAuthor, devDependencies, peerDependencies, bundleDependencies, bundledDependencies = bundleDependencies, dependencies: runtimeDependencies, optionalDependencies, browserDependencies, name: _name, owner: _appOwner, appName: _appName, siteName: _siteName, } = packageInfo !== null && packageInfo !== void 0 ? packageInfo : {};
40
+ const { name, organization, projectName } = parseProjectName(_name);
41
+ const appName = _appName !== null && _appName !== void 0 ? _appName : projectName === null || projectName === void 0 ? void 0 : projectName.slice((projectName === null || projectName === void 0 ? void 0 : projectName.indexOf('-')) + 1);
42
+ const siteName = _siteName !== null && _siteName !== void 0 ? _siteName : projectName === null || projectName === void 0 ? void 0 : projectName.slice((projectName === null || projectName === void 0 ? void 0 : projectName.indexOf('-')) + 1);
43
+ const companyName = organization === null || organization === void 0 ? void 0 : organization.replace('@', '');
44
+ const appOwner = _appOwner !== null && _appOwner !== void 0 ? _appOwner : companyName;
45
+ const packageDetails = {
46
+ keywords,
47
+ appOwner,
48
+ appName,
49
+ version,
50
+ siteName,
51
+ shortName,
52
+ siteHandle,
53
+ siteAuthor,
54
+ companyName,
55
+ projectName,
56
+ devDependencies,
57
+ peerDependencies,
58
+ bundledDependencies,
59
+ runtimeDependencies,
60
+ browserDependencies,
61
+ optionalDependencies,
62
+ };
63
+ // NOTE: declared as a tuple — an array literal infers as
64
+ // (string | typeof packageDetails)[], so destructuring the first element
65
+ // would hand callers a union instead of the object.
66
+ /** @type {[typeof packageDetails, string | undefined, string]} */
67
+ const packageParts = [packageDetails, organization, name];
68
+ return packageParts;
69
+ };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './env';
2
- export * from './project';
1
+ export * from './env.js';
2
+ export * from './project.js';
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./env"), exports);
18
- __exportStar(require("./project"), exports);
19
- //# sourceMappingURL=index.js.map
17
+ // NOTE: explicit .js extensions are required — node's native ESM resolver does not probe for
18
+ // them, and tsc emits relative specifiers verbatim into the dist/esm build.
19
+ __exportStar(require("./env.js"), exports);
20
+ __exportStar(require("./project.js"), exports);
package/dist/project.d.ts CHANGED
@@ -1,24 +1,46 @@
1
- export function parseProjectName(_name: any): {
1
+ export function parseProjectName(_name: unknown): {
2
2
  name: string;
3
3
  parts: string[];
4
4
  organization: string;
5
5
  projectName: string;
6
6
  };
7
- export function parsePackageInfo(packageInfo: any): (string | {
8
- keywords: any;
9
- appOwner: any;
10
- appName: any;
11
- version: any;
12
- siteName: any;
13
- shortName: any;
14
- siteHandle: any;
15
- siteAuthor: any;
7
+ export function parsePackageInfo(packageInfo?: PackageInfo | undefined): [{
8
+ keywords: string[] | undefined;
9
+ appOwner: string;
10
+ appName: string;
11
+ version: string | undefined;
12
+ siteName: string;
13
+ shortName: string | undefined;
14
+ siteHandle: string | undefined;
15
+ siteAuthor: string | undefined;
16
16
  companyName: string;
17
17
  projectName: string;
18
- devDependencies: any;
19
- peerDependencies: any;
20
- bundledDependencies: any;
21
- runtimeDependencies: any;
22
- browserDependencies: any;
23
- optionalDependencies: any;
24
- })[];
18
+ devDependencies: Record<string, string> | undefined;
19
+ peerDependencies: Record<string, string> | undefined;
20
+ bundledDependencies: string[] | undefined;
21
+ runtimeDependencies: Record<string, string> | undefined;
22
+ browserDependencies: string[] | undefined;
23
+ optionalDependencies: Record<string, string> | undefined;
24
+ }, string | undefined, string];
25
+ /**
26
+ * The subset of a package.json this reads. Everything is optional — callers pass raw
27
+ * manifests, and the parser is deliberately tolerant of a missing or partial object.
28
+ */
29
+ export type PackageInfo = {
30
+ name?: string | undefined;
31
+ version?: string | undefined;
32
+ keywords?: string[] | undefined;
33
+ owner?: string | undefined;
34
+ appName?: string | undefined;
35
+ siteName?: string | undefined;
36
+ shortName?: string | undefined;
37
+ siteHandle?: string | undefined;
38
+ siteAuthor?: string | undefined;
39
+ dependencies?: Record<string, string> | undefined;
40
+ devDependencies?: Record<string, string> | undefined;
41
+ peerDependencies?: Record<string, string> | undefined;
42
+ optionalDependencies?: Record<string, string> | undefined;
43
+ bundleDependencies?: string[] | undefined;
44
+ bundledDependencies?: string[] | undefined;
45
+ browserDependencies?: string[] | undefined;
46
+ };
package/dist/project.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parsePackageInfo = exports.parseProjectName = void 0;
4
- const display_1 = require("./display");
4
+ const display_js_1 = require("./display.js");
5
+ /** @param {unknown} _name */
5
6
  const parseProjectName = (_name) => {
6
7
  var _a;
7
- const name = (0, display_1.ensureStringOnly)(_name);
8
+ const name = (0, display_js_1.ensureStringOnly)(_name);
8
9
  const [, organization, ...parts] = (_a = /(@.*)([\\]+|\/)+(.*)/.exec(name)) !== null && _a !== void 0 ? _a : [];
9
10
  const projectName = organization ? name.replace(organization, '').replace('/', '') : name;
10
11
  return {
@@ -15,6 +16,29 @@ const parseProjectName = (_name) => {
15
16
  };
16
17
  };
17
18
  exports.parseProjectName = parseProjectName;
19
+ /**
20
+ * The subset of a package.json this reads. Everything is optional — callers pass raw
21
+ * manifests, and the parser is deliberately tolerant of a missing or partial object.
22
+ *
23
+ * @typedef {object} PackageInfo
24
+ * @property {string} [name]
25
+ * @property {string} [version]
26
+ * @property {string[]} [keywords]
27
+ * @property {string} [owner]
28
+ * @property {string} [appName]
29
+ * @property {string} [siteName]
30
+ * @property {string} [shortName]
31
+ * @property {string} [siteHandle]
32
+ * @property {string} [siteAuthor]
33
+ * @property {Record<string, string>} [dependencies]
34
+ * @property {Record<string, string>} [devDependencies]
35
+ * @property {Record<string, string>} [peerDependencies]
36
+ * @property {Record<string, string>} [optionalDependencies]
37
+ * @property {string[]} [bundleDependencies]
38
+ * @property {string[]} [bundledDependencies]
39
+ * @property {string[]} [browserDependencies]
40
+ */
41
+ /** @param {PackageInfo} [packageInfo] */
18
42
  const parsePackageInfo = (packageInfo) => {
19
43
  const { version, keywords, shortName, siteHandle, siteAuthor, devDependencies, peerDependencies, bundleDependencies, bundledDependencies = bundleDependencies, dependencies: runtimeDependencies, optionalDependencies, browserDependencies, name: _name, owner: _appOwner, appName: _appName, siteName: _siteName, } = packageInfo !== null && packageInfo !== void 0 ? packageInfo : {};
20
44
  const { name, organization, projectName } = (0, exports.parseProjectName)(_name);
@@ -22,24 +46,29 @@ const parsePackageInfo = (packageInfo) => {
22
46
  const siteName = _siteName !== null && _siteName !== void 0 ? _siteName : projectName === null || projectName === void 0 ? void 0 : projectName.slice((projectName === null || projectName === void 0 ? void 0 : projectName.indexOf('-')) + 1);
23
47
  const companyName = organization === null || organization === void 0 ? void 0 : organization.replace('@', '');
24
48
  const appOwner = _appOwner !== null && _appOwner !== void 0 ? _appOwner : companyName;
25
- return [{
26
- keywords,
27
- appOwner,
28
- appName,
29
- version,
30
- siteName,
31
- shortName,
32
- siteHandle,
33
- siteAuthor,
34
- companyName,
35
- projectName,
36
- devDependencies,
37
- peerDependencies,
38
- bundledDependencies,
39
- runtimeDependencies,
40
- browserDependencies,
41
- optionalDependencies,
42
- }, organization, name];
49
+ const packageDetails = {
50
+ keywords,
51
+ appOwner,
52
+ appName,
53
+ version,
54
+ siteName,
55
+ shortName,
56
+ siteHandle,
57
+ siteAuthor,
58
+ companyName,
59
+ projectName,
60
+ devDependencies,
61
+ peerDependencies,
62
+ bundledDependencies,
63
+ runtimeDependencies,
64
+ browserDependencies,
65
+ optionalDependencies,
66
+ };
67
+ // NOTE: declared as a tuple — an array literal infers as
68
+ // (string | typeof packageDetails)[], so destructuring the first element
69
+ // would hand callers a union instead of the object.
70
+ /** @type {[typeof packageDetails, string | undefined, string]} */
71
+ const packageParts = [packageDetails, organization, name];
72
+ return packageParts;
43
73
  };
44
74
  exports.parsePackageInfo = parsePackageInfo;
45
- //# sourceMappingURL=project.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agnostack/env",
3
- "version": "1.3.0",
3
+ "version": "1.4.0-beta.2",
4
4
  "author": "agnoStack Dev <developers@agnostack.com> (https://agnostack.com)",
5
5
  "owner": "agnoStack",
6
6
  "description": "Please contact agnoStack via info@agnostack.com for any questions",
@@ -15,29 +15,41 @@
15
15
  ],
16
16
  "license": "MIT",
17
17
  "main": "dist/index.js",
18
- "typings": "dist/index.d.ts",
18
+ "types": "dist/index.d.ts",
19
19
  "exports": {
20
20
  ".": {
21
21
  "types": "./dist/index.d.ts",
22
22
  "require": "./dist/index.js",
23
23
  "default": "./dist/index.js"
24
24
  },
25
+ "./esm": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/esm/index.js",
28
+ "default": "./dist/esm/index.js"
29
+ },
25
30
  "./package.json": "./package.json"
26
31
  },
27
32
  "files": [
28
- "dist"
33
+ "dist",
34
+ "package.json",
35
+ "LICENSE",
36
+ "*.md"
29
37
  ],
30
38
  "engines": {
31
39
  "node": ">=18.x"
32
40
  },
33
41
  "scripts": {
34
42
  "tsc": "npx -p typescript tsc",
35
- "build": "yarn tsc -d",
36
43
  "watch": "yarn tsc -w",
44
+ "prebuild": "yarn tsc --build --clean && npx rimraf@4.4.1 dist _storage",
45
+ "build": "yarn tsc && yarn tsc -p tsconfig.esm.json && node scripts/write-esm-pkg.mjs",
37
46
  "clean": "npx rimraf@4.4.1 dist node_modules _storage",
38
47
  "clean:install": "yarn clean && yarn install --force",
39
48
  "lint": "eslint 'src/**' --fix",
40
- "test": "jest --passWithNoTests",
49
+ "typecheck": "yarn tsc -p tsconfig.test.json",
50
+ "verify:dist": "node scripts/verify-dist.mjs",
51
+ "prepublishOnly": "yarn verify:dist",
52
+ "test": "jest",
41
53
  "release": "npx semantic-release@22.0.12",
42
54
  "release:debug": "yarn release --debug",
43
55
  "prepare": "husky install"
@@ -48,8 +60,6 @@
48
60
  ]
49
61
  },
50
62
  "devDependencies": {
51
- "@babel/core": "7.27.x",
52
- "@babel/eslint-parser": "7.27.x",
53
63
  "@commitlint/cli": "18.6.1",
54
64
  "@commitlint/config-conventional": "18.6.1",
55
65
  "@semantic-release/changelog": "6.0.3",
@@ -57,16 +67,10 @@
57
67
  "@semantic-release/github": "9.2.6",
58
68
  "@semantic-release/npm": "11.0.3",
59
69
  "@semantic-release/release-notes-generator": "12.1.0",
60
- "@types/jest": "26.0.24",
70
+ "@types/jest": "29.x",
61
71
  "@types/node": "18.x",
62
- "@types/react": "17.0.2",
63
- "@types/react-dom": "17.0.2",
64
72
  "@typescript-eslint/eslint-plugin": "6.3.0",
65
73
  "@typescript-eslint/parser": "6.3.0",
66
- "chai": "4.3.10",
67
- "chai-as-promised": "7.1.1",
68
- "chalk": "4.1.2",
69
- "chance": "1.1.8",
70
74
  "eslint": "8.23.0",
71
75
  "eslint-plugin-import": "2.26.0",
72
76
  "husky": "6.0.0",
@@ -74,9 +78,7 @@
74
78
  "lint-staged": "11.0.0",
75
79
  "rimraf": "4.4.1",
76
80
  "semantic-release": "22.0.12",
77
- "sinon": "10.0.0",
78
- "sinon-chai": "3.6.0",
79
- "ts-jest": "27.1.5",
81
+ "ts-jest": "29.x",
80
82
  "typescript": "5.4.2"
81
83
  },
82
84
  "resolutions": {
@@ -85,5 +87,6 @@
85
87
  },
86
88
  "publishConfig": {
87
89
  "access": "public"
88
- }
90
+ },
91
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
89
92
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"display.js","sourceRoot":"","sources":["../src/display.js"],"names":[],"mappings":";;;AAAA,uCAAuC;AAChC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;AAC1C,kCAAkC;AAClC,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CACzC,CAAA;AAHY,QAAA,gBAAgB,oBAG5B;AAEM,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,EAAE;IAC/C,MAAM,MAAM,GAAG,IAAA,wBAAgB,EAAC,UAAU,CAAC,CAAA;IAC3C,OAAO,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;AACzE,CAAC,CAAA;AAHY,QAAA,kBAAkB,sBAG9B;AAEM,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC,CAC7C,CAAC,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAChC,CAAA;AAFY,QAAA,eAAe,mBAE3B"}
package/dist/env.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.js"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uCAAiF;AAEpE,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;CACnB,CAAA;AAEY,QAAA,YAAY,GAAG,MAAM,CAAC,MAAM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AE,CAAC;YACjC,MAAK;QACP,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAjCY,QAAA,iBAAiB,qBAiC7B;AAEM,MAAM,kBAAkB,GAAG,CAChC,WAAW,EACX,EACE,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,EACvB,QAAQ,GAAG,8BAA8B,EACzC,QAAQ,GAAG,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,GAC5C,GAAG,EAAE,EACN,EAAE,CAAC,CACH,IAAA,0BAAgB,EAAC,WAAW,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;IACxE,MAAM,aAAa,GAAG,IAAA,yBAAiB,EAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;IAE9D,IAAI,IAAA,yBAAe,EAAC,aAAa,CAAC,EAAE,CAAC;QACnC,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,OAAO,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;AAC7C,CAAC,CAAC,CACH,CAAA;AAjBY,QAAA,kBAAkB,sBAiB9B"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,4CAAyB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.js"],"names":[],"mappings":";;;AAAA,uCAA4C;AAErC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,EAAE;;IACxC,MAAM,IAAI,GAAG,IAAA,0BAAgB,EAAC,KAAK,CAAC,CAAA;IACpC,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,GAAG,MAAA,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAA;IAC1E,MAAM,WAAW,G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