@uniformdev/redirect 19.38.2 → 19.39.0

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/index.esm.js CHANGED
@@ -359,11 +359,13 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
359
359
  return result.id;
360
360
  };
361
361
  this.processUrlBestMatch = async (url, options, useTrie) => {
362
- var _a;
362
+ var _a, _b;
363
363
  if (!useTrie) {
364
364
  const redirects = await this.getRedirects({ sourceUrl: url });
365
365
  const processedUrl = processUrl(url);
366
- const redirect = redirects.redirects[0];
366
+ const redirect = (_a = redirects == null ? void 0 : redirects.redirects) == null ? void 0 : _a[0];
367
+ if (!redirect)
368
+ return void 0;
367
369
  return _RedirectClient.processDefinitionToResults(
368
370
  processedUrl,
369
371
  redirect,
@@ -372,7 +374,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
372
374
  );
373
375
  }
374
376
  const trie = await this.getRedirectTrie();
375
- return (_a = _RedirectClient.processHops(url, trie, true, options)) == null ? void 0 : _a[0];
377
+ return (_b = _RedirectClient.processHops(url, trie, true, options)) == null ? void 0 : _b[0];
376
378
  };
377
379
  this.processUrlAllMatches = async (url, options, useTrie) => {
378
380
  if (!useTrie) {
@@ -613,7 +615,7 @@ var UncachedRedirectClient = class extends RedirectClient {
613
615
 
614
616
  // src/util/RedirectFileConverter.ts
615
617
  var getDefaultClient = async () => {
616
- const dotenv = await import("./main-HWDEQR7W.mjs");
618
+ const dotenv = await import("./main-4Y7KG46W.mjs");
617
619
  dotenv.config();
618
620
  return new RedirectClient({
619
621
  apiKey: process.env.UNIFORM_API_KEY,
package/dist/index.js CHANGED
@@ -30,12 +30,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // ../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/package.json
33
+ // ../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/package.json
34
34
  var require_package = __commonJS({
35
- "../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/package.json"(exports, module2) {
35
+ "../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/package.json"(exports, module2) {
36
36
  module2.exports = {
37
37
  name: "dotenv",
38
- version: "16.1.3",
38
+ version: "16.3.1",
39
39
  description: "Loads environment variables from .env file",
40
40
  main: "lib/main.js",
41
41
  types: "lib/main.d.ts",
@@ -100,9 +100,9 @@ var require_package = __commonJS({
100
100
  }
101
101
  });
102
102
 
103
- // ../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/lib/main.js
103
+ // ../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js
104
104
  var require_main = __commonJS({
105
- "../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/lib/main.js"(exports, module2) {
105
+ "../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js"(exports, module2) {
106
106
  "use strict";
107
107
  var fs = require("fs");
108
108
  var path = require("path");
@@ -136,7 +136,7 @@ var require_main = __commonJS({
136
136
  if (!result.parsed) {
137
137
  throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
138
138
  }
139
- const keys = _dotenvKey().split(",");
139
+ const keys = _dotenvKey(options).split(",");
140
140
  const length = keys.length;
141
141
  let decrypted;
142
142
  for (let i = 0; i < length; i++) {
@@ -162,7 +162,10 @@ var require_main = __commonJS({
162
162
  function _debug(message) {
163
163
  console.log(`[dotenv@${version}][DEBUG] ${message}`);
164
164
  }
165
- function _dotenvKey() {
165
+ function _dotenvKey(options) {
166
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
167
+ return options.DOTENV_KEY;
168
+ }
166
169
  if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
167
170
  return process.env.DOTENV_KEY;
168
171
  }
@@ -206,7 +209,11 @@ var require_main = __commonJS({
206
209
  function _configVault(options) {
207
210
  _log("Loading env from encrypted .env.vault");
208
211
  const parsed = DotenvModule._parseVault(options);
209
- DotenvModule.populate(process.env, parsed, options);
212
+ let processEnv = process.env;
213
+ if (options && options.processEnv != null) {
214
+ processEnv = options.processEnv;
215
+ }
216
+ DotenvModule.populate(processEnv, parsed, options);
210
217
  return { parsed };
211
218
  }
212
219
  function configDotenv(options) {
@@ -223,7 +230,11 @@ var require_main = __commonJS({
223
230
  }
224
231
  try {
225
232
  const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
226
- DotenvModule.populate(process.env, parsed, options);
233
+ let processEnv = process.env;
234
+ if (options && options.processEnv != null) {
235
+ processEnv = options.processEnv;
236
+ }
237
+ DotenvModule.populate(processEnv, parsed, options);
227
238
  return { parsed };
228
239
  } catch (e) {
229
240
  if (debug) {
@@ -234,7 +245,7 @@ var require_main = __commonJS({
234
245
  }
235
246
  function config(options) {
236
247
  const vaultPath = _vaultPath(options);
237
- if (_dotenvKey().length === 0) {
248
+ if (_dotenvKey(options).length === 0) {
238
249
  return DotenvModule.configDotenv(options);
239
250
  }
240
251
  if (!fs.existsSync(vaultPath)) {
@@ -686,11 +697,13 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
686
697
  return result.id;
687
698
  };
688
699
  this.processUrlBestMatch = async (url, options, useTrie) => {
689
- var _a;
700
+ var _a, _b;
690
701
  if (!useTrie) {
691
702
  const redirects = await this.getRedirects({ sourceUrl: url });
692
703
  const processedUrl = processUrl(url);
693
- const redirect = redirects.redirects[0];
704
+ const redirect = (_a = redirects == null ? void 0 : redirects.redirects) == null ? void 0 : _a[0];
705
+ if (!redirect)
706
+ return void 0;
694
707
  return _RedirectClient.processDefinitionToResults(
695
708
  processedUrl,
696
709
  redirect,
@@ -699,7 +712,7 @@ var _RedirectClient = class _RedirectClient extends import_api.ApiClient {
699
712
  );
700
713
  }
701
714
  const trie = await this.getRedirectTrie();
702
- return (_a = _RedirectClient.processHops(url, trie, true, options)) == null ? void 0 : _a[0];
715
+ return (_b = _RedirectClient.processHops(url, trie, true, options)) == null ? void 0 : _b[0];
703
716
  };
704
717
  this.processUrlAllMatches = async (url, options, useTrie) => {
705
718
  if (!useTrie) {
package/dist/index.mjs CHANGED
@@ -359,11 +359,13 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
359
359
  return result.id;
360
360
  };
361
361
  this.processUrlBestMatch = async (url, options, useTrie) => {
362
- var _a;
362
+ var _a, _b;
363
363
  if (!useTrie) {
364
364
  const redirects = await this.getRedirects({ sourceUrl: url });
365
365
  const processedUrl = processUrl(url);
366
- const redirect = redirects.redirects[0];
366
+ const redirect = (_a = redirects == null ? void 0 : redirects.redirects) == null ? void 0 : _a[0];
367
+ if (!redirect)
368
+ return void 0;
367
369
  return _RedirectClient.processDefinitionToResults(
368
370
  processedUrl,
369
371
  redirect,
@@ -372,7 +374,7 @@ var _RedirectClient = class _RedirectClient extends ApiClient {
372
374
  );
373
375
  }
374
376
  const trie = await this.getRedirectTrie();
375
- return (_a = _RedirectClient.processHops(url, trie, true, options)) == null ? void 0 : _a[0];
377
+ return (_b = _RedirectClient.processHops(url, trie, true, options)) == null ? void 0 : _b[0];
376
378
  };
377
379
  this.processUrlAllMatches = async (url, options, useTrie) => {
378
380
  if (!useTrie) {
@@ -613,7 +615,7 @@ var UncachedRedirectClient = class extends RedirectClient {
613
615
 
614
616
  // src/util/RedirectFileConverter.ts
615
617
  var getDefaultClient = async () => {
616
- const dotenv = await import("./main-HWDEQR7W.mjs");
618
+ const dotenv = await import("./main-4Y7KG46W.mjs");
617
619
  dotenv.config();
618
620
  return new RedirectClient({
619
621
  apiKey: process.env.UNIFORM_API_KEY,
@@ -3,12 +3,12 @@ import {
3
3
  __require
4
4
  } from "./chunk-TLYAXJ7N.mjs";
5
5
 
6
- // ../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/package.json
6
+ // ../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/package.json
7
7
  var require_package = __commonJS({
8
- "../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/package.json"(exports, module) {
8
+ "../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/package.json"(exports, module) {
9
9
  module.exports = {
10
10
  name: "dotenv",
11
- version: "16.1.3",
11
+ version: "16.3.1",
12
12
  description: "Loads environment variables from .env file",
13
13
  main: "lib/main.js",
14
14
  types: "lib/main.d.ts",
@@ -73,9 +73,9 @@ var require_package = __commonJS({
73
73
  }
74
74
  });
75
75
 
76
- // ../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/lib/main.js
76
+ // ../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js
77
77
  var require_main = __commonJS({
78
- "../../node_modules/.pnpm/dotenv@16.1.3/node_modules/dotenv/lib/main.js"(exports, module) {
78
+ "../../node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv/lib/main.js"(exports, module) {
79
79
  var fs = __require("fs");
80
80
  var path = __require("path");
81
81
  var os = __require("os");
@@ -108,7 +108,7 @@ var require_main = __commonJS({
108
108
  if (!result.parsed) {
109
109
  throw new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
110
110
  }
111
- const keys = _dotenvKey().split(",");
111
+ const keys = _dotenvKey(options).split(",");
112
112
  const length = keys.length;
113
113
  let decrypted;
114
114
  for (let i = 0; i < length; i++) {
@@ -134,7 +134,10 @@ var require_main = __commonJS({
134
134
  function _debug(message) {
135
135
  console.log(`[dotenv@${version}][DEBUG] ${message}`);
136
136
  }
137
- function _dotenvKey() {
137
+ function _dotenvKey(options) {
138
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
139
+ return options.DOTENV_KEY;
140
+ }
138
141
  if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
139
142
  return process.env.DOTENV_KEY;
140
143
  }
@@ -178,7 +181,11 @@ var require_main = __commonJS({
178
181
  function _configVault(options) {
179
182
  _log("Loading env from encrypted .env.vault");
180
183
  const parsed = DotenvModule._parseVault(options);
181
- DotenvModule.populate(process.env, parsed, options);
184
+ let processEnv = process.env;
185
+ if (options && options.processEnv != null) {
186
+ processEnv = options.processEnv;
187
+ }
188
+ DotenvModule.populate(processEnv, parsed, options);
182
189
  return { parsed };
183
190
  }
184
191
  function configDotenv(options) {
@@ -195,7 +202,11 @@ var require_main = __commonJS({
195
202
  }
196
203
  try {
197
204
  const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
198
- DotenvModule.populate(process.env, parsed, options);
205
+ let processEnv = process.env;
206
+ if (options && options.processEnv != null) {
207
+ processEnv = options.processEnv;
208
+ }
209
+ DotenvModule.populate(processEnv, parsed, options);
199
210
  return { parsed };
200
211
  } catch (e) {
201
212
  if (debug) {
@@ -206,7 +217,7 @@ var require_main = __commonJS({
206
217
  }
207
218
  function config(options) {
208
219
  const vaultPath = _vaultPath(options);
209
- if (_dotenvKey().length === 0) {
220
+ if (_dotenvKey(options).length === 0) {
210
221
  return DotenvModule.configDotenv(options);
211
222
  }
212
223
  if (!fs.existsSync(vaultPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/redirect",
3
- "version": "19.38.2",
3
+ "version": "19.39.0",
4
4
  "description": "Uniform redirect client",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -32,12 +32,12 @@
32
32
  "/dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@uniformdev/context": "19.38.2",
35
+ "@uniformdev/context": "19.39.0",
36
36
  "p-limit": "^3.1.0",
37
37
  "rfdc": "^1.3.0"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "b97fd17fd44e0f5bd3806e942b516cb2bd218096"
42
+ "gitHead": "63b0b9b3d9b8f155fad931e9e5ca56d4bda5223a"
43
43
  }