@vidavidorra/bunyan-pretty-stream 4.0.0-beta.1 → 4.0.0-beta.2

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.
@@ -4,6 +4,7 @@ import chalk from 'chalk';
4
4
  import stringify from 'json-stringify-pretty-compact';
5
5
  import { schema } from '../options.js';
6
6
  import Parser from '../parser/parser.js';
7
+ import normalisePath from '../helpers/normalise-path.js';
7
8
  import Extras from './extras.js';
8
9
  import Time from './time.js';
9
10
  class Formatter {
@@ -76,7 +77,7 @@ class Formatter {
76
77
  if (!this._options.show.source || source === undefined) {
77
78
  return '';
78
79
  }
79
- const file = relative(this._options.basePath, source.file);
80
+ const file = relative(this._options.basePath, normalisePath(source.file));
80
81
  const formattedSource = [
81
82
  ` (${file}:${source.line}`,
82
83
  source.func === undefined ? '' : ` in ${source.func}`,
@@ -0,0 +1,2 @@
1
+ declare function normalisePath(pathOrFileUrl: string): string;
2
+ export default normalisePath;
@@ -0,0 +1,9 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { normalize } from 'node:path';
3
+ function normalisePath(pathOrFileUrl) {
4
+ return normalize(pathOrFileUrl.startsWith('file://')
5
+ ? fileURLToPath(pathOrFileUrl)
6
+ : pathOrFileUrl);
7
+ }
8
+ export default normalisePath;
9
+ //# sourceMappingURL=normalise-path.js.map
package/dist/options.js CHANGED
@@ -1,6 +1,6 @@
1
- import { normalize } from 'node:path';
2
1
  import { z } from 'zod';
3
2
  import bunyanCoreFields from './bunyan/core-fields.js';
3
+ import normalisePath from './helpers/normalise-path.js';
4
4
  const extras = z
5
5
  .object({
6
6
  key: z
@@ -40,7 +40,7 @@ const publicSchema = z
40
40
  .strict()
41
41
  .default({}),
42
42
  basePath: z
43
- .preprocess((arg) => typeof arg === 'string' && arg.length > 0 ? normalize(arg) : arg, z.string().min(1))
43
+ .preprocess((arg) => typeof arg === 'string' && arg.length > 0 ? normalisePath(arg) : arg, z.string().min(1))
44
44
  .default('/'),
45
45
  newLineCharacter: z.enum(['\r', '\n', '\r\n']).default('\n'),
46
46
  time: z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidavidorra/bunyan-pretty-stream",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.2",
4
4
  "description": "Highly configurable Bunyan stream with pretty output",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",