@putkoff/abstract-logger 0.0.48 → 0.0.49

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/cjs/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var require$$0$2 = require('util');
3
+ var fs = require('fs');
4
+ var path = require('path');
4
5
  var require$$0$1 = require('os');
6
+ var require$$0$2 = require('util');
5
7
  var require$$0$3 = require('stream');
6
8
  var require$$0$4 = require('buffer');
7
9
  var require$$0$5 = require('events');
8
- var require$$0$6 = require('fs');
9
- var require$$1$2 = require('path');
10
10
  var require$$3 = require('zlib');
11
11
  var require$$1 = require('tty');
12
12
  var require$$1$1 = require('string_decoder');
13
- var require$$0$7 = require('http');
14
- var require$$1$3 = require('https');
13
+ var require$$0$6 = require('http');
14
+ var require$$1$2 = require('https');
15
15
 
16
16
  /* ------------------------------------------------------------------ */
17
17
  /* Stack inspection */
@@ -184,40 +184,144 @@ const COLS = {
184
184
  file: 16,
185
185
  };
186
186
 
187
+ if (typeof process === "undefined") {
188
+ throw new Error("@putkoff/abstract-env is Node-only");
189
+ }
190
+ /* ========================================================================== */
191
+ /* Utilities */
192
+ /* ========================================================================== */
193
+ function splitEq(line) {
194
+ const idx = line.indexOf("=");
195
+ if (idx === -1)
196
+ return [line.trim(), null];
197
+ const key = line.slice(0, idx).trim();
198
+ const value = line.slice(idx + 1).trim().replace(/^['"]|['"]$/g, "");
199
+ return [key, value];
200
+ }
201
+ /* ========================================================================== */
202
+ /* AbstractEnv */
203
+ /* ========================================================================== */
204
+ class AbstractEnv {
205
+ key;
206
+ fileName;
207
+ path;
208
+ deepScan;
209
+ currentFolder;
210
+ homeFolder;
211
+ envyAll;
212
+ directories = [];
213
+ envValue = null;
214
+ envPath = null;
215
+ constructor(options = {}) {
216
+ this.key = options.key ?? "MY_PASSWORD";
217
+ this.fileName = options.fileName ?? ".env";
218
+ this.path = options.startPath ?? process.cwd();
219
+ this.deepScan = options.deepScan ?? false;
220
+ this.currentFolder = process.cwd();
221
+ this.homeFolder = require$$0$1.homedir();
222
+ this.envyAll = path.join(this.homeFolder, ".envy_all");
223
+ this.initialize();
224
+ }
225
+ initialize() {
226
+ if (fs.existsSync(this.path) && fs.statSync(this.path).isFile()) {
227
+ this.fileName = path.basename(this.path);
228
+ this.path = path.dirname(this.path);
229
+ }
230
+ this.directories = this.getDirectories();
231
+ this.envValue = this.findAndReadEnv();
232
+ }
233
+ getDirectories() {
234
+ const dirs = [
235
+ this.path,
236
+ this.currentFolder,
237
+ this.homeFolder,
238
+ this.envyAll,
239
+ ];
240
+ return [...new Set(dirs.filter(d => fs.existsSync(d) && fs.statSync(d).isDirectory()))];
241
+ }
242
+ findAndReadEnv() {
243
+ for (const dir of this.directories) {
244
+ const envPath = path.join(dir, this.fileName);
245
+ if (!fs.existsSync(envPath))
246
+ continue;
247
+ this.envPath = envPath;
248
+ const value = this.searchForKey(envPath);
249
+ if (value !== null)
250
+ return value;
251
+ }
252
+ return null;
253
+ }
254
+ searchForKey(filePath) {
255
+ const content = fs.readFileSync(filePath, "utf8");
256
+ const lines = content.split(/\r?\n/);
257
+ let bestMatch = null;
258
+ for (const line of lines) {
259
+ const [lineKey, lineValue] = splitEq(line);
260
+ if (!lineValue)
261
+ continue;
262
+ if (lineKey === this.key)
263
+ return lineValue;
264
+ if (this.deepScan) {
265
+ const score = this.fuzzyScore(this.key, lineKey);
266
+ if (score >= 0.5 && (!bestMatch || score > bestMatch.score)) {
267
+ bestMatch = { value: lineValue, score };
268
+ }
269
+ }
270
+ }
271
+ return bestMatch?.value ?? null;
272
+ }
273
+ fuzzyScore(target, candidate) {
274
+ let matched = 0;
275
+ for (const part of target.split("_")) {
276
+ if (candidate.includes(part))
277
+ matched += part.length;
278
+ }
279
+ return matched / target.length;
280
+ }
281
+ }
282
+
283
+ /**
284
+ * Retrieve environment variable value by searching .env files.
285
+ */
286
+ function getEnvValue(options = {}) {
287
+ const env = new AbstractEnv(options);
288
+ return env.envValue;
289
+ }
290
+
187
291
  /* ------------------------------------------------------------------ */
188
292
  /* Winston logger (Node only) */
189
293
  /* ------------------------------------------------------------------ */
190
294
  function getLogConfig() {
191
295
  return {
192
- condensed: process.env.LOG_CONDENSED !== "false",
193
- expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
194
- showDetails: process.env.LOG_SHOW_DETAILS !== "false",
195
- maxDetailsLength: Number(process.env.LOG_DETAILS_MAX ?? 500),
196
- activityBlocklist: parse$1(process.env.LOG_ACTIVITY_BLOCKLIST),
197
- logTypeBlocklist: parse$1(process.env.LOG_TYPE_BLOCKLIST),
198
- sampleRate: Number(process.env.LOG_SAMPLE_RATE ?? 1), // 0–1
296
+ condensed: getEnvValue({ key: "LOG_CONDENSED" }) !== "false",
297
+ expandOnDebug: getEnvValue({ key: "LOG_EXPAND_DEBUG" }) !== "false",
298
+ showDetails: getEnvValue({ key: "LOG_SHOW_DETAILS" }) !== "false",
299
+ maxDetailsLength: Number(getEnvValue({ key: "LOG_DETAILS_MAX" }) ?? 500),
300
+ activityBlocklist: parse$1(getEnvValue({ key: "LOG_ACTIVITY_BLOCKLIST" }) || ""),
301
+ logTypeBlocklist: parse$1(getEnvValue({ key: "LOG_TYPE_BLOCKLIST" }) || ""),
302
+ sampleRate: Number(getEnvValue({ key: "LOG_SAMPLE_RATE" }) ?? 1), // 0–1
199
303
  // 👇 NEW
200
- prettyDetails: process.env.LOG_PRETTY_DETAILS === "true",
201
- showDetailslist: process.env.LOG_DETAILS_ALLOWLIST
202
- ? process.env.LOG_DETAILS_ALLOWLIST.split(",").map(s => s.trim())
304
+ prettyDetails: getEnvValue({ key: "LOG_PRETTY_DETAILS" }) === "true",
305
+ showDetailslist: getEnvValue({ key: "LOG_DETAILS_ALLOWLIST" })
306
+ ? getEnvValue({ key: "LOG_DETAILS_ALLOWLIST" }) || "".split(",").map(s => s.trim())
203
307
  : [],
204
- functionAllowlist: process.env.LOG_FUNCTION_ALLOWLIST
205
- ? process.env.LOG_FUNCTION_ALLOWLIST.split(",").map(s => s.trim())
308
+ functionAllowlist: getEnvValue({ key: "LOG_FUNCTION_ALLOWLIST" })
309
+ ? getEnvValue({ key: "LOG_FUNCTION_ALLOWLIST" }) || "".split(",").map(s => s.trim())
206
310
  : [],
207
- functionBlocklist: process.env.LOG_FUNCTION_BLOCKLIST
208
- ? process.env.LOG_FUNCTION_BLOCKLIST.split(",").map(s => s.trim())
311
+ functionBlocklist: getEnvValue({ key: "LOG_FUNCTION_BLOCKLIST" })
312
+ ? getEnvValue({ key: "LOG_FUNCTION_BLOCKLIST" }) || "".split(",").map(s => s.trim())
209
313
  : [],
210
314
  };
211
315
  }
212
316
  function debugLogConfig() {
213
- if (process.env.LOG_DEBUG_CONFIG === "true") {
214
- console.log("LOG CONFIG ENV:", {
215
- LOG_SHOW_DETAILS: process.env.LOG_SHOW_DETAILS,
216
- LOG_DETAILS_ALLOWLIST: process.env.LOG_DETAILS_ALLOWLIST,
217
- LOG_PRETTY_DETAILS: process.env.LOG_PRETTY_DETAILS,
218
- LOG_CONDENSED: process.env.LOG_CONDENSED,
219
- LOG_EXPAND_DEBUG: process.env.LOG_EXPAND_DEBUG,
220
- });
317
+ if (getEnvValue({ key: "LOG_DEBUG_CONFIG" }) === "true") {
318
+ console.log("LOG CONFIG ENV:"), {
319
+ LOG_SHOW_DETAILS: getEnvValue({ key: "LOG_SHOW_DETAILS" }),
320
+ LOG_DETAILS_ALLOWLIST: getEnvValue({ key: "LOG_DETAILS_ALLOWLIST" }),
321
+ LOG_PRETTY_DETAILS: getEnvValue({ key: "LOG_PRETTY_DETAILS" }),
322
+ LOG_CONDENSED: getEnvValue({ key: "LOG_CONDENSED" }),
323
+ LOG_EXPAND_DEBUG: getEnvValue({ key: "LOG_EXPAND_DEBUG" }),
324
+ };
221
325
  }
222
326
  }
223
327
  function parse$1(v) {
@@ -1496,11 +1600,11 @@ function requireAlign () {
1496
1600
  /* eslint no-undefined: 0 */
1497
1601
 
1498
1602
  var errors$1;
1499
- var hasRequiredErrors$1;
1603
+ var hasRequiredErrors;
1500
1604
 
1501
- function requireErrors$1 () {
1502
- if (hasRequiredErrors$1) return errors$1;
1503
- hasRequiredErrors$1 = 1;
1605
+ function requireErrors () {
1606
+ if (hasRequiredErrors) return errors$1;
1607
+ hasRequiredErrors = 1;
1504
1608
 
1505
1609
  const format = format$2;
1506
1610
  const { LEVEL, MESSAGE } = tripleBeam;
@@ -3550,7 +3654,7 @@ function exposeFormat(name, requireFormat) {
3550
3654
  // Setup all transports as lazy-loaded getters.
3551
3655
  //
3552
3656
  exposeFormat('align', function () { return requireAlign(); });
3553
- exposeFormat('errors', function () { return requireErrors$1(); });
3657
+ exposeFormat('errors', function () { return requireErrors(); });
3554
3658
  exposeFormat('cli', function () { return requireCli(); });
3555
3659
  exposeFormat('combine', function () { return requireCombine(); });
3556
3660
  exposeFormat('colorize', function () { return requireColorize(); });
@@ -3627,288 +3731,246 @@ var winstonTransport = {exports: {}};
3627
3731
 
3628
3732
  var modern = {exports: {}};
3629
3733
 
3630
- var node$1;
3631
- var hasRequiredNode;
3734
+ /**
3735
+ * For Node.js, simply re-export the core `util.deprecate` function.
3736
+ */
3632
3737
 
3633
- function requireNode () {
3634
- if (hasRequiredNode) return node$1;
3635
- hasRequiredNode = 1;
3636
- /**
3637
- * For Node.js, simply re-export the core `util.deprecate` function.
3638
- */
3738
+ var node$1 = require$$0$2.deprecate;
3739
+
3740
+ var stream$1 = require$$0$3;
3741
+
3742
+ // undocumented cb() API, needed for core, not for public API
3743
+ function destroy(err, cb) {
3744
+ var _this = this;
3745
+ var readableDestroyed = this._readableState && this._readableState.destroyed;
3746
+ var writableDestroyed = this._writableState && this._writableState.destroyed;
3747
+ if (readableDestroyed || writableDestroyed) {
3748
+ if (cb) {
3749
+ cb(err);
3750
+ } else if (err) {
3751
+ if (!this._writableState) {
3752
+ process.nextTick(emitErrorNT, this, err);
3753
+ } else if (!this._writableState.errorEmitted) {
3754
+ this._writableState.errorEmitted = true;
3755
+ process.nextTick(emitErrorNT, this, err);
3756
+ }
3757
+ }
3758
+ return this;
3759
+ }
3639
3760
 
3640
- node$1 = require$$0$2.deprecate;
3641
- return node$1;
3642
- }
3761
+ // we set destroyed to true before firing error callbacks in order
3762
+ // to make it re-entrance safe in case destroy() is called within callbacks
3643
3763
 
3644
- var stream$1;
3645
- var hasRequiredStream$1;
3764
+ if (this._readableState) {
3765
+ this._readableState.destroyed = true;
3766
+ }
3646
3767
 
3647
- function requireStream$1 () {
3648
- if (hasRequiredStream$1) return stream$1;
3649
- hasRequiredStream$1 = 1;
3650
- stream$1 = require$$0$3;
3651
- return stream$1;
3768
+ // if this is a duplex stream mark the writable part as destroyed as well
3769
+ if (this._writableState) {
3770
+ this._writableState.destroyed = true;
3771
+ }
3772
+ this._destroy(err || null, function (err) {
3773
+ if (!cb && err) {
3774
+ if (!_this._writableState) {
3775
+ process.nextTick(emitErrorAndCloseNT, _this, err);
3776
+ } else if (!_this._writableState.errorEmitted) {
3777
+ _this._writableState.errorEmitted = true;
3778
+ process.nextTick(emitErrorAndCloseNT, _this, err);
3779
+ } else {
3780
+ process.nextTick(emitCloseNT, _this);
3781
+ }
3782
+ } else if (cb) {
3783
+ process.nextTick(emitCloseNT, _this);
3784
+ cb(err);
3785
+ } else {
3786
+ process.nextTick(emitCloseNT, _this);
3787
+ }
3788
+ });
3789
+ return this;
3652
3790
  }
3653
-
3654
- var destroy_1;
3655
- var hasRequiredDestroy;
3656
-
3657
- function requireDestroy () {
3658
- if (hasRequiredDestroy) return destroy_1;
3659
- hasRequiredDestroy = 1;
3660
-
3661
- // undocumented cb() API, needed for core, not for public API
3662
- function destroy(err, cb) {
3663
- var _this = this;
3664
- var readableDestroyed = this._readableState && this._readableState.destroyed;
3665
- var writableDestroyed = this._writableState && this._writableState.destroyed;
3666
- if (readableDestroyed || writableDestroyed) {
3667
- if (cb) {
3668
- cb(err);
3669
- } else if (err) {
3670
- if (!this._writableState) {
3671
- process.nextTick(emitErrorNT, this, err);
3672
- } else if (!this._writableState.errorEmitted) {
3673
- this._writableState.errorEmitted = true;
3674
- process.nextTick(emitErrorNT, this, err);
3675
- }
3676
- }
3677
- return this;
3678
- }
3679
-
3680
- // we set destroyed to true before firing error callbacks in order
3681
- // to make it re-entrance safe in case destroy() is called within callbacks
3682
-
3683
- if (this._readableState) {
3684
- this._readableState.destroyed = true;
3685
- }
3686
-
3687
- // if this is a duplex stream mark the writable part as destroyed as well
3688
- if (this._writableState) {
3689
- this._writableState.destroyed = true;
3690
- }
3691
- this._destroy(err || null, function (err) {
3692
- if (!cb && err) {
3693
- if (!_this._writableState) {
3694
- process.nextTick(emitErrorAndCloseNT, _this, err);
3695
- } else if (!_this._writableState.errorEmitted) {
3696
- _this._writableState.errorEmitted = true;
3697
- process.nextTick(emitErrorAndCloseNT, _this, err);
3698
- } else {
3699
- process.nextTick(emitCloseNT, _this);
3700
- }
3701
- } else if (cb) {
3702
- process.nextTick(emitCloseNT, _this);
3703
- cb(err);
3704
- } else {
3705
- process.nextTick(emitCloseNT, _this);
3706
- }
3707
- });
3708
- return this;
3709
- }
3710
- function emitErrorAndCloseNT(self, err) {
3711
- emitErrorNT(self, err);
3712
- emitCloseNT(self);
3713
- }
3714
- function emitCloseNT(self) {
3715
- if (self._writableState && !self._writableState.emitClose) return;
3716
- if (self._readableState && !self._readableState.emitClose) return;
3717
- self.emit('close');
3718
- }
3719
- function undestroy() {
3720
- if (this._readableState) {
3721
- this._readableState.destroyed = false;
3722
- this._readableState.reading = false;
3723
- this._readableState.ended = false;
3724
- this._readableState.endEmitted = false;
3725
- }
3726
- if (this._writableState) {
3727
- this._writableState.destroyed = false;
3728
- this._writableState.ended = false;
3729
- this._writableState.ending = false;
3730
- this._writableState.finalCalled = false;
3731
- this._writableState.prefinished = false;
3732
- this._writableState.finished = false;
3733
- this._writableState.errorEmitted = false;
3734
- }
3735
- }
3736
- function emitErrorNT(self, err) {
3737
- self.emit('error', err);
3738
- }
3739
- function errorOrDestroy(stream, err) {
3740
- // We have tests that rely on errors being emitted
3741
- // in the same tick, so changing this is semver major.
3742
- // For now when you opt-in to autoDestroy we allow
3743
- // the error to be emitted nextTick. In a future
3744
- // semver major update we should change the default to this.
3745
-
3746
- var rState = stream._readableState;
3747
- var wState = stream._writableState;
3748
- if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
3749
- }
3750
- destroy_1 = {
3751
- destroy: destroy,
3752
- undestroy: undestroy,
3753
- errorOrDestroy: errorOrDestroy
3754
- };
3755
- return destroy_1;
3791
+ function emitErrorAndCloseNT(self, err) {
3792
+ emitErrorNT(self, err);
3793
+ emitCloseNT(self);
3794
+ }
3795
+ function emitCloseNT(self) {
3796
+ if (self._writableState && !self._writableState.emitClose) return;
3797
+ if (self._readableState && !self._readableState.emitClose) return;
3798
+ self.emit('close');
3799
+ }
3800
+ function undestroy() {
3801
+ if (this._readableState) {
3802
+ this._readableState.destroyed = false;
3803
+ this._readableState.reading = false;
3804
+ this._readableState.ended = false;
3805
+ this._readableState.endEmitted = false;
3806
+ }
3807
+ if (this._writableState) {
3808
+ this._writableState.destroyed = false;
3809
+ this._writableState.ended = false;
3810
+ this._writableState.ending = false;
3811
+ this._writableState.finalCalled = false;
3812
+ this._writableState.prefinished = false;
3813
+ this._writableState.finished = false;
3814
+ this._writableState.errorEmitted = false;
3815
+ }
3756
3816
  }
3817
+ function emitErrorNT(self, err) {
3818
+ self.emit('error', err);
3819
+ }
3820
+ function errorOrDestroy(stream, err) {
3821
+ // We have tests that rely on errors being emitted
3822
+ // in the same tick, so changing this is semver major.
3823
+ // For now when you opt-in to autoDestroy we allow
3824
+ // the error to be emitted nextTick. In a future
3825
+ // semver major update we should change the default to this.
3826
+
3827
+ var rState = stream._readableState;
3828
+ var wState = stream._writableState;
3829
+ if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
3830
+ }
3831
+ var destroy_1 = {
3832
+ destroy: destroy,
3833
+ undestroy: undestroy,
3834
+ errorOrDestroy: errorOrDestroy
3835
+ };
3757
3836
 
3758
3837
  var errors = {};
3759
3838
 
3760
- var hasRequiredErrors;
3761
-
3762
- function requireErrors () {
3763
- if (hasRequiredErrors) return errors;
3764
- hasRequiredErrors = 1;
3765
-
3766
- const codes = {};
3767
-
3768
- function createErrorType(code, message, Base) {
3769
- if (!Base) {
3770
- Base = Error;
3771
- }
3772
-
3773
- function getMessage (arg1, arg2, arg3) {
3774
- if (typeof message === 'string') {
3775
- return message
3776
- } else {
3777
- return message(arg1, arg2, arg3)
3778
- }
3779
- }
3839
+ const codes = {};
3780
3840
 
3781
- class NodeError extends Base {
3782
- constructor (arg1, arg2, arg3) {
3783
- super(getMessage(arg1, arg2, arg3));
3784
- }
3785
- }
3841
+ function createErrorType(code, message, Base) {
3842
+ if (!Base) {
3843
+ Base = Error;
3844
+ }
3786
3845
 
3787
- NodeError.prototype.name = Base.name;
3788
- NodeError.prototype.code = code;
3846
+ function getMessage (arg1, arg2, arg3) {
3847
+ if (typeof message === 'string') {
3848
+ return message
3849
+ } else {
3850
+ return message(arg1, arg2, arg3)
3851
+ }
3852
+ }
3789
3853
 
3790
- codes[code] = NodeError;
3791
- }
3854
+ class NodeError extends Base {
3855
+ constructor (arg1, arg2, arg3) {
3856
+ super(getMessage(arg1, arg2, arg3));
3857
+ }
3858
+ }
3792
3859
 
3793
- // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
3794
- function oneOf(expected, thing) {
3795
- if (Array.isArray(expected)) {
3796
- const len = expected.length;
3797
- expected = expected.map((i) => String(i));
3798
- if (len > 2) {
3799
- return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
3800
- expected[len - 1];
3801
- } else if (len === 2) {
3802
- return `one of ${thing} ${expected[0]} or ${expected[1]}`;
3803
- } else {
3804
- return `of ${thing} ${expected[0]}`;
3805
- }
3806
- } else {
3807
- return `of ${thing} ${String(expected)}`;
3808
- }
3809
- }
3860
+ NodeError.prototype.name = Base.name;
3861
+ NodeError.prototype.code = code;
3810
3862
 
3811
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
3812
- function startsWith(str, search, pos) {
3813
- return str.substr(0 , search.length) === search;
3814
- }
3863
+ codes[code] = NodeError;
3864
+ }
3815
3865
 
3816
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
3817
- function endsWith(str, search, this_len) {
3818
- if (this_len === undefined || this_len > str.length) {
3819
- this_len = str.length;
3820
- }
3821
- return str.substring(this_len - search.length, this_len) === search;
3822
- }
3866
+ // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
3867
+ function oneOf(expected, thing) {
3868
+ if (Array.isArray(expected)) {
3869
+ const len = expected.length;
3870
+ expected = expected.map((i) => String(i));
3871
+ if (len > 2) {
3872
+ return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
3873
+ expected[len - 1];
3874
+ } else if (len === 2) {
3875
+ return `one of ${thing} ${expected[0]} or ${expected[1]}`;
3876
+ } else {
3877
+ return `of ${thing} ${expected[0]}`;
3878
+ }
3879
+ } else {
3880
+ return `of ${thing} ${String(expected)}`;
3881
+ }
3882
+ }
3823
3883
 
3824
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
3825
- function includes(str, search, start) {
3826
- if (typeof start !== 'number') {
3827
- start = 0;
3828
- }
3884
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
3885
+ function startsWith(str, search, pos) {
3886
+ return str.substr(0 , search.length) === search;
3887
+ }
3829
3888
 
3830
- if (start + search.length > str.length) {
3831
- return false;
3832
- } else {
3833
- return str.indexOf(search, start) !== -1;
3834
- }
3889
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
3890
+ function endsWith(str, search, this_len) {
3891
+ if (this_len === undefined || this_len > str.length) {
3892
+ this_len = str.length;
3835
3893
  }
3894
+ return str.substring(this_len - search.length, this_len) === search;
3895
+ }
3836
3896
 
3837
- createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
3838
- return 'The value "' + value + '" is invalid for option "' + name + '"'
3839
- }, TypeError);
3840
- createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
3841
- // determiner: 'must be' or 'must not be'
3842
- let determiner;
3843
- if (typeof expected === 'string' && startsWith(expected, 'not ')) {
3844
- determiner = 'must not be';
3845
- expected = expected.replace(/^not /, '');
3846
- } else {
3847
- determiner = 'must be';
3848
- }
3849
-
3850
- let msg;
3851
- if (endsWith(name, ' argument')) {
3852
- // For cases like 'first argument'
3853
- msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
3854
- } else {
3855
- const type = includes(name, '.') ? 'property' : 'argument';
3856
- msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
3857
- }
3897
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
3898
+ function includes(str, search, start) {
3899
+ if (typeof start !== 'number') {
3900
+ start = 0;
3901
+ }
3858
3902
 
3859
- msg += `. Received type ${typeof actual}`;
3860
- return msg;
3861
- }, TypeError);
3862
- createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
3863
- createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
3864
- return 'The ' + name + ' method is not implemented'
3865
- });
3866
- createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
3867
- createErrorType('ERR_STREAM_DESTROYED', function (name) {
3868
- return 'Cannot call ' + name + ' after a stream was destroyed';
3869
- });
3870
- createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
3871
- createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
3872
- createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
3873
- createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
3874
- createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
3875
- return 'Unknown encoding: ' + arg
3876
- }, TypeError);
3877
- createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
3878
-
3879
- errors.codes = codes;
3880
- return errors;
3903
+ if (start + search.length > str.length) {
3904
+ return false;
3905
+ } else {
3906
+ return str.indexOf(search, start) !== -1;
3907
+ }
3881
3908
  }
3882
3909
 
3883
- var state;
3884
- var hasRequiredState;
3910
+ createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
3911
+ return 'The value "' + value + '" is invalid for option "' + name + '"'
3912
+ }, TypeError);
3913
+ createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
3914
+ // determiner: 'must be' or 'must not be'
3915
+ let determiner;
3916
+ if (typeof expected === 'string' && startsWith(expected, 'not ')) {
3917
+ determiner = 'must not be';
3918
+ expected = expected.replace(/^not /, '');
3919
+ } else {
3920
+ determiner = 'must be';
3921
+ }
3885
3922
 
3886
- function requireState () {
3887
- if (hasRequiredState) return state;
3888
- hasRequiredState = 1;
3923
+ let msg;
3924
+ if (endsWith(name, ' argument')) {
3925
+ // For cases like 'first argument'
3926
+ msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
3927
+ } else {
3928
+ const type = includes(name, '.') ? 'property' : 'argument';
3929
+ msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
3930
+ }
3889
3931
 
3890
- var ERR_INVALID_OPT_VALUE = requireErrors().codes.ERR_INVALID_OPT_VALUE;
3891
- function highWaterMarkFrom(options, isDuplex, duplexKey) {
3892
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
3893
- }
3894
- function getHighWaterMark(state, options, duplexKey, isDuplex) {
3895
- var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
3896
- if (hwm != null) {
3897
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
3898
- var name = isDuplex ? duplexKey : 'highWaterMark';
3899
- throw new ERR_INVALID_OPT_VALUE(name, hwm);
3900
- }
3901
- return Math.floor(hwm);
3902
- }
3932
+ msg += `. Received type ${typeof actual}`;
3933
+ return msg;
3934
+ }, TypeError);
3935
+ createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
3936
+ createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
3937
+ return 'The ' + name + ' method is not implemented'
3938
+ });
3939
+ createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
3940
+ createErrorType('ERR_STREAM_DESTROYED', function (name) {
3941
+ return 'Cannot call ' + name + ' after a stream was destroyed';
3942
+ });
3943
+ createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
3944
+ createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
3945
+ createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
3946
+ createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
3947
+ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
3948
+ return 'Unknown encoding: ' + arg
3949
+ }, TypeError);
3950
+ createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
3951
+
3952
+ errors.codes = codes;
3953
+
3954
+ var ERR_INVALID_OPT_VALUE = errors.codes.ERR_INVALID_OPT_VALUE;
3955
+ function highWaterMarkFrom(options, isDuplex, duplexKey) {
3956
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
3957
+ }
3958
+ function getHighWaterMark(state, options, duplexKey, isDuplex) {
3959
+ var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
3960
+ if (hwm != null) {
3961
+ if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
3962
+ var name = isDuplex ? duplexKey : 'highWaterMark';
3963
+ throw new ERR_INVALID_OPT_VALUE(name, hwm);
3964
+ }
3965
+ return Math.floor(hwm);
3966
+ }
3903
3967
 
3904
- // Default value
3905
- return state.objectMode ? 16 : 16 * 1024;
3906
- }
3907
- state = {
3908
- getHighWaterMark: getHighWaterMark
3909
- };
3910
- return state;
3968
+ // Default value
3969
+ return state.objectMode ? 16 : 16 * 1024;
3911
3970
  }
3971
+ var state = {
3972
+ getHighWaterMark: getHighWaterMark
3973
+ };
3912
3974
 
3913
3975
  var inherits = {exports: {}};
3914
3976
 
@@ -3949,23 +4011,18 @@ function requireInherits_browser () {
3949
4011
  return inherits_browser.exports;
3950
4012
  }
3951
4013
 
3952
- var hasRequiredInherits;
3953
-
3954
- function requireInherits () {
3955
- if (hasRequiredInherits) return inherits.exports;
3956
- hasRequiredInherits = 1;
3957
- try {
3958
- var util = require('util');
3959
- /* istanbul ignore next */
3960
- if (typeof util.inherits !== 'function') throw '';
3961
- inherits.exports = util.inherits;
3962
- } catch (e) {
3963
- /* istanbul ignore next */
3964
- inherits.exports = requireInherits_browser();
3965
- }
3966
- return inherits.exports;
4014
+ try {
4015
+ var util$2 = require('util');
4016
+ /* istanbul ignore next */
4017
+ if (typeof util$2.inherits !== 'function') throw '';
4018
+ inherits.exports = util$2.inherits;
4019
+ } catch (e) {
4020
+ /* istanbul ignore next */
4021
+ inherits.exports = requireInherits_browser();
3967
4022
  }
3968
4023
 
4024
+ var inheritsExports = inherits.exports;
4025
+
3969
4026
  var buffer_list;
3970
4027
  var hasRequiredBuffer_list;
3971
4028
 
@@ -4525,7 +4582,7 @@ function requireEndOfStream () {
4525
4582
  if (hasRequiredEndOfStream) return endOfStream;
4526
4583
  hasRequiredEndOfStream = 1;
4527
4584
 
4528
- var ERR_STREAM_PREMATURE_CLOSE = requireErrors().codes.ERR_STREAM_PREMATURE_CLOSE;
4585
+ var ERR_STREAM_PREMATURE_CLOSE = errors.codes.ERR_STREAM_PREMATURE_CLOSE;
4529
4586
  function once(callback) {
4530
4587
  var called = false;
4531
4588
  return function () {
@@ -4811,7 +4868,7 @@ function requireFrom () {
4811
4868
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4812
4869
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4813
4870
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4814
- var ERR_INVALID_ARG_TYPE = requireErrors().codes.ERR_INVALID_ARG_TYPE;
4871
+ var ERR_INVALID_ARG_TYPE = errors.codes.ERR_INVALID_ARG_TYPE;
4815
4872
  function from(Readable, iterable, opts) {
4816
4873
  var iterator;
4817
4874
  if (iterable && typeof iterable.next === 'function') {
@@ -4880,7 +4937,7 @@ function require_stream_readable () {
4880
4937
  /*</replacement>*/
4881
4938
 
4882
4939
  /*<replacement>*/
4883
- var Stream = requireStream$1();
4940
+ var Stream = stream$1;
4884
4941
  /*</replacement>*/
4885
4942
 
4886
4943
  var Buffer = require$$0$4.Buffer;
@@ -4903,10 +4960,10 @@ function require_stream_readable () {
4903
4960
  /*</replacement>*/
4904
4961
 
4905
4962
  var BufferList = requireBuffer_list();
4906
- var destroyImpl = requireDestroy();
4907
- var _require = requireState(),
4963
+ var destroyImpl = destroy_1;
4964
+ var _require = state,
4908
4965
  getHighWaterMark = _require.getHighWaterMark;
4909
- var _require$codes = requireErrors().codes,
4966
+ var _require$codes = errors.codes,
4910
4967
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
4911
4968
  ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
4912
4969
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
@@ -4916,7 +4973,7 @@ function require_stream_readable () {
4916
4973
  var StringDecoder;
4917
4974
  var createReadableStreamAsyncIterator;
4918
4975
  var from;
4919
- requireInherits()(Readable, Stream);
4976
+ inheritsExports(Readable, Stream);
4920
4977
  var errorOrDestroy = destroyImpl.errorOrDestroy;
4921
4978
  var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
4922
4979
  function prependListener(emitter, event, fn) {
@@ -5889,7 +5946,7 @@ function require_stream_duplex () {
5889
5946
  _stream_duplex = Duplex;
5890
5947
  var Readable = require_stream_readable();
5891
5948
  var Writable = require_stream_writable();
5892
- requireInherits()(Duplex, Readable);
5949
+ inheritsExports(Duplex, Readable);
5893
5950
  {
5894
5951
  // Allow the keys array to be GC'ed.
5895
5952
  var keys = objectKeys(Writable.prototype);
@@ -6008,12 +6065,12 @@ function require_stream_writable () {
6008
6065
 
6009
6066
  /*<replacement>*/
6010
6067
  var internalUtil = {
6011
- deprecate: requireNode()
6068
+ deprecate: node$1
6012
6069
  };
6013
6070
  /*</replacement>*/
6014
6071
 
6015
6072
  /*<replacement>*/
6016
- var Stream = requireStream$1();
6073
+ var Stream = stream$1;
6017
6074
  /*</replacement>*/
6018
6075
 
6019
6076
  var Buffer = require$$0$4.Buffer;
@@ -6024,10 +6081,10 @@ function require_stream_writable () {
6024
6081
  function _isUint8Array(obj) {
6025
6082
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
6026
6083
  }
6027
- var destroyImpl = requireDestroy();
6028
- var _require = requireState(),
6084
+ var destroyImpl = destroy_1;
6085
+ var _require = state,
6029
6086
  getHighWaterMark = _require.getHighWaterMark;
6030
- var _require$codes = requireErrors().codes,
6087
+ var _require$codes = errors.codes,
6031
6088
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
6032
6089
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
6033
6090
  ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
@@ -6037,7 +6094,7 @@ function require_stream_writable () {
6037
6094
  ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
6038
6095
  ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
6039
6096
  var errorOrDestroy = destroyImpl.errorOrDestroy;
6040
- requireInherits()(Writable, Stream);
6097
+ inheritsExports(Writable, Stream);
6041
6098
  function nop() {}
6042
6099
  function WritableState(options, stream, isDuplex) {
6043
6100
  Duplex = Duplex || require_stream_duplex();
@@ -8013,13 +8070,13 @@ function require_stream_transform () {
8013
8070
  hasRequired_stream_transform = 1;
8014
8071
 
8015
8072
  _stream_transform = Transform;
8016
- var _require$codes = requireErrors().codes,
8073
+ var _require$codes = errors.codes,
8017
8074
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
8018
8075
  ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
8019
8076
  ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
8020
8077
  ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
8021
8078
  var Duplex = require_stream_duplex();
8022
- requireInherits()(Transform, Duplex);
8079
+ inheritsExports(Transform, Duplex);
8023
8080
  function afterTransform(er, data) {
8024
8081
  var ts = this._transformState;
8025
8082
  ts.transforming = false;
@@ -8149,7 +8206,7 @@ function require_stream_passthrough () {
8149
8206
 
8150
8207
  _stream_passthrough = PassThrough;
8151
8208
  var Transform = require_stream_transform();
8152
- requireInherits()(PassThrough, Transform);
8209
+ inheritsExports(PassThrough, Transform);
8153
8210
  function PassThrough(options) {
8154
8211
  if (!(this instanceof PassThrough)) return new PassThrough(options);
8155
8212
  Transform.call(this, options);
@@ -8176,7 +8233,7 @@ function requirePipeline () {
8176
8233
  callback.apply(void 0, arguments);
8177
8234
  };
8178
8235
  }
8179
- var _require$codes = requireErrors().codes,
8236
+ var _require$codes = errors.codes,
8180
8237
  ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
8181
8238
  ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
8182
8239
  function noop(err) {
@@ -10951,7 +11008,7 @@ function requireTailFile () {
10951
11008
  if (hasRequiredTailFile) return tailFile;
10952
11009
  hasRequiredTailFile = 1;
10953
11010
 
10954
- const fs = require$$0$6;
11011
+ const fs$1 = fs;
10955
11012
  const { StringDecoder } = require$$1$1;
10956
11013
  const { Stream } = readableExports;
10957
11014
 
@@ -10987,7 +11044,7 @@ function requireTailFile () {
10987
11044
  stream.emit('close');
10988
11045
  };
10989
11046
 
10990
- fs.open(options.file, 'a+', '0644', (err, fd) => {
11047
+ fs$1.open(options.file, 'a+', '0644', (err, fd) => {
10991
11048
  if (err) {
10992
11049
  if (!iter) {
10993
11050
  stream.emit('error', err);
@@ -11000,11 +11057,11 @@ function requireTailFile () {
11000
11057
 
11001
11058
  (function read() {
11002
11059
  if (stream.destroyed) {
11003
- fs.close(fd, noop);
11060
+ fs$1.close(fd, noop);
11004
11061
  return;
11005
11062
  }
11006
11063
 
11007
- return fs.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
11064
+ return fs$1.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
11008
11065
  if (error) {
11009
11066
  if (!iter) {
11010
11067
  stream.emit('error', error);
@@ -11078,8 +11135,8 @@ function requireFile () {
11078
11135
  if (hasRequiredFile) return file;
11079
11136
  hasRequiredFile = 1;
11080
11137
 
11081
- const fs = require$$0$6;
11082
- const path = require$$1$2;
11138
+ const fs$1 = fs;
11139
+ const path$1 = path;
11083
11140
  const asyncSeries = requireSeries();
11084
11141
  const zlib = require$$3;
11085
11142
  const { MESSAGE } = tripleBeam;
@@ -11126,17 +11183,17 @@ function requireFile () {
11126
11183
  if (options.filename || options.dirname) {
11127
11184
  throwIf('filename or dirname', 'stream');
11128
11185
  this._basename = this.filename = options.filename
11129
- ? path.basename(options.filename)
11186
+ ? path$1.basename(options.filename)
11130
11187
  : 'winston.log';
11131
11188
 
11132
- this.dirname = options.dirname || path.dirname(options.filename);
11189
+ this.dirname = options.dirname || path$1.dirname(options.filename);
11133
11190
  this.options = options.options || { flags: 'a' };
11134
11191
  } else if (options.stream) {
11135
11192
  // eslint-disable-next-line no-console
11136
11193
  console.warn('options.stream will be removed in winston@4. Use winston.transports.Stream');
11137
11194
  throwIf('stream', 'filename', 'maxsize');
11138
11195
  this._dest = this._stream.pipe(this._setupStream(options.stream));
11139
- this.dirname = path.dirname(this._dest.path);
11196
+ this.dirname = path$1.dirname(this._dest.path);
11140
11197
  // We need to listen for drain events when write() returns false. This
11141
11198
  // can make node mad at times.
11142
11199
  } else {
@@ -11352,12 +11409,12 @@ function requireFile () {
11352
11409
  }
11353
11410
 
11354
11411
  options = normalizeQuery(options);
11355
- const file = path.join(this.dirname, this.filename);
11412
+ const file = path$1.join(this.dirname, this.filename);
11356
11413
  let buff = '';
11357
11414
  let results = [];
11358
11415
  let row = 0;
11359
11416
 
11360
- const stream = fs.createReadStream(file, {
11417
+ const stream = fs$1.createReadStream(file, {
11361
11418
  encoding: 'utf8'
11362
11419
  });
11363
11420
 
@@ -11495,7 +11552,7 @@ function requireFile () {
11495
11552
  * TODO: Refactor me.
11496
11553
  */
11497
11554
  stream(options = {}) {
11498
- const file = path.join(this.dirname, this.filename);
11555
+ const file = path$1.join(this.dirname, this.filename);
11499
11556
  const stream = new Stream();
11500
11557
  const tail = {
11501
11558
  file,
@@ -11555,9 +11612,9 @@ function requireFile () {
11555
11612
  */
11556
11613
  stat(callback) {
11557
11614
  const target = this._getFile();
11558
- const fullpath = path.join(this.dirname, target);
11615
+ const fullpath = path$1.join(this.dirname, target);
11559
11616
 
11560
- fs.stat(fullpath, (err, stat) => {
11617
+ fs$1.stat(fullpath, (err, stat) => {
11561
11618
  if (err && err.code === 'ENOENT') {
11562
11619
  debug('ENOENT ok', fullpath);
11563
11620
  // Update internally tracked filename with the new target name.
@@ -11677,10 +11734,10 @@ function requireFile () {
11677
11734
  * @returns {WritableStream} Stream that writes to disk for the active file.
11678
11735
  */
11679
11736
  _createStream(source) {
11680
- const fullpath = path.join(this.dirname, this.filename);
11737
+ const fullpath = path$1.join(this.dirname, this.filename);
11681
11738
 
11682
11739
  debug('create stream start', fullpath, this.options);
11683
- const dest = fs.createWriteStream(fullpath, this.options)
11740
+ const dest = fs$1.createWriteStream(fullpath, this.options)
11684
11741
  // TODO: What should we do with errors here?
11685
11742
  .on('error', err => debug(err))
11686
11743
  .on('close', () => debug('close', dest.path, dest.bytesWritten))
@@ -11713,8 +11770,8 @@ function requireFile () {
11713
11770
  */
11714
11771
  _incFile(callback) {
11715
11772
  debug('_incFile', this.filename);
11716
- const ext = path.extname(this._basename);
11717
- const basename = path.basename(this._basename, ext);
11773
+ const ext = path$1.extname(this._basename);
11774
+ const basename = path$1.basename(this._basename, ext);
11718
11775
  const tasks = [];
11719
11776
 
11720
11777
  if (this.zippedArchive) {
@@ -11722,8 +11779,8 @@ function requireFile () {
11722
11779
  function (cb) {
11723
11780
  const num = this._created > 0 && !this.tailable ? this._created : '';
11724
11781
  this._compressFile(
11725
- path.join(this.dirname, `${basename}${num}${ext}`),
11726
- path.join(this.dirname, `${basename}${num}${ext}.gz`),
11782
+ path$1.join(this.dirname, `${basename}${num}${ext}`),
11783
+ path$1.join(this.dirname, `${basename}${num}${ext}.gz`),
11727
11784
  cb
11728
11785
  );
11729
11786
  }.bind(this)
@@ -11751,8 +11808,8 @@ function requireFile () {
11751
11808
  * @private
11752
11809
  */
11753
11810
  _getFile() {
11754
- const ext = path.extname(this._basename);
11755
- const basename = path.basename(this._basename, ext);
11811
+ const ext = path$1.extname(this._basename);
11812
+ const basename = path$1.basename(this._basename, ext);
11756
11813
  const isRotation = this.rotationFormat
11757
11814
  ? this.rotationFormat()
11758
11815
  : this._created;
@@ -11783,9 +11840,9 @@ function requireFile () {
11783
11840
  const isOldest = oldest !== 0 ? oldest : '';
11784
11841
  const isZipped = this.zippedArchive ? '.gz' : '';
11785
11842
  const filePath = `${basename}${isOldest}${ext}${isZipped}`;
11786
- const target = path.join(this.dirname, filePath);
11843
+ const target = path$1.join(this.dirname, filePath);
11787
11844
 
11788
- fs.unlink(target, callback);
11845
+ fs$1.unlink(target, callback);
11789
11846
  }
11790
11847
 
11791
11848
  /**
@@ -11810,23 +11867,23 @@ function requireFile () {
11810
11867
  for (let x = this.maxFiles - 1; x > 1; x--) {
11811
11868
  tasks.push(function (i, cb) {
11812
11869
  let fileName = `${basename}${(i - 1)}${ext}${isZipped}`;
11813
- const tmppath = path.join(this.dirname, fileName);
11870
+ const tmppath = path$1.join(this.dirname, fileName);
11814
11871
 
11815
- fs.exists(tmppath, exists => {
11872
+ fs$1.exists(tmppath, exists => {
11816
11873
  if (!exists) {
11817
11874
  return cb(null);
11818
11875
  }
11819
11876
 
11820
11877
  fileName = `${basename}${i}${ext}${isZipped}`;
11821
- fs.rename(tmppath, path.join(this.dirname, fileName), cb);
11878
+ fs$1.rename(tmppath, path$1.join(this.dirname, fileName), cb);
11822
11879
  });
11823
11880
  }.bind(this, x));
11824
11881
  }
11825
11882
 
11826
11883
  asyncSeries(tasks, () => {
11827
- fs.rename(
11828
- path.join(this.dirname, `${basename}${ext}${isZipped}`),
11829
- path.join(this.dirname, `${basename}1${ext}${isZipped}`),
11884
+ fs$1.rename(
11885
+ path$1.join(this.dirname, `${basename}${ext}${isZipped}`),
11886
+ path$1.join(this.dirname, `${basename}1${ext}${isZipped}`),
11830
11887
  callback
11831
11888
  );
11832
11889
  });
@@ -11841,15 +11898,15 @@ function requireFile () {
11841
11898
  * @private
11842
11899
  */
11843
11900
  _compressFile(src, dest, callback) {
11844
- fs.access(src, fs.F_OK, (err) => {
11901
+ fs$1.access(src, fs$1.F_OK, (err) => {
11845
11902
  if (err) {
11846
11903
  return callback();
11847
11904
  }
11848
11905
  var gzip = zlib.createGzip();
11849
- var inp = fs.createReadStream(src);
11850
- var out = fs.createWriteStream(dest);
11906
+ var inp = fs$1.createReadStream(src);
11907
+ var out = fs$1.createWriteStream(dest);
11851
11908
  out.on('finish', () => {
11852
- fs.unlink(src, callback);
11909
+ fs$1.unlink(src, callback);
11853
11910
  });
11854
11911
  inp.pipe(gzip).pipe(out);
11855
11912
  });
@@ -11857,8 +11914,8 @@ function requireFile () {
11857
11914
 
11858
11915
  _createLogDirIfNotExist(dirPath) {
11859
11916
  /* eslint-disable no-sync */
11860
- if (!fs.existsSync(dirPath)) {
11861
- fs.mkdirSync(dirPath, { recursive: true });
11917
+ if (!fs$1.existsSync(dirPath)) {
11918
+ fs$1.mkdirSync(dirPath, { recursive: true });
11862
11919
  }
11863
11920
  /* eslint-enable no-sync */
11864
11921
  }
@@ -11880,8 +11937,8 @@ function requireHttp () {
11880
11937
  if (hasRequiredHttp) return http_1;
11881
11938
  hasRequiredHttp = 1;
11882
11939
 
11883
- const http = require$$0$7;
11884
- const https = require$$1$3;
11940
+ const http = require$$0$6;
11941
+ const https = require$$1$2;
11885
11942
  const { Stream } = readableExports;
11886
11943
  const TransportStream = winstonTransportExports;
11887
11944
  const { configure } = requireSafeStableStringify();