@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 +12 -0
- package/build/transport.js +1 -5
- package/build/transport.js.map +1 -1
- package/build/transport.mjs +1 -5
- package/build/transport.mjs.map +1 -1
- package/package.json +4 -4
- package/src/transport.ts +5 -10
- package/test/logger.spec.ts +1 -1
- package/test/prettify.spec.ts +1 -1
- package/test/transport.spec.ts +1 -1
package/CHANGELOG.md
CHANGED
package/build/transport.js
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|
package/build/transport.js.map
CHANGED
|
@@ -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
|
|
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"}
|
package/build/transport.mjs
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|
package/build/transport.mjs.map
CHANGED
|
@@ -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
|
|
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.
|
|
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.
|
|
36
|
+
"@verdaccio/core": "9.0.0-next-9.8",
|
|
37
37
|
"colorette": "2.0.20",
|
|
38
|
-
"dayjs": "1.11.
|
|
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.
|
|
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
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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');
|
package/test/logger.spec.ts
CHANGED
|
@@ -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(
|
|
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
|
`;
|
package/test/prettify.spec.ts
CHANGED
|
@@ -136,7 +136,7 @@ describe('buildPretty', () => {
|
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
describe('prettify default transport (buildSafeSonicBoom)', () => {
|
|
139
|
-
const prettifyTarget = path.resolve(
|
|
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');
|
package/test/transport.spec.ts
CHANGED
|
@@ -22,7 +22,7 @@ describe('isPrettyFormat', () => {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
describe('createPrettyTransport', () => {
|
|
25
|
-
const expectedPath = join(
|
|
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 = {};
|