@uniformdev/redirect 19.75.1-alpha.30 → 19.75.1-alpha.34
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/dist/chunk-TLYAXJ7N.mjs +16 -0
- package/dist/main-4Y7KG46W.mjs +298 -0
- package/package.json +3 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
+
}) : x)(function(x) {
|
|
5
|
+
if (typeof require !== "undefined")
|
|
6
|
+
return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
__require,
|
|
15
|
+
__commonJS
|
|
16
|
+
};
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__require
|
|
4
|
+
} from "./chunk-TLYAXJ7N.mjs";
|
|
5
|
+
|
|
6
|
+
// ../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/package.json
|
|
7
|
+
var require_package = __commonJS({
|
|
8
|
+
"../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/package.json"(exports, module) {
|
|
9
|
+
module.exports = {
|
|
10
|
+
name: "dotenv",
|
|
11
|
+
version: "16.3.1",
|
|
12
|
+
description: "Loads environment variables from .env file",
|
|
13
|
+
main: "lib/main.js",
|
|
14
|
+
types: "lib/main.d.ts",
|
|
15
|
+
exports: {
|
|
16
|
+
".": {
|
|
17
|
+
types: "./lib/main.d.ts",
|
|
18
|
+
require: "./lib/main.js",
|
|
19
|
+
default: "./lib/main.js"
|
|
20
|
+
},
|
|
21
|
+
"./config": "./config.js",
|
|
22
|
+
"./config.js": "./config.js",
|
|
23
|
+
"./lib/env-options": "./lib/env-options.js",
|
|
24
|
+
"./lib/env-options.js": "./lib/env-options.js",
|
|
25
|
+
"./lib/cli-options": "./lib/cli-options.js",
|
|
26
|
+
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
scripts: {
|
|
30
|
+
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
31
|
+
lint: "standard",
|
|
32
|
+
"lint-readme": "standard-markdown",
|
|
33
|
+
pretest: "npm run lint && npm run dts-check",
|
|
34
|
+
test: "tap tests/*.js --100 -Rspec",
|
|
35
|
+
prerelease: "npm test",
|
|
36
|
+
release: "standard-version"
|
|
37
|
+
},
|
|
38
|
+
repository: {
|
|
39
|
+
type: "git",
|
|
40
|
+
url: "git://github.com/motdotla/dotenv.git"
|
|
41
|
+
},
|
|
42
|
+
funding: "https://github.com/motdotla/dotenv?sponsor=1",
|
|
43
|
+
keywords: [
|
|
44
|
+
"dotenv",
|
|
45
|
+
"env",
|
|
46
|
+
".env",
|
|
47
|
+
"environment",
|
|
48
|
+
"variables",
|
|
49
|
+
"config",
|
|
50
|
+
"settings"
|
|
51
|
+
],
|
|
52
|
+
readmeFilename: "README.md",
|
|
53
|
+
license: "BSD-2-Clause",
|
|
54
|
+
devDependencies: {
|
|
55
|
+
"@definitelytyped/dtslint": "^0.0.133",
|
|
56
|
+
"@types/node": "^18.11.3",
|
|
57
|
+
decache: "^4.6.1",
|
|
58
|
+
sinon: "^14.0.1",
|
|
59
|
+
standard: "^17.0.0",
|
|
60
|
+
"standard-markdown": "^7.1.0",
|
|
61
|
+
"standard-version": "^9.5.0",
|
|
62
|
+
tap: "^16.3.0",
|
|
63
|
+
tar: "^6.1.11",
|
|
64
|
+
typescript: "^4.8.4"
|
|
65
|
+
},
|
|
66
|
+
engines: {
|
|
67
|
+
node: ">=12"
|
|
68
|
+
},
|
|
69
|
+
browser: {
|
|
70
|
+
fs: false
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// ../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js
|
|
77
|
+
var require_main = __commonJS({
|
|
78
|
+
"../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js"(exports, module) {
|
|
79
|
+
var fs = __require("fs");
|
|
80
|
+
var path = __require("path");
|
|
81
|
+
var os = __require("os");
|
|
82
|
+
var crypto = __require("crypto");
|
|
83
|
+
var packageJson = require_package();
|
|
84
|
+
var version = packageJson.version;
|
|
85
|
+
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
86
|
+
function parse(src) {
|
|
87
|
+
const obj = {};
|
|
88
|
+
let lines = src.toString();
|
|
89
|
+
lines = lines.replace(/\r\n?/mg, "\n");
|
|
90
|
+
let match;
|
|
91
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
92
|
+
const key = match[1];
|
|
93
|
+
let value = match[2] || "";
|
|
94
|
+
value = value.trim();
|
|
95
|
+
const maybeQuote = value[0];
|
|
96
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
97
|
+
if (maybeQuote === '"') {
|
|
98
|
+
value = value.replace(/\\n/g, "\n");
|
|
99
|
+
value = value.replace(/\\r/g, "\r");
|
|
100
|
+
}
|
|
101
|
+
obj[key] = value;
|
|
102
|
+
}
|
|
103
|
+
return obj;
|
|
104
|
+
}
|
|
105
|
+
function _parseVault(options) {
|
|
106
|
+
const vaultPath = _vaultPath(options);
|
|
107
|
+
const result = DotenvModule.configDotenv({ path: vaultPath });
|
|
108
|
+
if (!result.parsed) {
|
|
109
|
+
throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
110
|
+
}
|
|
111
|
+
const keys = _dotenvKey(options).split(",");
|
|
112
|
+
const length = keys.length;
|
|
113
|
+
let decrypted;
|
|
114
|
+
for (let i = 0; i < length; i++) {
|
|
115
|
+
try {
|
|
116
|
+
const key = keys[i].trim();
|
|
117
|
+
const attrs = _instructions(result, key);
|
|
118
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
119
|
+
break;
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (i + 1 >= length) {
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return DotenvModule.parse(decrypted);
|
|
127
|
+
}
|
|
128
|
+
function _log(message) {
|
|
129
|
+
console.log(`[dotenv@${version}][INFO] ${message}`);
|
|
130
|
+
}
|
|
131
|
+
function _warn(message) {
|
|
132
|
+
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
133
|
+
}
|
|
134
|
+
function _debug(message) {
|
|
135
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
136
|
+
}
|
|
137
|
+
function _dotenvKey(options) {
|
|
138
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
139
|
+
return options.DOTENV_KEY;
|
|
140
|
+
}
|
|
141
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
142
|
+
return process.env.DOTENV_KEY;
|
|
143
|
+
}
|
|
144
|
+
return "";
|
|
145
|
+
}
|
|
146
|
+
function _instructions(result, dotenvKey) {
|
|
147
|
+
let uri;
|
|
148
|
+
try {
|
|
149
|
+
uri = new URL(dotenvKey);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
if (error.code === "ERR_INVALID_URL") {
|
|
152
|
+
throw new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development");
|
|
153
|
+
}
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
const key = uri.password;
|
|
157
|
+
if (!key) {
|
|
158
|
+
throw new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
159
|
+
}
|
|
160
|
+
const environment = uri.searchParams.get("environment");
|
|
161
|
+
if (!environment) {
|
|
162
|
+
throw new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
163
|
+
}
|
|
164
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
165
|
+
const ciphertext = result.parsed[environmentKey];
|
|
166
|
+
if (!ciphertext) {
|
|
167
|
+
throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
168
|
+
}
|
|
169
|
+
return { ciphertext, key };
|
|
170
|
+
}
|
|
171
|
+
function _vaultPath(options) {
|
|
172
|
+
let dotenvPath = path.resolve(process.cwd(), ".env");
|
|
173
|
+
if (options && options.path && options.path.length > 0) {
|
|
174
|
+
dotenvPath = options.path;
|
|
175
|
+
}
|
|
176
|
+
return dotenvPath.endsWith(".vault") ? dotenvPath : `${dotenvPath}.vault`;
|
|
177
|
+
}
|
|
178
|
+
function _resolveHome(envPath) {
|
|
179
|
+
return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
180
|
+
}
|
|
181
|
+
function _configVault(options) {
|
|
182
|
+
_log("Loading env from encrypted .env.vault");
|
|
183
|
+
const parsed = DotenvModule._parseVault(options);
|
|
184
|
+
let processEnv = process.env;
|
|
185
|
+
if (options && options.processEnv != null) {
|
|
186
|
+
processEnv = options.processEnv;
|
|
187
|
+
}
|
|
188
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
189
|
+
return { parsed };
|
|
190
|
+
}
|
|
191
|
+
function configDotenv(options) {
|
|
192
|
+
let dotenvPath = path.resolve(process.cwd(), ".env");
|
|
193
|
+
let encoding = "utf8";
|
|
194
|
+
const debug = Boolean(options && options.debug);
|
|
195
|
+
if (options) {
|
|
196
|
+
if (options.path != null) {
|
|
197
|
+
dotenvPath = _resolveHome(options.path);
|
|
198
|
+
}
|
|
199
|
+
if (options.encoding != null) {
|
|
200
|
+
encoding = options.encoding;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
|
|
205
|
+
let processEnv = process.env;
|
|
206
|
+
if (options && options.processEnv != null) {
|
|
207
|
+
processEnv = options.processEnv;
|
|
208
|
+
}
|
|
209
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
210
|
+
return { parsed };
|
|
211
|
+
} catch (e) {
|
|
212
|
+
if (debug) {
|
|
213
|
+
_debug(`Failed to load ${dotenvPath} ${e.message}`);
|
|
214
|
+
}
|
|
215
|
+
return { error: e };
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function config(options) {
|
|
219
|
+
const vaultPath = _vaultPath(options);
|
|
220
|
+
if (_dotenvKey(options).length === 0) {
|
|
221
|
+
return DotenvModule.configDotenv(options);
|
|
222
|
+
}
|
|
223
|
+
if (!fs.existsSync(vaultPath)) {
|
|
224
|
+
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
225
|
+
return DotenvModule.configDotenv(options);
|
|
226
|
+
}
|
|
227
|
+
return DotenvModule._configVault(options);
|
|
228
|
+
}
|
|
229
|
+
function decrypt(encrypted, keyStr) {
|
|
230
|
+
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
231
|
+
let ciphertext = Buffer.from(encrypted, "base64");
|
|
232
|
+
const nonce = ciphertext.slice(0, 12);
|
|
233
|
+
const authTag = ciphertext.slice(-16);
|
|
234
|
+
ciphertext = ciphertext.slice(12, -16);
|
|
235
|
+
try {
|
|
236
|
+
const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
|
|
237
|
+
aesgcm.setAuthTag(authTag);
|
|
238
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
239
|
+
} catch (error) {
|
|
240
|
+
const isRange = error instanceof RangeError;
|
|
241
|
+
const invalidKeyLength = error.message === "Invalid key length";
|
|
242
|
+
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
243
|
+
if (isRange || invalidKeyLength) {
|
|
244
|
+
const msg = "INVALID_DOTENV_KEY: It must be 64 characters long (or more)";
|
|
245
|
+
throw new Error(msg);
|
|
246
|
+
} else if (decryptionFailed) {
|
|
247
|
+
const msg = "DECRYPTION_FAILED: Please check your DOTENV_KEY";
|
|
248
|
+
throw new Error(msg);
|
|
249
|
+
} else {
|
|
250
|
+
console.error("Error: ", error.code);
|
|
251
|
+
console.error("Error: ", error.message);
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function populate(processEnv, parsed, options = {}) {
|
|
257
|
+
const debug = Boolean(options && options.debug);
|
|
258
|
+
const override = Boolean(options && options.override);
|
|
259
|
+
if (typeof parsed !== "object") {
|
|
260
|
+
throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
261
|
+
}
|
|
262
|
+
for (const key of Object.keys(parsed)) {
|
|
263
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
264
|
+
if (override === true) {
|
|
265
|
+
processEnv[key] = parsed[key];
|
|
266
|
+
}
|
|
267
|
+
if (debug) {
|
|
268
|
+
if (override === true) {
|
|
269
|
+
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
270
|
+
} else {
|
|
271
|
+
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
processEnv[key] = parsed[key];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
var DotenvModule = {
|
|
280
|
+
configDotenv,
|
|
281
|
+
_configVault,
|
|
282
|
+
_parseVault,
|
|
283
|
+
config,
|
|
284
|
+
decrypt,
|
|
285
|
+
parse,
|
|
286
|
+
populate
|
|
287
|
+
};
|
|
288
|
+
module.exports.configDotenv = DotenvModule.configDotenv;
|
|
289
|
+
module.exports._configVault = DotenvModule._configVault;
|
|
290
|
+
module.exports._parseVault = DotenvModule._parseVault;
|
|
291
|
+
module.exports.config = DotenvModule.config;
|
|
292
|
+
module.exports.decrypt = DotenvModule.decrypt;
|
|
293
|
+
module.exports.parse = DotenvModule.parse;
|
|
294
|
+
module.exports.populate = DotenvModule.populate;
|
|
295
|
+
module.exports = DotenvModule;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
export default require_main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/redirect",
|
|
3
|
-
"version": "19.75.1-alpha.
|
|
3
|
+
"version": "19.75.1-alpha.34+3ef8d22cef",
|
|
4
4
|
"description": "Uniform redirect client",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"/dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@uniformdev/context": "19.75.1-alpha.
|
|
36
|
+
"@uniformdev/context": "19.75.1-alpha.34+3ef8d22cef",
|
|
37
37
|
"p-limit": "^3.1.0",
|
|
38
38
|
"rfdc": "^1.3.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "3ef8d22cef3702cfeb050947ecc05449e4794ac8"
|
|
44
44
|
}
|