@putkoff/abstract-logger 0.0.48 → 0.0.50

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 */
@@ -42,7 +42,7 @@ function resolveValue(...values) {
42
42
  }
43
43
  return sawInput ? "unknown" : "unknown";
44
44
  }
45
- function parseList(value) {
45
+ function parseList$1(value) {
46
46
  return value
47
47
  ? value.split(",").map(s => s.trim()).filter(Boolean)
48
48
  : [];
@@ -184,45 +184,140 @@ const COLS = {
184
184
  file: 16,
185
185
  };
186
186
 
187
- /* ------------------------------------------------------------------ */
188
- /* Winston logger (Node only) */
189
- /* ------------------------------------------------------------------ */
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
+
291
+ function parseList(key) {
292
+ const v = getEnvValue({ key });
293
+ return v ? v.split(",").map(s => s.trim()).filter(Boolean) : [];
294
+ }
190
295
  function getLogConfig() {
191
296
  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
199
- // 👇 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())
203
- : [],
204
- functionAllowlist: process.env.LOG_FUNCTION_ALLOWLIST
205
- ? process.env.LOG_FUNCTION_ALLOWLIST.split(",").map(s => s.trim())
206
- : [],
207
- functionBlocklist: process.env.LOG_FUNCTION_BLOCKLIST
208
- ? process.env.LOG_FUNCTION_BLOCKLIST.split(",").map(s => s.trim())
209
- : [],
297
+ condensed: getEnvValue({ key: "LOG_CONDENSED" }) !== "false",
298
+ expandOnDebug: getEnvValue({ key: "LOG_EXPAND_DEBUG" }) !== "false",
299
+ showDetails: getEnvValue({ key: "LOG_SHOW_DETAILS" }) !== "false",
300
+ maxDetailsLength: Number(getEnvValue({ key: "LOG_DETAILS_MAX" }) ?? 500),
301
+ sampleRate: Number(getEnvValue({ key: "LOG_SAMPLE_RATE" }) ?? 1),
302
+ prettyDetails: getEnvValue({ key: "LOG_PRETTY_DETAILS" }) === "true",
303
+ activityBlocklist: parseList("LOG_ACTIVITY_BLOCKLIST"),
304
+ logTypeBlocklist: parseList("LOG_TYPE_BLOCKLIST"),
305
+ showDetailslist: parseList("LOG_DETAILS_ALLOWLIST"),
306
+ functionAllowlist: parseList("LOG_FUNCTION_ALLOWLIST"),
307
+ functionBlocklist: parseList("LOG_FUNCTION_BLOCKLIST"),
210
308
  };
211
309
  }
212
310
  function debugLogConfig() {
213
- if (process.env.LOG_DEBUG_CONFIG === "true") {
311
+ if (getEnvValue({ key: "LOG_DEBUG_CONFIG" }) === "true") {
214
312
  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,
313
+ LOG_SHOW_DETAILS: getEnvValue({ key: "LOG_SHOW_DETAILS" }),
314
+ LOG_DETAILS_ALLOWLIST: getEnvValue({ key: "LOG_DETAILS_ALLOWLIST" }),
315
+ LOG_PRETTY_DETAILS: getEnvValue({ key: "LOG_PRETTY_DETAILS" }),
316
+ LOG_CONDENSED: getEnvValue({ key: "LOG_CONDENSED" }),
317
+ LOG_EXPAND_DEBUG: getEnvValue({ key: "LOG_EXPAND_DEBUG" }),
220
318
  });
221
319
  }
222
320
  }
223
- function parse$1(v) {
224
- return v ? v.split(",").map(s => s.trim()) : [];
225
- }
226
321
 
227
322
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
228
323
 
@@ -1496,11 +1591,11 @@ function requireAlign () {
1496
1591
  /* eslint no-undefined: 0 */
1497
1592
 
1498
1593
  var errors$1;
1499
- var hasRequiredErrors$1;
1594
+ var hasRequiredErrors;
1500
1595
 
1501
- function requireErrors$1 () {
1502
- if (hasRequiredErrors$1) return errors$1;
1503
- hasRequiredErrors$1 = 1;
1596
+ function requireErrors () {
1597
+ if (hasRequiredErrors) return errors$1;
1598
+ hasRequiredErrors = 1;
1504
1599
 
1505
1600
  const format = format$2;
1506
1601
  const { LEVEL, MESSAGE } = tripleBeam;
@@ -3550,7 +3645,7 @@ function exposeFormat(name, requireFormat) {
3550
3645
  // Setup all transports as lazy-loaded getters.
3551
3646
  //
3552
3647
  exposeFormat('align', function () { return requireAlign(); });
3553
- exposeFormat('errors', function () { return requireErrors$1(); });
3648
+ exposeFormat('errors', function () { return requireErrors(); });
3554
3649
  exposeFormat('cli', function () { return requireCli(); });
3555
3650
  exposeFormat('combine', function () { return requireCombine(); });
3556
3651
  exposeFormat('colorize', function () { return requireColorize(); });
@@ -3627,288 +3722,246 @@ var winstonTransport = {exports: {}};
3627
3722
 
3628
3723
  var modern = {exports: {}};
3629
3724
 
3630
- var node$1;
3631
- var hasRequiredNode;
3725
+ /**
3726
+ * For Node.js, simply re-export the core `util.deprecate` function.
3727
+ */
3632
3728
 
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
- */
3729
+ var node$1 = require$$0$2.deprecate;
3730
+
3731
+ var stream$1 = require$$0$3;
3732
+
3733
+ // undocumented cb() API, needed for core, not for public API
3734
+ function destroy(err, cb) {
3735
+ var _this = this;
3736
+ var readableDestroyed = this._readableState && this._readableState.destroyed;
3737
+ var writableDestroyed = this._writableState && this._writableState.destroyed;
3738
+ if (readableDestroyed || writableDestroyed) {
3739
+ if (cb) {
3740
+ cb(err);
3741
+ } else if (err) {
3742
+ if (!this._writableState) {
3743
+ process.nextTick(emitErrorNT, this, err);
3744
+ } else if (!this._writableState.errorEmitted) {
3745
+ this._writableState.errorEmitted = true;
3746
+ process.nextTick(emitErrorNT, this, err);
3747
+ }
3748
+ }
3749
+ return this;
3750
+ }
3639
3751
 
3640
- node$1 = require$$0$2.deprecate;
3641
- return node$1;
3642
- }
3752
+ // we set destroyed to true before firing error callbacks in order
3753
+ // to make it re-entrance safe in case destroy() is called within callbacks
3643
3754
 
3644
- var stream$1;
3645
- var hasRequiredStream$1;
3755
+ if (this._readableState) {
3756
+ this._readableState.destroyed = true;
3757
+ }
3646
3758
 
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;
3759
+ // if this is a duplex stream mark the writable part as destroyed as well
3760
+ if (this._writableState) {
3761
+ this._writableState.destroyed = true;
3762
+ }
3763
+ this._destroy(err || null, function (err) {
3764
+ if (!cb && err) {
3765
+ if (!_this._writableState) {
3766
+ process.nextTick(emitErrorAndCloseNT, _this, err);
3767
+ } else if (!_this._writableState.errorEmitted) {
3768
+ _this._writableState.errorEmitted = true;
3769
+ process.nextTick(emitErrorAndCloseNT, _this, err);
3770
+ } else {
3771
+ process.nextTick(emitCloseNT, _this);
3772
+ }
3773
+ } else if (cb) {
3774
+ process.nextTick(emitCloseNT, _this);
3775
+ cb(err);
3776
+ } else {
3777
+ process.nextTick(emitCloseNT, _this);
3778
+ }
3779
+ });
3780
+ return this;
3652
3781
  }
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;
3782
+ function emitErrorAndCloseNT(self, err) {
3783
+ emitErrorNT(self, err);
3784
+ emitCloseNT(self);
3785
+ }
3786
+ function emitCloseNT(self) {
3787
+ if (self._writableState && !self._writableState.emitClose) return;
3788
+ if (self._readableState && !self._readableState.emitClose) return;
3789
+ self.emit('close');
3790
+ }
3791
+ function undestroy() {
3792
+ if (this._readableState) {
3793
+ this._readableState.destroyed = false;
3794
+ this._readableState.reading = false;
3795
+ this._readableState.ended = false;
3796
+ this._readableState.endEmitted = false;
3797
+ }
3798
+ if (this._writableState) {
3799
+ this._writableState.destroyed = false;
3800
+ this._writableState.ended = false;
3801
+ this._writableState.ending = false;
3802
+ this._writableState.finalCalled = false;
3803
+ this._writableState.prefinished = false;
3804
+ this._writableState.finished = false;
3805
+ this._writableState.errorEmitted = false;
3806
+ }
3807
+ }
3808
+ function emitErrorNT(self, err) {
3809
+ self.emit('error', err);
3756
3810
  }
3811
+ function errorOrDestroy(stream, err) {
3812
+ // We have tests that rely on errors being emitted
3813
+ // in the same tick, so changing this is semver major.
3814
+ // For now when you opt-in to autoDestroy we allow
3815
+ // the error to be emitted nextTick. In a future
3816
+ // semver major update we should change the default to this.
3817
+
3818
+ var rState = stream._readableState;
3819
+ var wState = stream._writableState;
3820
+ if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
3821
+ }
3822
+ var destroy_1 = {
3823
+ destroy: destroy,
3824
+ undestroy: undestroy,
3825
+ errorOrDestroy: errorOrDestroy
3826
+ };
3757
3827
 
3758
3828
  var errors = {};
3759
3829
 
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
- }
3830
+ const codes = {};
3772
3831
 
3773
- function getMessage (arg1, arg2, arg3) {
3774
- if (typeof message === 'string') {
3775
- return message
3776
- } else {
3777
- return message(arg1, arg2, arg3)
3778
- }
3779
- }
3780
-
3781
- class NodeError extends Base {
3782
- constructor (arg1, arg2, arg3) {
3783
- super(getMessage(arg1, arg2, arg3));
3784
- }
3785
- }
3832
+ function createErrorType(code, message, Base) {
3833
+ if (!Base) {
3834
+ Base = Error;
3835
+ }
3786
3836
 
3787
- NodeError.prototype.name = Base.name;
3788
- NodeError.prototype.code = code;
3837
+ function getMessage (arg1, arg2, arg3) {
3838
+ if (typeof message === 'string') {
3839
+ return message
3840
+ } else {
3841
+ return message(arg1, arg2, arg3)
3842
+ }
3843
+ }
3789
3844
 
3790
- codes[code] = NodeError;
3791
- }
3845
+ class NodeError extends Base {
3846
+ constructor (arg1, arg2, arg3) {
3847
+ super(getMessage(arg1, arg2, arg3));
3848
+ }
3849
+ }
3792
3850
 
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
- }
3851
+ NodeError.prototype.name = Base.name;
3852
+ NodeError.prototype.code = code;
3810
3853
 
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
- }
3854
+ codes[code] = NodeError;
3855
+ }
3815
3856
 
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
- }
3857
+ // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
3858
+ function oneOf(expected, thing) {
3859
+ if (Array.isArray(expected)) {
3860
+ const len = expected.length;
3861
+ expected = expected.map((i) => String(i));
3862
+ if (len > 2) {
3863
+ return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
3864
+ expected[len - 1];
3865
+ } else if (len === 2) {
3866
+ return `one of ${thing} ${expected[0]} or ${expected[1]}`;
3867
+ } else {
3868
+ return `of ${thing} ${expected[0]}`;
3869
+ }
3870
+ } else {
3871
+ return `of ${thing} ${String(expected)}`;
3872
+ }
3873
+ }
3823
3874
 
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
- }
3875
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
3876
+ function startsWith(str, search, pos) {
3877
+ return str.substr(0 , search.length) === search;
3878
+ }
3829
3879
 
3830
- if (start + search.length > str.length) {
3831
- return false;
3832
- } else {
3833
- return str.indexOf(search, start) !== -1;
3834
- }
3880
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
3881
+ function endsWith(str, search, this_len) {
3882
+ if (this_len === undefined || this_len > str.length) {
3883
+ this_len = str.length;
3835
3884
  }
3885
+ return str.substring(this_len - search.length, this_len) === search;
3886
+ }
3836
3887
 
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
- }
3888
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
3889
+ function includes(str, search, start) {
3890
+ if (typeof start !== 'number') {
3891
+ start = 0;
3892
+ }
3858
3893
 
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;
3894
+ if (start + search.length > str.length) {
3895
+ return false;
3896
+ } else {
3897
+ return str.indexOf(search, start) !== -1;
3898
+ }
3881
3899
  }
3882
3900
 
3883
- var state;
3884
- var hasRequiredState;
3901
+ createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
3902
+ return 'The value "' + value + '" is invalid for option "' + name + '"'
3903
+ }, TypeError);
3904
+ createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
3905
+ // determiner: 'must be' or 'must not be'
3906
+ let determiner;
3907
+ if (typeof expected === 'string' && startsWith(expected, 'not ')) {
3908
+ determiner = 'must not be';
3909
+ expected = expected.replace(/^not /, '');
3910
+ } else {
3911
+ determiner = 'must be';
3912
+ }
3885
3913
 
3886
- function requireState () {
3887
- if (hasRequiredState) return state;
3888
- hasRequiredState = 1;
3914
+ let msg;
3915
+ if (endsWith(name, ' argument')) {
3916
+ // For cases like 'first argument'
3917
+ msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
3918
+ } else {
3919
+ const type = includes(name, '.') ? 'property' : 'argument';
3920
+ msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
3921
+ }
3889
3922
 
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
- }
3923
+ msg += `. Received type ${typeof actual}`;
3924
+ return msg;
3925
+ }, TypeError);
3926
+ createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
3927
+ createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
3928
+ return 'The ' + name + ' method is not implemented'
3929
+ });
3930
+ createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
3931
+ createErrorType('ERR_STREAM_DESTROYED', function (name) {
3932
+ return 'Cannot call ' + name + ' after a stream was destroyed';
3933
+ });
3934
+ createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
3935
+ createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
3936
+ createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
3937
+ createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
3938
+ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
3939
+ return 'Unknown encoding: ' + arg
3940
+ }, TypeError);
3941
+ createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
3942
+
3943
+ errors.codes = codes;
3944
+
3945
+ var ERR_INVALID_OPT_VALUE = errors.codes.ERR_INVALID_OPT_VALUE;
3946
+ function highWaterMarkFrom(options, isDuplex, duplexKey) {
3947
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
3948
+ }
3949
+ function getHighWaterMark(state, options, duplexKey, isDuplex) {
3950
+ var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
3951
+ if (hwm != null) {
3952
+ if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
3953
+ var name = isDuplex ? duplexKey : 'highWaterMark';
3954
+ throw new ERR_INVALID_OPT_VALUE(name, hwm);
3955
+ }
3956
+ return Math.floor(hwm);
3957
+ }
3903
3958
 
3904
- // Default value
3905
- return state.objectMode ? 16 : 16 * 1024;
3906
- }
3907
- state = {
3908
- getHighWaterMark: getHighWaterMark
3909
- };
3910
- return state;
3959
+ // Default value
3960
+ return state.objectMode ? 16 : 16 * 1024;
3911
3961
  }
3962
+ var state = {
3963
+ getHighWaterMark: getHighWaterMark
3964
+ };
3912
3965
 
3913
3966
  var inherits = {exports: {}};
3914
3967
 
@@ -3949,23 +4002,18 @@ function requireInherits_browser () {
3949
4002
  return inherits_browser.exports;
3950
4003
  }
3951
4004
 
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;
4005
+ try {
4006
+ var util$2 = require('util');
4007
+ /* istanbul ignore next */
4008
+ if (typeof util$2.inherits !== 'function') throw '';
4009
+ inherits.exports = util$2.inherits;
4010
+ } catch (e) {
4011
+ /* istanbul ignore next */
4012
+ inherits.exports = requireInherits_browser();
3967
4013
  }
3968
4014
 
4015
+ var inheritsExports = inherits.exports;
4016
+
3969
4017
  var buffer_list;
3970
4018
  var hasRequiredBuffer_list;
3971
4019
 
@@ -4525,7 +4573,7 @@ function requireEndOfStream () {
4525
4573
  if (hasRequiredEndOfStream) return endOfStream;
4526
4574
  hasRequiredEndOfStream = 1;
4527
4575
 
4528
- var ERR_STREAM_PREMATURE_CLOSE = requireErrors().codes.ERR_STREAM_PREMATURE_CLOSE;
4576
+ var ERR_STREAM_PREMATURE_CLOSE = errors.codes.ERR_STREAM_PREMATURE_CLOSE;
4529
4577
  function once(callback) {
4530
4578
  var called = false;
4531
4579
  return function () {
@@ -4811,7 +4859,7 @@ function requireFrom () {
4811
4859
  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
4860
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4813
4861
  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;
4862
+ var ERR_INVALID_ARG_TYPE = errors.codes.ERR_INVALID_ARG_TYPE;
4815
4863
  function from(Readable, iterable, opts) {
4816
4864
  var iterator;
4817
4865
  if (iterable && typeof iterable.next === 'function') {
@@ -4880,7 +4928,7 @@ function require_stream_readable () {
4880
4928
  /*</replacement>*/
4881
4929
 
4882
4930
  /*<replacement>*/
4883
- var Stream = requireStream$1();
4931
+ var Stream = stream$1;
4884
4932
  /*</replacement>*/
4885
4933
 
4886
4934
  var Buffer = require$$0$4.Buffer;
@@ -4903,10 +4951,10 @@ function require_stream_readable () {
4903
4951
  /*</replacement>*/
4904
4952
 
4905
4953
  var BufferList = requireBuffer_list();
4906
- var destroyImpl = requireDestroy();
4907
- var _require = requireState(),
4954
+ var destroyImpl = destroy_1;
4955
+ var _require = state,
4908
4956
  getHighWaterMark = _require.getHighWaterMark;
4909
- var _require$codes = requireErrors().codes,
4957
+ var _require$codes = errors.codes,
4910
4958
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
4911
4959
  ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
4912
4960
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
@@ -4916,7 +4964,7 @@ function require_stream_readable () {
4916
4964
  var StringDecoder;
4917
4965
  var createReadableStreamAsyncIterator;
4918
4966
  var from;
4919
- requireInherits()(Readable, Stream);
4967
+ inheritsExports(Readable, Stream);
4920
4968
  var errorOrDestroy = destroyImpl.errorOrDestroy;
4921
4969
  var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
4922
4970
  function prependListener(emitter, event, fn) {
@@ -5889,7 +5937,7 @@ function require_stream_duplex () {
5889
5937
  _stream_duplex = Duplex;
5890
5938
  var Readable = require_stream_readable();
5891
5939
  var Writable = require_stream_writable();
5892
- requireInherits()(Duplex, Readable);
5940
+ inheritsExports(Duplex, Readable);
5893
5941
  {
5894
5942
  // Allow the keys array to be GC'ed.
5895
5943
  var keys = objectKeys(Writable.prototype);
@@ -6008,12 +6056,12 @@ function require_stream_writable () {
6008
6056
 
6009
6057
  /*<replacement>*/
6010
6058
  var internalUtil = {
6011
- deprecate: requireNode()
6059
+ deprecate: node$1
6012
6060
  };
6013
6061
  /*</replacement>*/
6014
6062
 
6015
6063
  /*<replacement>*/
6016
- var Stream = requireStream$1();
6064
+ var Stream = stream$1;
6017
6065
  /*</replacement>*/
6018
6066
 
6019
6067
  var Buffer = require$$0$4.Buffer;
@@ -6024,10 +6072,10 @@ function require_stream_writable () {
6024
6072
  function _isUint8Array(obj) {
6025
6073
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
6026
6074
  }
6027
- var destroyImpl = requireDestroy();
6028
- var _require = requireState(),
6075
+ var destroyImpl = destroy_1;
6076
+ var _require = state,
6029
6077
  getHighWaterMark = _require.getHighWaterMark;
6030
- var _require$codes = requireErrors().codes,
6078
+ var _require$codes = errors.codes,
6031
6079
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
6032
6080
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
6033
6081
  ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
@@ -6037,7 +6085,7 @@ function require_stream_writable () {
6037
6085
  ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
6038
6086
  ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
6039
6087
  var errorOrDestroy = destroyImpl.errorOrDestroy;
6040
- requireInherits()(Writable, Stream);
6088
+ inheritsExports(Writable, Stream);
6041
6089
  function nop() {}
6042
6090
  function WritableState(options, stream, isDuplex) {
6043
6091
  Duplex = Duplex || require_stream_duplex();
@@ -8013,13 +8061,13 @@ function require_stream_transform () {
8013
8061
  hasRequired_stream_transform = 1;
8014
8062
 
8015
8063
  _stream_transform = Transform;
8016
- var _require$codes = requireErrors().codes,
8064
+ var _require$codes = errors.codes,
8017
8065
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
8018
8066
  ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
8019
8067
  ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
8020
8068
  ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
8021
8069
  var Duplex = require_stream_duplex();
8022
- requireInherits()(Transform, Duplex);
8070
+ inheritsExports(Transform, Duplex);
8023
8071
  function afterTransform(er, data) {
8024
8072
  var ts = this._transformState;
8025
8073
  ts.transforming = false;
@@ -8149,7 +8197,7 @@ function require_stream_passthrough () {
8149
8197
 
8150
8198
  _stream_passthrough = PassThrough;
8151
8199
  var Transform = require_stream_transform();
8152
- requireInherits()(PassThrough, Transform);
8200
+ inheritsExports(PassThrough, Transform);
8153
8201
  function PassThrough(options) {
8154
8202
  if (!(this instanceof PassThrough)) return new PassThrough(options);
8155
8203
  Transform.call(this, options);
@@ -8176,7 +8224,7 @@ function requirePipeline () {
8176
8224
  callback.apply(void 0, arguments);
8177
8225
  };
8178
8226
  }
8179
- var _require$codes = requireErrors().codes,
8227
+ var _require$codes = errors.codes,
8180
8228
  ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
8181
8229
  ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
8182
8230
  function noop(err) {
@@ -10951,7 +10999,7 @@ function requireTailFile () {
10951
10999
  if (hasRequiredTailFile) return tailFile;
10952
11000
  hasRequiredTailFile = 1;
10953
11001
 
10954
- const fs = require$$0$6;
11002
+ const fs$1 = fs;
10955
11003
  const { StringDecoder } = require$$1$1;
10956
11004
  const { Stream } = readableExports;
10957
11005
 
@@ -10987,7 +11035,7 @@ function requireTailFile () {
10987
11035
  stream.emit('close');
10988
11036
  };
10989
11037
 
10990
- fs.open(options.file, 'a+', '0644', (err, fd) => {
11038
+ fs$1.open(options.file, 'a+', '0644', (err, fd) => {
10991
11039
  if (err) {
10992
11040
  if (!iter) {
10993
11041
  stream.emit('error', err);
@@ -11000,11 +11048,11 @@ function requireTailFile () {
11000
11048
 
11001
11049
  (function read() {
11002
11050
  if (stream.destroyed) {
11003
- fs.close(fd, noop);
11051
+ fs$1.close(fd, noop);
11004
11052
  return;
11005
11053
  }
11006
11054
 
11007
- return fs.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
11055
+ return fs$1.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
11008
11056
  if (error) {
11009
11057
  if (!iter) {
11010
11058
  stream.emit('error', error);
@@ -11078,8 +11126,8 @@ function requireFile () {
11078
11126
  if (hasRequiredFile) return file;
11079
11127
  hasRequiredFile = 1;
11080
11128
 
11081
- const fs = require$$0$6;
11082
- const path = require$$1$2;
11129
+ const fs$1 = fs;
11130
+ const path$1 = path;
11083
11131
  const asyncSeries = requireSeries();
11084
11132
  const zlib = require$$3;
11085
11133
  const { MESSAGE } = tripleBeam;
@@ -11126,17 +11174,17 @@ function requireFile () {
11126
11174
  if (options.filename || options.dirname) {
11127
11175
  throwIf('filename or dirname', 'stream');
11128
11176
  this._basename = this.filename = options.filename
11129
- ? path.basename(options.filename)
11177
+ ? path$1.basename(options.filename)
11130
11178
  : 'winston.log';
11131
11179
 
11132
- this.dirname = options.dirname || path.dirname(options.filename);
11180
+ this.dirname = options.dirname || path$1.dirname(options.filename);
11133
11181
  this.options = options.options || { flags: 'a' };
11134
11182
  } else if (options.stream) {
11135
11183
  // eslint-disable-next-line no-console
11136
11184
  console.warn('options.stream will be removed in winston@4. Use winston.transports.Stream');
11137
11185
  throwIf('stream', 'filename', 'maxsize');
11138
11186
  this._dest = this._stream.pipe(this._setupStream(options.stream));
11139
- this.dirname = path.dirname(this._dest.path);
11187
+ this.dirname = path$1.dirname(this._dest.path);
11140
11188
  // We need to listen for drain events when write() returns false. This
11141
11189
  // can make node mad at times.
11142
11190
  } else {
@@ -11352,12 +11400,12 @@ function requireFile () {
11352
11400
  }
11353
11401
 
11354
11402
  options = normalizeQuery(options);
11355
- const file = path.join(this.dirname, this.filename);
11403
+ const file = path$1.join(this.dirname, this.filename);
11356
11404
  let buff = '';
11357
11405
  let results = [];
11358
11406
  let row = 0;
11359
11407
 
11360
- const stream = fs.createReadStream(file, {
11408
+ const stream = fs$1.createReadStream(file, {
11361
11409
  encoding: 'utf8'
11362
11410
  });
11363
11411
 
@@ -11495,7 +11543,7 @@ function requireFile () {
11495
11543
  * TODO: Refactor me.
11496
11544
  */
11497
11545
  stream(options = {}) {
11498
- const file = path.join(this.dirname, this.filename);
11546
+ const file = path$1.join(this.dirname, this.filename);
11499
11547
  const stream = new Stream();
11500
11548
  const tail = {
11501
11549
  file,
@@ -11555,9 +11603,9 @@ function requireFile () {
11555
11603
  */
11556
11604
  stat(callback) {
11557
11605
  const target = this._getFile();
11558
- const fullpath = path.join(this.dirname, target);
11606
+ const fullpath = path$1.join(this.dirname, target);
11559
11607
 
11560
- fs.stat(fullpath, (err, stat) => {
11608
+ fs$1.stat(fullpath, (err, stat) => {
11561
11609
  if (err && err.code === 'ENOENT') {
11562
11610
  debug('ENOENT ok', fullpath);
11563
11611
  // Update internally tracked filename with the new target name.
@@ -11677,10 +11725,10 @@ function requireFile () {
11677
11725
  * @returns {WritableStream} Stream that writes to disk for the active file.
11678
11726
  */
11679
11727
  _createStream(source) {
11680
- const fullpath = path.join(this.dirname, this.filename);
11728
+ const fullpath = path$1.join(this.dirname, this.filename);
11681
11729
 
11682
11730
  debug('create stream start', fullpath, this.options);
11683
- const dest = fs.createWriteStream(fullpath, this.options)
11731
+ const dest = fs$1.createWriteStream(fullpath, this.options)
11684
11732
  // TODO: What should we do with errors here?
11685
11733
  .on('error', err => debug(err))
11686
11734
  .on('close', () => debug('close', dest.path, dest.bytesWritten))
@@ -11713,8 +11761,8 @@ function requireFile () {
11713
11761
  */
11714
11762
  _incFile(callback) {
11715
11763
  debug('_incFile', this.filename);
11716
- const ext = path.extname(this._basename);
11717
- const basename = path.basename(this._basename, ext);
11764
+ const ext = path$1.extname(this._basename);
11765
+ const basename = path$1.basename(this._basename, ext);
11718
11766
  const tasks = [];
11719
11767
 
11720
11768
  if (this.zippedArchive) {
@@ -11722,8 +11770,8 @@ function requireFile () {
11722
11770
  function (cb) {
11723
11771
  const num = this._created > 0 && !this.tailable ? this._created : '';
11724
11772
  this._compressFile(
11725
- path.join(this.dirname, `${basename}${num}${ext}`),
11726
- path.join(this.dirname, `${basename}${num}${ext}.gz`),
11773
+ path$1.join(this.dirname, `${basename}${num}${ext}`),
11774
+ path$1.join(this.dirname, `${basename}${num}${ext}.gz`),
11727
11775
  cb
11728
11776
  );
11729
11777
  }.bind(this)
@@ -11751,8 +11799,8 @@ function requireFile () {
11751
11799
  * @private
11752
11800
  */
11753
11801
  _getFile() {
11754
- const ext = path.extname(this._basename);
11755
- const basename = path.basename(this._basename, ext);
11802
+ const ext = path$1.extname(this._basename);
11803
+ const basename = path$1.basename(this._basename, ext);
11756
11804
  const isRotation = this.rotationFormat
11757
11805
  ? this.rotationFormat()
11758
11806
  : this._created;
@@ -11783,9 +11831,9 @@ function requireFile () {
11783
11831
  const isOldest = oldest !== 0 ? oldest : '';
11784
11832
  const isZipped = this.zippedArchive ? '.gz' : '';
11785
11833
  const filePath = `${basename}${isOldest}${ext}${isZipped}`;
11786
- const target = path.join(this.dirname, filePath);
11834
+ const target = path$1.join(this.dirname, filePath);
11787
11835
 
11788
- fs.unlink(target, callback);
11836
+ fs$1.unlink(target, callback);
11789
11837
  }
11790
11838
 
11791
11839
  /**
@@ -11810,23 +11858,23 @@ function requireFile () {
11810
11858
  for (let x = this.maxFiles - 1; x > 1; x--) {
11811
11859
  tasks.push(function (i, cb) {
11812
11860
  let fileName = `${basename}${(i - 1)}${ext}${isZipped}`;
11813
- const tmppath = path.join(this.dirname, fileName);
11861
+ const tmppath = path$1.join(this.dirname, fileName);
11814
11862
 
11815
- fs.exists(tmppath, exists => {
11863
+ fs$1.exists(tmppath, exists => {
11816
11864
  if (!exists) {
11817
11865
  return cb(null);
11818
11866
  }
11819
11867
 
11820
11868
  fileName = `${basename}${i}${ext}${isZipped}`;
11821
- fs.rename(tmppath, path.join(this.dirname, fileName), cb);
11869
+ fs$1.rename(tmppath, path$1.join(this.dirname, fileName), cb);
11822
11870
  });
11823
11871
  }.bind(this, x));
11824
11872
  }
11825
11873
 
11826
11874
  asyncSeries(tasks, () => {
11827
- fs.rename(
11828
- path.join(this.dirname, `${basename}${ext}${isZipped}`),
11829
- path.join(this.dirname, `${basename}1${ext}${isZipped}`),
11875
+ fs$1.rename(
11876
+ path$1.join(this.dirname, `${basename}${ext}${isZipped}`),
11877
+ path$1.join(this.dirname, `${basename}1${ext}${isZipped}`),
11830
11878
  callback
11831
11879
  );
11832
11880
  });
@@ -11841,15 +11889,15 @@ function requireFile () {
11841
11889
  * @private
11842
11890
  */
11843
11891
  _compressFile(src, dest, callback) {
11844
- fs.access(src, fs.F_OK, (err) => {
11892
+ fs$1.access(src, fs$1.F_OK, (err) => {
11845
11893
  if (err) {
11846
11894
  return callback();
11847
11895
  }
11848
11896
  var gzip = zlib.createGzip();
11849
- var inp = fs.createReadStream(src);
11850
- var out = fs.createWriteStream(dest);
11897
+ var inp = fs$1.createReadStream(src);
11898
+ var out = fs$1.createWriteStream(dest);
11851
11899
  out.on('finish', () => {
11852
- fs.unlink(src, callback);
11900
+ fs$1.unlink(src, callback);
11853
11901
  });
11854
11902
  inp.pipe(gzip).pipe(out);
11855
11903
  });
@@ -11857,8 +11905,8 @@ function requireFile () {
11857
11905
 
11858
11906
  _createLogDirIfNotExist(dirPath) {
11859
11907
  /* eslint-disable no-sync */
11860
- if (!fs.existsSync(dirPath)) {
11861
- fs.mkdirSync(dirPath, { recursive: true });
11908
+ if (!fs$1.existsSync(dirPath)) {
11909
+ fs$1.mkdirSync(dirPath, { recursive: true });
11862
11910
  }
11863
11911
  /* eslint-enable no-sync */
11864
11912
  }
@@ -11880,8 +11928,8 @@ function requireHttp () {
11880
11928
  if (hasRequiredHttp) return http_1;
11881
11929
  hasRequiredHttp = 1;
11882
11930
 
11883
- const http = require$$0$7;
11884
- const https = require$$1$3;
11931
+ const http = require$$0$6;
11932
+ const https = require$$1$2;
11885
11933
  const { Stream } = readableExports;
11886
11934
  const TransportStream = winstonTransportExports;
11887
11935
  const { configure } = requireSafeStableStringify();
@@ -14948,7 +14996,7 @@ exports.getNodeLogger = getNodeLogger;
14948
14996
  exports.logger = logger;
14949
14997
  exports.padLeft = padLeft;
14950
14998
  exports.padRight = padRight;
14951
- exports.parseList = parseList;
14999
+ exports.parseList = parseList$1;
14952
15000
  exports.resolveLogger = resolveLogger;
14953
15001
  exports.resolveValue = resolveValue;
14954
15002
  exports.serializeDetails = serializeDetails;