@verdaccio/logger 9.0.0-next-9.6 → 9.0.0-next-9.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @verdaccio/logger
2
2
 
3
+ ## 9.0.0-next-9.8
4
+
5
+ ### Patch Changes
6
+
7
+ - @verdaccio/core@9.0.0-next-9.8
8
+
9
+ ## 9.0.0-next-9.7
10
+
11
+ ### Patch Changes
12
+
13
+ - @verdaccio/core@9.0.0-next-9.7
14
+
3
15
  ## 9.0.0-next-9.6
4
16
 
5
17
  ### Patch Changes
@@ -3,11 +3,7 @@ const require_colors = require("./colors.js");
3
3
  let node_path = require("node:path");
4
4
  let node_url = require("node:url");
5
5
  //#region src/transport.ts
6
- function getCurrentDir() {
7
- if (typeof __dirname !== "undefined") return __dirname;
8
- return (0, node_path.dirname)((0, node_url.fileURLToPath)({}.url));
9
- }
10
- var prettifyPath = (0, node_path.join)(getCurrentDir(), "..", "build", "prettify.js");
6
+ var prettifyPath = (0, node_path.join)(typeof __dirname !== "undefined" ? __dirname : (0, node_path.dirname)((0, node_url.fileURLToPath)({}.url)), "..", "build", "prettify.js");
11
7
  function isPrettyFormat(format) {
12
8
  return ["pretty-timestamped", "pretty"].includes(format ?? "pretty");
13
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","names":[],"sources":["../src/transport.ts"],"sourcesContent":["import { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { LoggerConfigItem, LoggerFormat } from '@verdaccio/types';\n\nimport { hasColors } from './colors';\n\n// Pino transports run in a worker thread and require an absolute path to a built JS file.\n// __dirname works in CJS; import.meta.url works in ESM (Node 20+).\nfunction getCurrentDir(): string {\n if (typeof __dirname !== 'undefined') {\n return __dirname;\n }\n // @ts-ignore -- import.meta.url requires module: es2020+ but vite preserves it for ESM output\n return dirname(fileURLToPath(import.meta.url));\n}\nconst prettifyPath = join(getCurrentDir(), '..', 'build', 'prettify.js');\n\nexport function isPrettyFormat(format: LoggerFormat | undefined): boolean {\n return ['pretty-timestamped', 'pretty'].includes(format ?? 'pretty');\n}\n\n/**\n * Create a pino pretty transport for non-production environments.\n */\nexport function createPrettyTransport(pino: any, options: LoggerConfigItem, format: LoggerFormat) {\n return pino.transport({\n target: prettifyPath,\n options: {\n destination: options.path || 1,\n colors: hasColors(options.colors),\n prettyStamp: format === 'pretty-timestamped',\n sync: options.sync ?? false,\n },\n worker: {\n name: 'verdaccio-logger-prettify',\n },\n });\n}\n"],"mappings":";;;;;AASA,SAAS,gBAAwB;AAC/B,KAAI,OAAO,cAAc,YACvB,QAAO;AAGT,SAAA,GAAA,UAAA,UAAA,GAAA,SAAA,eAAA,EAAA,CAAyC,IAAI,CAAC;;AAEhD,IAAM,gBAAA,GAAA,UAAA,MAAoB,eAAe,EAAE,MAAM,SAAS,cAAc;AAExE,SAAgB,eAAe,QAA2C;AACxE,QAAO,CAAC,sBAAsB,SAAS,CAAC,SAAS,UAAU,SAAS;;;;;AAMtE,SAAgB,sBAAsB,MAAW,SAA2B,QAAsB;AAChG,QAAO,KAAK,UAAU;EACpB,QAAQ;EACR,SAAS;GACP,aAAa,QAAQ,QAAQ;GAC7B,QAAQ,eAAA,UAAU,QAAQ,OAAO;GACjC,aAAa,WAAW;GACxB,MAAM,QAAQ,QAAQ;GACvB;EACD,QAAQ,EACN,MAAM,6BACP;EACF,CAAC"}
1
+ {"version":3,"file":"transport.js","names":[],"sources":["../src/transport.ts"],"sourcesContent":["import { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { LoggerConfigItem, LoggerFormat } from '@verdaccio/types';\n\nimport { hasColors } from './colors';\n\n// Pino transports run in a worker thread via require(), so CJS output must work.\n// import.meta.dirname works in ESM; __dirname works in CJS.\nconst currentDir =\n typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(import.meta.url));\nconst prettifyPath = join(currentDir, '..', 'build', 'prettify.js');\n\nexport function isPrettyFormat(format: LoggerFormat | undefined): boolean {\n return ['pretty-timestamped', 'pretty'].includes(format ?? 'pretty');\n}\n\n/**\n * Create a pino pretty transport for non-production environments.\n */\nexport function createPrettyTransport(pino: any, options: LoggerConfigItem, format: LoggerFormat) {\n return pino.transport({\n target: prettifyPath,\n options: {\n destination: options.path || 1,\n colors: hasColors(options.colors),\n prettyStamp: format === 'pretty-timestamped',\n sync: options.sync ?? false,\n },\n worker: {\n name: 'verdaccio-logger-prettify',\n },\n });\n}\n"],"mappings":";;;;;AAWA,IAAM,gBAAA,GAAA,UAAA,MADJ,OAAO,cAAc,cAAc,aAAA,GAAA,UAAA,UAAA,GAAA,SAAA,eAAA,EAAA,CAA8C,IAAI,CAAC,EAClD,MAAM,SAAS,cAAc;AAEnE,SAAgB,eAAe,QAA2C;AACxE,QAAO,CAAC,sBAAsB,SAAS,CAAC,SAAS,UAAU,SAAS;;;;;AAMtE,SAAgB,sBAAsB,MAAW,SAA2B,QAAsB;AAChG,QAAO,KAAK,UAAU;EACpB,QAAQ;EACR,SAAS;GACP,aAAa,QAAQ,QAAQ;GAC7B,QAAQ,eAAA,UAAU,QAAQ,OAAO;GACjC,aAAa,WAAW;GACxB,MAAM,QAAQ,QAAQ;GACvB;EACD,QAAQ,EACN,MAAM,6BACP;EACF,CAAC"}
@@ -2,11 +2,7 @@ import { hasColors } from "./colors.mjs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  //#region src/transport.ts
5
- function getCurrentDir() {
6
- if (typeof __dirname !== "undefined") return __dirname;
7
- return dirname(fileURLToPath(import.meta.url));
8
- }
9
- var prettifyPath = join(getCurrentDir(), "..", "build", "prettify.js");
5
+ var prettifyPath = join(typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url)), "..", "build", "prettify.js");
10
6
  function isPrettyFormat(format) {
11
7
  return ["pretty-timestamped", "pretty"].includes(format ?? "pretty");
12
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transport.mjs","names":[],"sources":["../src/transport.ts"],"sourcesContent":["import { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { LoggerConfigItem, LoggerFormat } from '@verdaccio/types';\n\nimport { hasColors } from './colors';\n\n// Pino transports run in a worker thread and require an absolute path to a built JS file.\n// __dirname works in CJS; import.meta.url works in ESM (Node 20+).\nfunction getCurrentDir(): string {\n if (typeof __dirname !== 'undefined') {\n return __dirname;\n }\n // @ts-ignore -- import.meta.url requires module: es2020+ but vite preserves it for ESM output\n return dirname(fileURLToPath(import.meta.url));\n}\nconst prettifyPath = join(getCurrentDir(), '..', 'build', 'prettify.js');\n\nexport function isPrettyFormat(format: LoggerFormat | undefined): boolean {\n return ['pretty-timestamped', 'pretty'].includes(format ?? 'pretty');\n}\n\n/**\n * Create a pino pretty transport for non-production environments.\n */\nexport function createPrettyTransport(pino: any, options: LoggerConfigItem, format: LoggerFormat) {\n return pino.transport({\n target: prettifyPath,\n options: {\n destination: options.path || 1,\n colors: hasColors(options.colors),\n prettyStamp: format === 'pretty-timestamped',\n sync: options.sync ?? false,\n },\n worker: {\n name: 'verdaccio-logger-prettify',\n },\n });\n}\n"],"mappings":";;;;AASA,SAAS,gBAAwB;AAC/B,KAAI,OAAO,cAAc,YACvB,QAAO;AAGT,QAAO,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;;AAEhD,IAAM,eAAe,KAAK,eAAe,EAAE,MAAM,SAAS,cAAc;AAExE,SAAgB,eAAe,QAA2C;AACxE,QAAO,CAAC,sBAAsB,SAAS,CAAC,SAAS,UAAU,SAAS;;;;;AAMtE,SAAgB,sBAAsB,MAAW,SAA2B,QAAsB;AAChG,QAAO,KAAK,UAAU;EACpB,QAAQ;EACR,SAAS;GACP,aAAa,QAAQ,QAAQ;GAC7B,QAAQ,UAAU,QAAQ,OAAO;GACjC,aAAa,WAAW;GACxB,MAAM,QAAQ,QAAQ;GACvB;EACD,QAAQ,EACN,MAAM,6BACP;EACF,CAAC"}
1
+ {"version":3,"file":"transport.mjs","names":[],"sources":["../src/transport.ts"],"sourcesContent":["import { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { LoggerConfigItem, LoggerFormat } from '@verdaccio/types';\n\nimport { hasColors } from './colors';\n\n// Pino transports run in a worker thread via require(), so CJS output must work.\n// import.meta.dirname works in ESM; __dirname works in CJS.\nconst currentDir =\n typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(import.meta.url));\nconst prettifyPath = join(currentDir, '..', 'build', 'prettify.js');\n\nexport function isPrettyFormat(format: LoggerFormat | undefined): boolean {\n return ['pretty-timestamped', 'pretty'].includes(format ?? 'pretty');\n}\n\n/**\n * Create a pino pretty transport for non-production environments.\n */\nexport function createPrettyTransport(pino: any, options: LoggerConfigItem, format: LoggerFormat) {\n return pino.transport({\n target: prettifyPath,\n options: {\n destination: options.path || 1,\n colors: hasColors(options.colors),\n prettyStamp: format === 'pretty-timestamped',\n sync: options.sync ?? false,\n },\n worker: {\n name: 'verdaccio-logger-prettify',\n },\n });\n}\n"],"mappings":";;;;AAWA,IAAM,eAAe,KADnB,OAAO,cAAc,cAAc,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC,EAClD,MAAM,SAAS,cAAc;AAEnE,SAAgB,eAAe,QAA2C;AACxE,QAAO,CAAC,sBAAsB,SAAS,CAAC,SAAS,UAAU,SAAS;;;;;AAMtE,SAAgB,sBAAsB,MAAW,SAA2B,QAAsB;AAChG,QAAO,KAAK,UAAU;EACpB,QAAQ;EACR,SAAS;GACP,aAAa,QAAQ,QAAQ;GAC7B,QAAQ,UAAU,QAAQ,OAAO;GACjC,aAAa,WAAW;GACxB,MAAM,QAAQ,QAAQ;GACvB;EACD,QAAQ,EACN,MAAM,6BACP;EACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/logger",
3
- "version": "9.0.0-next-9.6",
3
+ "version": "9.0.0-next-9.8",
4
4
  "description": "Verdaccio Logger",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -33,9 +33,9 @@
33
33
  "node": ">=24"
34
34
  },
35
35
  "dependencies": {
36
- "@verdaccio/core": "9.0.0-next-9.6",
36
+ "@verdaccio/core": "9.0.0-next-9.8",
37
37
  "colorette": "2.0.20",
38
- "dayjs": "1.11.18",
38
+ "dayjs": "1.11.20",
39
39
  "debug": "4.4.3",
40
40
  "on-exit-leak-free": "2.1.2",
41
41
  "pino": "10.3.1",
@@ -43,7 +43,7 @@
43
43
  "sonic-boom": "4.2.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@verdaccio/types": "14.0.0-next-9.3",
46
+ "@verdaccio/types": "14.0.0-next-9.4",
47
47
  "pino": "10.3.1",
48
48
  "vitest": "4.1.0"
49
49
  },
package/src/transport.ts CHANGED
@@ -5,16 +5,11 @@ import type { LoggerConfigItem, LoggerFormat } from '@verdaccio/types';
5
5
 
6
6
  import { hasColors } from './colors';
7
7
 
8
- // Pino transports run in a worker thread and require an absolute path to a built JS file.
9
- // __dirname works in CJS; import.meta.url works in ESM (Node 20+).
10
- function getCurrentDir(): string {
11
- if (typeof __dirname !== 'undefined') {
12
- return __dirname;
13
- }
14
- // @ts-ignore -- import.meta.url requires module: es2020+ but vite preserves it for ESM output
15
- return dirname(fileURLToPath(import.meta.url));
16
- }
17
- const prettifyPath = join(getCurrentDir(), '..', 'build', 'prettify.js');
8
+ // Pino transports run in a worker thread via require(), so CJS output must work.
9
+ // import.meta.dirname works in ESM; __dirname works in CJS.
10
+ const currentDir =
11
+ typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(import.meta.url));
12
+ const prettifyPath = join(currentDir, '..', 'build', 'prettify.js');
18
13
 
19
14
  export function isPrettyFormat(format: LoggerFormat | undefined): boolean {
20
15
  return ['pretty-timestamped', 'pretty'].includes(format ?? 'pretty');
@@ -189,7 +189,7 @@ describe('logger test', () => {
189
189
  // on-exit-leak-free but was never opened before the process exited.
190
190
  const script = `
191
191
  const pino = require('pino');
192
- const { prepareSetup } = require('${join(__dirname, '..', 'build')}');
192
+ const { prepareSetup } = require('${join(import.meta.dirname, '..', 'build')}');
193
193
  const result = prepareSetup({ type: 'file', path: '${file}', level: 'info', format: 'pretty', colors: false }, pino);
194
194
  if (result instanceof Promise) { result.then(() => process.exit(0)); } else { process.exit(0); }
195
195
  `;
@@ -136,7 +136,7 @@ describe('buildPretty', () => {
136
136
  });
137
137
 
138
138
  describe('prettify default transport (buildSafeSonicBoom)', () => {
139
- const prettifyTarget = path.resolve(__dirname, '..', 'build', 'prettify.js');
139
+ const prettifyTarget = path.resolve(import.meta.dirname, '..', 'build', 'prettify.js');
140
140
 
141
141
  async function createTempFile(): Promise<string> {
142
142
  const dir = await fileUtils.createTempFolder('prettify');
@@ -22,7 +22,7 @@ describe('isPrettyFormat', () => {
22
22
  });
23
23
 
24
24
  describe('createPrettyTransport', () => {
25
- const expectedPath = join(__dirname, '..', 'build', 'prettify.js');
25
+ const expectedPath = join(import.meta.dirname, '..', 'build', 'prettify.js');
26
26
 
27
27
  test('should call pino.transport with correct target path', () => {
28
28
  const mockTransport = {};