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