@karmaniverous/get-dotenv 2.2.2 → 2.2.3

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.
@@ -89,17 +89,9 @@ const getDotenv = async function () {
89
89
  if (dynamicPath && !excludeDynamic) {
90
90
  const dynamic = new Function(`return ${(await _fsExtra.default.readFile(dynamicPath)).toString()}`)()(dotenv);
91
91
  Object.keys(dynamic).forEach(key => {
92
- try {
93
- Object.assign(dotenv, {
94
- [key]: dynamic[key](dotenv)
95
- });
96
- } catch ({
97
- message
98
- }) {
99
- Object.assign(dotenv, {
100
- [key]: `ERROR: ${message}`
101
- });
102
- }
92
+ Object.assign(dotenv, {
93
+ [key]: typeof dynamic[key] === 'function' ? dynamic[key](dotenv) : dynamic[key]
94
+ });
103
95
  });
104
96
  }
105
97
 
@@ -119,7 +111,23 @@ const getDotenv = async function () {
119
111
  if (log) console.log(dotenv);
120
112
 
121
113
  // Load process.env.
122
- if (loadProcess) Object.assign(process.env, dotenv);
114
+ if (loadProcess) Object.assign(process.env, dotenv, {
115
+ getdotenvOptions: JSON.stringify({
116
+ dotenvToken,
117
+ dynamicPath,
118
+ env,
119
+ excludeDynamic,
120
+ excludeEnv,
121
+ excludeGlobal,
122
+ excludePrivate,
123
+ excludePublic,
124
+ loadProcess,
125
+ log,
126
+ outputPath,
127
+ paths,
128
+ privateToken
129
+ })
130
+ });
123
131
  return dotenv;
124
132
  };
125
133
 
@@ -201,7 +209,7 @@ const getDotenvSync = function () {
201
209
 
202
210
  // Load process.env.
203
211
  if (loadProcess) Object.assign(process.env, dotenv, {
204
- __getdotenvOptions: JSON.stringify({
212
+ getdotenvOptions: JSON.stringify({
205
213
  dotenvToken,
206
214
  dynamicPath,
207
215
  env,
@@ -99,11 +99,12 @@ export const getDotenv = async ({
99
99
  `return ${(await fs.readFile(dynamicPath)).toString()}`
100
100
  )()(dotenv);
101
101
  Object.keys(dynamic).forEach((key) => {
102
- try {
103
- Object.assign(dotenv, { [key]: dynamic[key](dotenv) });
104
- } catch ({ message }) {
105
- Object.assign(dotenv, { [key]: `ERROR: ${message}` });
106
- }
102
+ Object.assign(dotenv, {
103
+ [key]:
104
+ typeof dynamic[key] === 'function'
105
+ ? dynamic[key](dotenv)
106
+ : dynamic[key],
107
+ });
107
108
  });
108
109
  }
109
110
 
@@ -128,7 +129,24 @@ export const getDotenv = async ({
128
129
  if (log) console.log(dotenv);
129
130
 
130
131
  // Load process.env.
131
- if (loadProcess) Object.assign(process.env, dotenv);
132
+ if (loadProcess)
133
+ Object.assign(process.env, dotenv, {
134
+ getdotenvOptions: JSON.stringify({
135
+ dotenvToken,
136
+ dynamicPath,
137
+ env,
138
+ excludeDynamic,
139
+ excludeEnv,
140
+ excludeGlobal,
141
+ excludePrivate,
142
+ excludePublic,
143
+ loadProcess,
144
+ log,
145
+ outputPath,
146
+ paths,
147
+ privateToken,
148
+ }),
149
+ });
132
150
 
133
151
  return dotenv;
134
152
  };
@@ -236,7 +254,7 @@ export const getDotenvSync = ({
236
254
  // Load process.env.
237
255
  if (loadProcess)
238
256
  Object.assign(process.env, dotenv, {
239
- __getdotenvOptions: JSON.stringify({
257
+ getdotenvOptions: JSON.stringify({
240
258
  dotenvToken,
241
259
  dynamicPath,
242
260
  env,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "bin": {
4
4
  "getdotenv": "bin/getdotenv/index.js"
5
5
  },
6
- "version": "2.2.2",
6
+ "version": "2.2.3",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },