@agnostack/env 1.3.0 → 1.4.0-beta.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,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.js CHANGED
@@ -13,4 +13,3 @@ const stringNotEmptyOnly = (stringable) => {
13
13
  exports.stringNotEmptyOnly = stringNotEmptyOnly;
14
14
  const stringEmptyOnly = (stringable) => (!(0, exports.stringNotEmptyOnly)(stringable));
15
15
  exports.stringEmptyOnly = stringEmptyOnly;
16
- //# sourceMappingURL=display.js.map
package/dist/env.d.ts CHANGED
@@ -8,26 +8,33 @@ export const ENV_PREFIXES: string[];
8
8
  export function nextKeyValidator(envKey: any): boolean;
9
9
  export function lowerKeyValidator(envKey: any): boolean;
10
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): {};
11
+ export function cleanLowerEnv(_env: any, keyValidator?: (envKey: any) => boolean): {
12
+ [x: string]: any;
13
+ };
14
+ export function cleanPublicEnv(_env: any, keyValidator?: (envKey: any) => boolean): {
15
+ [x: string]: any;
16
+ };
13
17
  export function parseEnvData(_env?: NodeJS.ProcessEnv): {
14
- env: {
18
+ env: Record<string, string> & {
15
19
  ENVIRONMENT: string;
16
- TZ?: string;
17
20
  };
18
- nextEnv: {};
19
- publicEnv: {};
20
- stringifiedEnv: {};
21
- argParams: {};
21
+ nextEnv: {
22
+ [x: string]: any;
23
+ };
24
+ publicEnv: {
25
+ [x: string]: any;
26
+ };
27
+ stringifiedEnv: Record<string, string>;
28
+ argParams: Record<string, string>;
22
29
  params: {
30
+ [x: string]: string;
23
31
  ENVIRONMENT: string;
24
- TZ?: string;
25
32
  };
26
- args: any[];
33
+ args: string[];
27
34
  };
28
35
  export function getPublicEnvValue(publicEnv: any, key: any): any;
29
36
  export function replaceEnvTemplate(replaceable: any, { env: _env, template, callback, }?: {
30
37
  env?: NodeJS.ProcessEnv;
31
38
  template?: RegExp;
32
- callback?: (replacedValue: any) => any;
39
+ callback?: (replacedValue: any, _replaceable: any) => any;
33
40
  }): 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_',
@@ -33,35 +33,48 @@ exports.publicKeyValidator = publicKeyValidator;
33
33
  // TODO: move to processBatch???
34
34
  const stringifyEnv = (_env) => (Object.entries(_env !== null && _env !== void 0 ? _env : {}).reduce((__env, [key, val]) => (Object.assign(Object.assign({}, __env), {
35
35
  // NOTE: DefinePlugin requires stringified
36
- [key]: JSON.stringify(val) })), {}));
36
+ [key]: JSON.stringify(val) })), /** @type {Record<string, string>} */ ({})));
37
37
  // TODO: move to processBatch???
38
38
  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
39
  [key]: val,
40
- })), {}));
40
+ })), /** @type {Record<string, string>} */ ({})));
41
41
  const cleanLowerEnv = (_env, keyValidator = exports.lowerKeyValidator) => (cleanEnv(process.env, keyValidator));
42
42
  exports.cleanLowerEnv = cleanLowerEnv;
43
43
  const cleanPublicEnv = (_env, keyValidator = exports.publicKeyValidator) => (cleanEnv(_env, keyValidator));
44
44
  exports.cleanPublicEnv = cleanPublicEnv;
45
45
  const parseEnvData = (_env = process.env) => {
46
46
  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));
47
+ const _environment = [SITE_ENV, BUILD_ENV, NODE_ENV, 'development'].find((value) => (0, display_js_1.stringNotEmptyOnly)(value));
48
+ // NOTE: annotated so the index signature survives the spread — without it consumers get
49
+ // a type with only ENVIRONMENT on it and every other `env.SOME_VAR` lookup is an error.
50
+ /** @type {Record<string, string> & { ENVIRONMENT: string }} */
48
51
  const mergedEnv = Object.assign(Object.assign({}, _env), {
49
52
  // NOTE: intentionally giving precedence to ENVIRONMENT
50
53
  ENVIRONMENT: ENVIRONMENT || _environment });
51
54
  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)) {
55
+ var _a, _b, _c, _d, _e;
56
+ // NOTE: split on the FIRST '=' only everything after it is the value, verbatim.
57
+ // Splitting on every '=' truncated any value that contained one, so `--context=env=prod`
58
+ // silently became `{ context: 'env' }` and the rest was dropped.
59
+ 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;
60
+ const [__param, _value] = (separatorIndex === -1)
61
+ ? [arg, undefined]
62
+ : [arg.slice(0, separatorIndex), arg.slice(separatorIndex + 1)];
63
+ const _param = (_c = __param === null || __param === void 0 ? void 0 : __param.replace) === null || _c === void 0 ? void 0 : _c.call(__param, '--', '');
64
+ if ((0, display_js_1.stringEmptyOnly)(_param)) {
56
65
  return {
57
66
  args: _args,
58
67
  argParams: _argParams,
59
68
  };
60
69
  }
61
70
  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];
71
+ // NOTE: this handles serverless args similar to "--param=env=development" — the value is
72
+ // itself a key=value pair, so it splits on its own first '=' for the same reason.
73
+ if (_param === 'param') {
74
+ 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;
75
+ if (valueSeparatorIndex > 0) {
76
+ entry = [_value.slice(0, valueSeparatorIndex), _value.slice(valueSeparatorIndex + 1)];
77
+ }
65
78
  }
66
79
  const [param, value] = entry;
67
80
  return {
@@ -69,13 +82,13 @@ const parseEnvData = (_env = process.env) => {
69
82
  ..._args,
70
83
  ...(value == undefined) ? [__param] : []
71
84
  ],
72
- argParams: Object.assign(Object.assign({}, _argParams), (0, display_1.stringNotEmptyOnly)(value) && {
85
+ argParams: Object.assign(Object.assign({}, _argParams), (0, display_js_1.stringNotEmptyOnly)(value) && {
73
86
  [param]: value,
74
87
  }),
75
88
  };
76
89
  }, {
77
- args: [],
78
- argParams: {},
90
+ args: /** @type {string[]} */ ([]),
91
+ argParams: /** @type {Record<string, string>} */ ({}),
79
92
  }), { argParams } = _a, output = __rest(_a, ["argParams"]);
80
93
  const nextEnv = cleanEnv(mergedEnv);
81
94
  const publicEnv = (0, exports.cleanPublicEnv)(mergedEnv);
@@ -85,10 +98,10 @@ const parseEnvData = (_env = process.env) => {
85
98
  exports.parseEnvData = parseEnvData;
86
99
  const getPublicEnvValue = (publicEnv, key) => {
87
100
  let envValue;
88
- if ((0, display_1.stringEmptyOnly)(key) || !publicEnv) {
101
+ if ((0, display_js_1.stringEmptyOnly)(key) || !publicEnv) {
89
102
  return envValue;
90
103
  }
91
- if ((0, display_1.stringNotEmptyOnly)(publicEnv === null || publicEnv === void 0 ? void 0 : publicEnv[key])) {
104
+ if ((0, display_js_1.stringNotEmptyOnly)(publicEnv === null || publicEnv === void 0 ? void 0 : publicEnv[key])) {
92
105
  return publicEnv[key];
93
106
  }
94
107
  let baseKey = key;
@@ -97,7 +110,7 @@ const getPublicEnvValue = (publicEnv, key) => {
97
110
  for (const envPrefix of exports.ENV_PREFIXES) {
98
111
  if (key.startsWith(envPrefix)) {
99
112
  const trimmedKey = key.slice(envPrefix.length);
100
- if ((0, display_1.stringNotEmptyOnly)(trimmedKey)) {
113
+ if ((0, display_js_1.stringNotEmptyOnly)(trimmedKey)) {
101
114
  baseKey = trimmedKey;
102
115
  break;
103
116
  }
@@ -108,19 +121,21 @@ const getPublicEnvValue = (publicEnv, key) => {
108
121
  // eslint-disable-next-line no-restricted-syntax
109
122
  for (const matchableEnvKey of matchableEnvKeys) {
110
123
  envValue = publicEnv[matchableEnvKey];
111
- if ((0, display_1.stringNotEmptyOnly)(envValue)) {
124
+ if ((0, display_js_1.stringNotEmptyOnly)(envValue)) {
112
125
  break;
113
126
  }
114
127
  }
115
128
  return envValue;
116
129
  };
117
130
  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) => {
131
+ const replaceEnvTemplate = (replaceable, { env: _env = process.env, template = /\{\{process\.env\.(\w+)\}\}/g,
132
+ // NOTE: the second arg is the matched token — declared so the default's signature matches
133
+ // how it is actually invoked below, even though the default ignores it.
134
+ callback = (replacedValue, _replaceable) => replacedValue, } = {}) => ((0, display_js_1.ensureStringOnly)(replaceable).replace(template, (replaceable, variable) => {
119
135
  const replacedValue = (0, exports.getPublicEnvValue)(_env, variable.trim());
120
- if ((0, display_1.stringEmptyOnly)(replacedValue)) {
136
+ if ((0, display_js_1.stringEmptyOnly)(replacedValue)) {
121
137
  return replaceable;
122
138
  }
123
139
  return callback(replacedValue, replaceable);
124
140
  }));
125
141
  exports.replaceEnvTemplate = replaceEnvTemplate;
126
- //# sourceMappingURL=env.js.map
@@ -0,0 +1,9 @@
1
+ // HMMM: what if 'string' is an object?
2
+ export const ensureStringOnly = (string) => (
3
+ // eslint-disable-next-line eqeqeq
4
+ (string != undefined) ? `${string}` : '');
5
+ export const stringNotEmptyOnly = (stringable) => {
6
+ const string = ensureStringOnly(stringable);
7
+ return ((string.length > 0) && !['null', 'undefined'].includes(string));
8
+ };
9
+ export const stringEmptyOnly = (stringable) => (!stringNotEmptyOnly(stringable));
@@ -0,0 +1,130 @@
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
+ export const nextKeyValidator = (envKey) => (
21
+ // NOTE: not allowed by NEXT: https://nextjs.org/docs/messages/env-key-not-allowed
22
+ !(envKey.startsWith('__') || envKey.startsWith('NODE_')));
23
+ export const lowerKeyValidator = (envKey) => (nextKeyValidator(envKey) &&
24
+ /^[^A-Z]*$/.test(envKey));
25
+ export const publicKeyValidator = (envKey) => (ENV_PREFIXES.some((envPrefix) => envKey === null || envKey === void 0 ? void 0 : envKey.startsWith(envPrefix)) ||
26
+ ['NODE_ENV', 'PORT', 'ENVIRONMENT', 'DEBUG', 'SCOPES', 'SHOPIFY_API_SCOPES'].includes(envKey));
27
+ // TODO: move to processBatch???
28
+ const stringifyEnv = (_env) => (Object.entries(_env !== null && _env !== void 0 ? _env : {}).reduce((__env, [key, val]) => (Object.assign(Object.assign({}, __env), {
29
+ // NOTE: DefinePlugin requires stringified
30
+ [key]: JSON.stringify(val) })), /** @type {Record<string, string>} */ ({})));
31
+ // TODO: move to processBatch???
32
+ const cleanEnv = (_env, keyValidator = nextKeyValidator) => (Object.entries(_env !== null && _env !== void 0 ? _env : []).reduce((__env, [key, val]) => (Object.assign(Object.assign({}, __env), keyValidator(key) && {
33
+ [key]: val,
34
+ })), /** @type {Record<string, string>} */ ({})));
35
+ export const cleanLowerEnv = (_env, keyValidator = lowerKeyValidator) => (cleanEnv(process.env, keyValidator));
36
+ export const cleanPublicEnv = (_env, keyValidator = publicKeyValidator) => (cleanEnv(_env, keyValidator));
37
+ export const parseEnvData = (_env = process.env) => {
38
+ const { ENVIRONMENT, SITE_ENV, BUILD_ENV, NODE_ENV } = _env;
39
+ const _environment = [SITE_ENV, BUILD_ENV, NODE_ENV, 'development'].find((value) => stringNotEmptyOnly(value));
40
+ // NOTE: annotated so the index signature survives the spread — without it consumers get
41
+ // a type with only ENVIRONMENT on it and every other `env.SOME_VAR` lookup is an error.
42
+ /** @type {Record<string, string> & { ENVIRONMENT: string }} */
43
+ const mergedEnv = Object.assign(Object.assign({}, _env), {
44
+ // NOTE: intentionally giving precedence to ENVIRONMENT
45
+ ENVIRONMENT: ENVIRONMENT || _environment });
46
+ const _a = process.argv.reduce(({ args: _args, argParams: _argParams, }, arg) => {
47
+ var _a, _b, _c, _d, _e;
48
+ // NOTE: split on the FIRST '=' only — everything after it is the value, verbatim.
49
+ // Splitting on every '=' truncated any value that contained one, so `--context=env=prod`
50
+ // silently became `{ context: 'env' }` and the rest was dropped.
51
+ 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;
52
+ const [__param, _value] = (separatorIndex === -1)
53
+ ? [arg, undefined]
54
+ : [arg.slice(0, separatorIndex), arg.slice(separatorIndex + 1)];
55
+ const _param = (_c = __param === null || __param === void 0 ? void 0 : __param.replace) === null || _c === void 0 ? void 0 : _c.call(__param, '--', '');
56
+ if (stringEmptyOnly(_param)) {
57
+ return {
58
+ args: _args,
59
+ argParams: _argParams,
60
+ };
61
+ }
62
+ let entry = [_param, _value];
63
+ // NOTE: this handles serverless args similar to "--param=env=development" — the value is
64
+ // itself a key=value pair, so it splits on its own first '=' for the same reason.
65
+ if (_param === 'param') {
66
+ 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;
67
+ if (valueSeparatorIndex > 0) {
68
+ entry = [_value.slice(0, valueSeparatorIndex), _value.slice(valueSeparatorIndex + 1)];
69
+ }
70
+ }
71
+ const [param, value] = entry;
72
+ return {
73
+ args: [
74
+ ..._args,
75
+ ...(value == undefined) ? [__param] : []
76
+ ],
77
+ argParams: Object.assign(Object.assign({}, _argParams), stringNotEmptyOnly(value) && {
78
+ [param]: value,
79
+ }),
80
+ };
81
+ }, {
82
+ args: /** @type {string[]} */ ([]),
83
+ argParams: /** @type {Record<string, string>} */ ({}),
84
+ }), { argParams } = _a, output = __rest(_a, ["argParams"]);
85
+ const nextEnv = cleanEnv(mergedEnv);
86
+ const publicEnv = cleanPublicEnv(mergedEnv);
87
+ return Object.assign(Object.assign({}, output), { env: mergedEnv, nextEnv,
88
+ publicEnv, stringifiedEnv: stringifyEnv(publicEnv), argParams, params: Object.assign(Object.assign({}, mergedEnv), argParams) });
89
+ };
90
+ export const getPublicEnvValue = (publicEnv, key) => {
91
+ let envValue;
92
+ if (stringEmptyOnly(key) || !publicEnv) {
93
+ return envValue;
94
+ }
95
+ if (stringNotEmptyOnly(publicEnv === null || publicEnv === void 0 ? void 0 : publicEnv[key])) {
96
+ return publicEnv[key];
97
+ }
98
+ let baseKey = key;
99
+ // NOTE: intentionally using for/of loop instead of map so we can break to exit quickly soon as matched
100
+ // eslint-disable-next-line no-restricted-syntax
101
+ for (const envPrefix of ENV_PREFIXES) {
102
+ if (key.startsWith(envPrefix)) {
103
+ const trimmedKey = key.slice(envPrefix.length);
104
+ if (stringNotEmptyOnly(trimmedKey)) {
105
+ baseKey = trimmedKey;
106
+ break;
107
+ }
108
+ }
109
+ }
110
+ const matchableEnvKeys = ENV_PREFIXES.map((envPrefix) => `${envPrefix}${baseKey}`);
111
+ // NOTE: intentionally using for/of loop instead of map so we can break to exit quickly soon as matched
112
+ // eslint-disable-next-line no-restricted-syntax
113
+ for (const matchableEnvKey of matchableEnvKeys) {
114
+ envValue = publicEnv[matchableEnvKey];
115
+ if (stringNotEmptyOnly(envValue)) {
116
+ break;
117
+ }
118
+ }
119
+ return envValue;
120
+ };
121
+ export const replaceEnvTemplate = (replaceable, { env: _env = process.env, template = /\{\{process\.env\.(\w+)\}\}/g,
122
+ // NOTE: the second arg is the matched token — declared so the default's signature matches
123
+ // how it is actually invoked below, even though the default ignores it.
124
+ callback = (replacedValue, _replaceable) => replacedValue, } = {}) => (ensureStringOnly(replaceable).replace(template, (replaceable, variable) => {
125
+ const replacedValue = getPublicEnvValue(_env, variable.trim());
126
+ if (stringEmptyOnly(replacedValue)) {
127
+ return replaceable;
128
+ }
129
+ return callback(replacedValue, replaceable);
130
+ }));
@@ -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,45 @@
1
+ import { ensureStringOnly } from './display.js';
2
+ export const parseProjectName = (_name) => {
3
+ var _a;
4
+ const name = ensureStringOnly(_name);
5
+ const [, organization, ...parts] = (_a = /(@.*)([\\]+|\/)+(.*)/.exec(name)) !== null && _a !== void 0 ? _a : [];
6
+ const projectName = organization ? name.replace(organization, '').replace('/', '') : name;
7
+ return {
8
+ name,
9
+ parts,
10
+ organization,
11
+ projectName,
12
+ };
13
+ };
14
+ export const parsePackageInfo = (packageInfo) => {
15
+ 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 : {};
16
+ const { name, organization, projectName } = parseProjectName(_name);
17
+ 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);
18
+ 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);
19
+ const companyName = organization === null || organization === void 0 ? void 0 : organization.replace('@', '');
20
+ const appOwner = _appOwner !== null && _appOwner !== void 0 ? _appOwner : companyName;
21
+ const packageDetails = {
22
+ keywords,
23
+ appOwner,
24
+ appName,
25
+ version,
26
+ siteName,
27
+ shortName,
28
+ siteHandle,
29
+ siteAuthor,
30
+ companyName,
31
+ projectName,
32
+ devDependencies,
33
+ peerDependencies,
34
+ bundledDependencies,
35
+ runtimeDependencies,
36
+ browserDependencies,
37
+ optionalDependencies,
38
+ };
39
+ // NOTE: declared as a tuple — an array literal infers as
40
+ // (string | typeof packageDetails)[], so destructuring the first element
41
+ // would hand callers a union instead of the object.
42
+ /** @type {[typeof packageDetails, string | undefined, string]} */
43
+ const packageParts = [packageDetails, organization, name];
44
+ return packageParts;
45
+ };
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
@@ -4,7 +4,7 @@ export function parseProjectName(_name: any): {
4
4
  organization: string;
5
5
  projectName: string;
6
6
  };
7
- export function parsePackageInfo(packageInfo: any): (string | {
7
+ export function parsePackageInfo(packageInfo: any): [{
8
8
  keywords: any;
9
9
  appOwner: any;
10
10
  appName: any;
@@ -21,4 +21,4 @@ export function parsePackageInfo(packageInfo: any): (string | {
21
21
  runtimeDependencies: any;
22
22
  browserDependencies: any;
23
23
  optionalDependencies: any;
24
- })[];
24
+ }, string, string];
package/dist/project.js CHANGED
@@ -1,10 +1,10 @@
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
5
  const parseProjectName = (_name) => {
6
6
  var _a;
7
- const name = (0, display_1.ensureStringOnly)(_name);
7
+ const name = (0, display_js_1.ensureStringOnly)(_name);
8
8
  const [, organization, ...parts] = (_a = /(@.*)([\\]+|\/)+(.*)/.exec(name)) !== null && _a !== void 0 ? _a : [];
9
9
  const projectName = organization ? name.replace(organization, '').replace('/', '') : name;
10
10
  return {
@@ -22,24 +22,29 @@ const parsePackageInfo = (packageInfo) => {
22
22
  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
23
  const companyName = organization === null || organization === void 0 ? void 0 : organization.replace('@', '');
24
24
  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];
25
+ const packageDetails = {
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
+ };
43
+ // NOTE: declared as a tuple — an array literal infers as
44
+ // (string | typeof packageDetails)[], so destructuring the first element
45
+ // would hand callers a union instead of the object.
46
+ /** @type {[typeof packageDetails, string | undefined, string]} */
47
+ const packageParts = [packageDetails, organization, name];
48
+ return packageParts;
43
49
  };
44
50
  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.1",
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,39 @@
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
+ "test": "jest",
41
51
  "release": "npx semantic-release@22.0.12",
42
52
  "release:debug": "yarn release --debug",
43
53
  "prepare": "husky install"
@@ -48,8 +58,6 @@
48
58
  ]
49
59
  },
50
60
  "devDependencies": {
51
- "@babel/core": "7.27.x",
52
- "@babel/eslint-parser": "7.27.x",
53
61
  "@commitlint/cli": "18.6.1",
54
62
  "@commitlint/config-conventional": "18.6.1",
55
63
  "@semantic-release/changelog": "6.0.3",
@@ -57,16 +65,10 @@
57
65
  "@semantic-release/github": "9.2.6",
58
66
  "@semantic-release/npm": "11.0.3",
59
67
  "@semantic-release/release-notes-generator": "12.1.0",
60
- "@types/jest": "26.0.24",
68
+ "@types/jest": "29.x",
61
69
  "@types/node": "18.x",
62
- "@types/react": "17.0.2",
63
- "@types/react-dom": "17.0.2",
64
70
  "@typescript-eslint/eslint-plugin": "6.3.0",
65
71
  "@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
72
  "eslint": "8.23.0",
71
73
  "eslint-plugin-import": "2.26.0",
72
74
  "husky": "6.0.0",
@@ -74,9 +76,7 @@
74
76
  "lint-staged": "11.0.0",
75
77
  "rimraf": "4.4.1",
76
78
  "semantic-release": "22.0.12",
77
- "sinon": "10.0.0",
78
- "sinon-chai": "3.6.0",
79
- "ts-jest": "27.1.5",
79
+ "ts-jest": "29.x",
80
80
  "typescript": "5.4.2"
81
81
  },
82
82
  "resolutions": {
@@ -85,5 +85,6 @@
85
85
  },
86
86
  "publishConfig": {
87
87
  "access": "public"
88
- }
88
+ },
89
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
89
90
  }
@@ -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,S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AG,SAAS,CAAC,eAAe,CAAC,CAAA;QACrC,IAAI,IAAA,4BAAkB,EAAC,QAAQ,CAAC,EAAE,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,MA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