@verdaccio/logger 9.0.0-next-9.16 → 9.0.0-next-9.18

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,23 @@
1
1
  # @verdaccio/logger
2
2
 
3
+ ## 9.0.0-next-9.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 73c78e3: fix(logger): tests on windows
8
+ - Updated dependencies [62ebd31]
9
+ - Updated dependencies [e8421bd]
10
+ - Updated dependencies [d9203d0]
11
+ - @verdaccio/core@9.0.0-next-9.18
12
+
13
+ ## 9.0.0-next-9.17
14
+
15
+ ### Patch Changes
16
+
17
+ - 6408a85: chore: force release
18
+ - Updated dependencies [6408a85]
19
+ - @verdaccio/core@9.0.0-next-9.17
20
+
3
21
  ## 9.0.0-next-9.16
4
22
 
5
23
  ### Patch Changes
package/build/colors.js CHANGED
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.js");
2
1
  let colorette = require("colorette");
3
2
  //#region src/colors.ts
4
3
  function hasColors(colors) {
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","names":[],"sources":["../src/colors.ts"],"sourcesContent":["import { isColorSupported } from 'colorette';\n\nexport function hasColors(colors: boolean | undefined) {\n if (colors) {\n return isColorSupported;\n }\n return typeof colors === 'undefined' ? true : colors;\n}\n"],"mappings":";;;AAEA,SAAgB,UAAU,QAA6B;AACrD,KAAI,OACF,QAAO,UAAA;AAET,QAAO,OAAO,WAAW,cAAc,OAAO"}
1
+ {"version":3,"file":"colors.js","names":[],"sources":["../src/colors.ts"],"sourcesContent":["import { isColorSupported } from 'colorette';\n\nexport function hasColors(colors: boolean | undefined) {\n if (colors) {\n return isColorSupported;\n }\n return typeof colors === 'undefined' ? true : colors;\n}\n"],"mappings":";;AAEA,SAAgB,UAAU,QAA6B;CACrD,IAAI,QACF,OAAO,UAAA;CAET,OAAO,OAAO,WAAW,cAAc,OAAO;AAChD"}
@@ -1 +1 @@
1
- {"version":3,"file":"colors.mjs","names":[],"sources":["../src/colors.ts"],"sourcesContent":["import { isColorSupported } from 'colorette';\n\nexport function hasColors(colors: boolean | undefined) {\n if (colors) {\n return isColorSupported;\n }\n return typeof colors === 'undefined' ? true : colors;\n}\n"],"mappings":";;AAEA,SAAgB,UAAU,QAA6B;AACrD,KAAI,OACF,QAAO;AAET,QAAO,OAAO,WAAW,cAAc,OAAO"}
1
+ {"version":3,"file":"colors.mjs","names":[],"sources":["../src/colors.ts"],"sourcesContent":["import { isColorSupported } from 'colorette';\n\nexport function hasColors(colors: boolean | undefined) {\n if (colors) {\n return isColorSupported;\n }\n return typeof colors === 'undefined' ? true : colors;\n}\n"],"mappings":";;AAEA,SAAgB,UAAU,QAA6B;CACrD,IAAI,QACF,OAAO;CAET,OAAO,OAAO,WAAW,cAAc,OAAO;AAChD"}
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.js");
2
1
  const require_levels = require("./levels.js");
3
2
  const require_utils = require("./utils.js");
4
3
  let colorette = require("colorette");
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.js","names":[],"sources":["../src/formatter.ts"],"sourcesContent":["import { green, red, white } from 'colorette';\nimport { inspect } from 'node:util';\n\nimport type { LevelCode } from './levels';\nimport { calculateLevel, levelsColors, subSystemLevels } from './levels';\nimport type { PrettyOptionsExtended } from './types';\nimport { formatLoggingDate, isObject, padRight } from './utils';\n\nlet LEVEL_VALUE_MAX = 0;\nfor (const l of Object.keys(levelsColors)) {\n LEVEL_VALUE_MAX = Math.max(LEVEL_VALUE_MAX, l.length);\n}\n\nconst ERROR_FLAG = '!';\n\nexport interface ObjectTemplate {\n level: LevelCode;\n msg: string;\n sub?: string;\n [key: string]: string | number | object | null | void;\n}\n\nexport function fillInMsgTemplate(\n msg: string,\n templateOptions: ObjectTemplate,\n colors: boolean\n): string {\n const templateRegex = /@{(!?[$A-Za-z_][$0-9A-Za-z\\._]*)}/g;\n\n return msg.replace(templateRegex, (_, name): string => {\n let str = templateOptions;\n let isError;\n if (name[0] === ERROR_FLAG) {\n name = name.slice(1);\n isError = true;\n }\n\n // object can be @{foo.bar.}\n const listAccessors = name.split('.');\n for (let property = 0; property < listAccessors.length; property++) {\n const id = listAccessors[property];\n if (isObject(str)) {\n str = (str as object)[id];\n }\n }\n\n if (typeof str === 'string') {\n if (colors === false || (str as string).includes('\\n')) {\n return str;\n } else if (isError) {\n return red(str);\n }\n return green(str);\n }\n\n // object, showHidden, depth, colors\n return inspect(str, undefined, null, colors);\n });\n}\n\nfunction getMessage(debugLevel, msg, sub, templateObjects, hasColors: boolean) {\n const finalMessage = fillInMsgTemplate(msg, templateObjects, hasColors);\n\n const subSystemType = hasColors\n ? subSystemLevels.color[sub ?? 'default']\n : subSystemLevels.white[sub ?? 'default'];\n if (hasColors) {\n const logString = `${levelsColors[debugLevel](padRight(debugLevel, LEVEL_VALUE_MAX))}${white(\n `${subSystemType} ${finalMessage}`\n )}`;\n\n return logString;\n }\n const logString = `${padRight(debugLevel, LEVEL_VALUE_MAX)}${subSystemType} ${finalMessage}`;\n\n return logString;\n}\n\nexport function printMessage(\n templateObjects: ObjectTemplate,\n options: Pick<PrettyOptionsExtended, 'prettyStamp'>,\n hasColors: boolean\n): string {\n const { prettyStamp } = options;\n const { level, msg, sub } = templateObjects;\n const debugLevel = calculateLevel(level);\n const logMessage = getMessage(debugLevel, msg, sub, templateObjects, hasColors);\n\n return prettyStamp ? formatLoggingDate(templateObjects.time as number, logMessage) : logMessage;\n}\n"],"mappings":";;;;;;AAQA,IAAI,kBAAkB;AACtB,KAAK,MAAM,KAAK,OAAO,KAAK,eAAA,aAAa,CACvC,mBAAkB,KAAK,IAAI,iBAAiB,EAAE,OAAO;AAGvD,IAAM,aAAa;AASnB,SAAgB,kBACd,KACA,iBACA,QACQ;AAGR,QAAO,IAAI,QAFW,uCAEa,GAAG,SAAiB;EACrD,IAAI,MAAM;EACV,IAAI;AACJ,MAAI,KAAK,OAAO,YAAY;AAC1B,UAAO,KAAK,MAAM,EAAE;AACpB,aAAU;;EAIZ,MAAM,gBAAgB,KAAK,MAAM,IAAI;AACrC,OAAK,IAAI,WAAW,GAAG,WAAW,cAAc,QAAQ,YAAY;GAClE,MAAM,KAAK,cAAc;AACzB,OAAI,cAAA,SAAS,IAAI,CACf,OAAO,IAAe;;AAI1B,MAAI,OAAO,QAAQ,UAAU;AAC3B,OAAI,WAAW,SAAU,IAAe,SAAS,KAAK,CACpD,QAAO;YACE,QACT,SAAA,GAAA,UAAA,KAAW,IAAI;AAEjB,WAAA,GAAA,UAAA,OAAa,IAAI;;AAInB,UAAA,GAAA,UAAA,SAAe,KAAK,KAAA,GAAW,MAAM,OAAO;GAC5C;;AAGJ,SAAS,WAAW,YAAY,KAAK,KAAK,iBAAiB,WAAoB;CAC7E,MAAM,eAAe,kBAAkB,KAAK,iBAAiB,UAAU;CAEvE,MAAM,gBAAgB,YAClB,eAAA,gBAAgB,MAAM,OAAO,aAC7B,eAAA,gBAAgB,MAAM,OAAO;AACjC,KAAI,UAKF,QAJkB,GAAG,eAAA,aAAa,YAAY,cAAA,SAAS,YAAY,gBAAgB,CAAC,IAAA,GAAA,UAAA,OAClF,GAAG,cAAc,GAAG,eACrB;AAMH,QAFkB,GAAG,cAAA,SAAS,YAAY,gBAAgB,GAAG,cAAc,GAAG;;AAKhF,SAAgB,aACd,iBACA,SACA,WACQ;CACR,MAAM,EAAE,gBAAgB;CACxB,MAAM,EAAE,OAAO,KAAK,QAAQ;CAE5B,MAAM,aAAa,WADA,eAAA,eAAe,MAAM,EACE,KAAK,KAAK,iBAAiB,UAAU;AAE/E,QAAO,cAAc,cAAA,kBAAkB,gBAAgB,MAAgB,WAAW,GAAG"}
1
+ {"version":3,"file":"formatter.js","names":[],"sources":["../src/formatter.ts"],"sourcesContent":["import { green, red, white } from 'colorette';\nimport { inspect } from 'node:util';\n\nimport type { LevelCode } from './levels';\nimport { calculateLevel, levelsColors, subSystemLevels } from './levels';\nimport type { PrettyOptionsExtended } from './types';\nimport { formatLoggingDate, isObject, padRight } from './utils';\n\nlet LEVEL_VALUE_MAX = 0;\nfor (const l of Object.keys(levelsColors)) {\n LEVEL_VALUE_MAX = Math.max(LEVEL_VALUE_MAX, l.length);\n}\n\nconst ERROR_FLAG = '!';\n\nexport interface ObjectTemplate {\n level: LevelCode;\n msg: string;\n sub?: string;\n [key: string]: string | number | object | null | void;\n}\n\nexport function fillInMsgTemplate(\n msg: string,\n templateOptions: ObjectTemplate,\n colors: boolean\n): string {\n const templateRegex = /@{(!?[$A-Za-z_][$0-9A-Za-z\\._]*)}/g;\n\n return msg.replace(templateRegex, (_, name): string => {\n let str = templateOptions;\n let isError;\n if (name[0] === ERROR_FLAG) {\n name = name.slice(1);\n isError = true;\n }\n\n // object can be @{foo.bar.}\n const listAccessors = name.split('.');\n for (let property = 0; property < listAccessors.length; property++) {\n const id = listAccessors[property];\n if (isObject(str)) {\n str = (str as object)[id];\n }\n }\n\n if (typeof str === 'string') {\n if (colors === false || (str as string).includes('\\n')) {\n return str;\n } else if (isError) {\n return red(str);\n }\n return green(str);\n }\n\n // object, showHidden, depth, colors\n return inspect(str, undefined, null, colors);\n });\n}\n\nfunction getMessage(debugLevel, msg, sub, templateObjects, hasColors: boolean) {\n const finalMessage = fillInMsgTemplate(msg, templateObjects, hasColors);\n\n const subSystemType = hasColors\n ? subSystemLevels.color[sub ?? 'default']\n : subSystemLevels.white[sub ?? 'default'];\n if (hasColors) {\n const logString = `${levelsColors[debugLevel](padRight(debugLevel, LEVEL_VALUE_MAX))}${white(\n `${subSystemType} ${finalMessage}`\n )}`;\n\n return logString;\n }\n const logString = `${padRight(debugLevel, LEVEL_VALUE_MAX)}${subSystemType} ${finalMessage}`;\n\n return logString;\n}\n\nexport function printMessage(\n templateObjects: ObjectTemplate,\n options: Pick<PrettyOptionsExtended, 'prettyStamp'>,\n hasColors: boolean\n): string {\n const { prettyStamp } = options;\n const { level, msg, sub } = templateObjects;\n const debugLevel = calculateLevel(level);\n const logMessage = getMessage(debugLevel, msg, sub, templateObjects, hasColors);\n\n return prettyStamp ? formatLoggingDate(templateObjects.time as number, logMessage) : logMessage;\n}\n"],"mappings":";;;;;AAQA,IAAI,kBAAkB;AACtB,KAAK,MAAM,KAAK,OAAO,KAAK,eAAA,YAAY,GACtC,kBAAkB,KAAK,IAAI,iBAAiB,EAAE,MAAM;AAGtD,IAAM,aAAa;AASnB,SAAgB,kBACd,KACA,iBACA,QACQ;CAGR,OAAO,IAAI,QAAQ,uCAAgB,GAAG,SAAiB;EACrD,IAAI,MAAM;EACV,IAAI;EACJ,IAAI,KAAK,OAAO,YAAY;GAC1B,OAAO,KAAK,MAAM,CAAC;GACnB,UAAU;EACZ;EAGA,MAAM,gBAAgB,KAAK,MAAM,GAAG;EACpC,KAAK,IAAI,WAAW,GAAG,WAAW,cAAc,QAAQ,YAAY;GAClE,MAAM,KAAK,cAAc;GACzB,IAAI,cAAA,SAAS,GAAG,GACd,MAAO,IAAe;EAE1B;EAEA,IAAI,OAAO,QAAQ,UAAU;GAC3B,IAAI,WAAW,SAAU,IAAe,SAAS,IAAI,GACnD,OAAO;QACF,IAAI,SACT,QAAA,GAAA,UAAA,KAAW,GAAG;GAEhB,QAAA,GAAA,UAAA,OAAa,GAAG;EAClB;EAGA,QAAA,GAAA,UAAA,SAAe,KAAK,KAAA,GAAW,MAAM,MAAM;CAC7C,CAAC;AACH;AAEA,SAAS,WAAW,YAAY,KAAK,KAAK,iBAAiB,WAAoB;CAC7E,MAAM,eAAe,kBAAkB,KAAK,iBAAiB,SAAS;CAEtE,MAAM,gBAAgB,YAClB,eAAA,gBAAgB,MAAM,OAAO,aAC7B,eAAA,gBAAgB,MAAM,OAAO;CACjC,IAAI,WAKF,OAAO,GAJc,eAAA,aAAa,YAAY,cAAA,SAAS,YAAY,eAAe,CAAC,KAAA,GAAA,UAAA,OACjF,GAAG,cAAc,GAAG,cACtB;CAMF,OAAO,GAFc,cAAA,SAAS,YAAY,eAAe,IAAI,cAAc,GAAG;AAGhF;AAEA,SAAgB,aACd,iBACA,SACA,WACQ;CACR,MAAM,EAAE,gBAAgB;CACxB,MAAM,EAAE,OAAO,KAAK,QAAQ;CAE5B,MAAM,aAAa,WADA,eAAA,eAAe,KACJ,GAAY,KAAK,KAAK,iBAAiB,SAAS;CAE9E,OAAO,cAAc,cAAA,kBAAkB,gBAAgB,MAAgB,UAAU,IAAI;AACvF"}
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.mjs","names":[],"sources":["../src/formatter.ts"],"sourcesContent":["import { green, red, white } from 'colorette';\nimport { inspect } from 'node:util';\n\nimport type { LevelCode } from './levels';\nimport { calculateLevel, levelsColors, subSystemLevels } from './levels';\nimport type { PrettyOptionsExtended } from './types';\nimport { formatLoggingDate, isObject, padRight } from './utils';\n\nlet LEVEL_VALUE_MAX = 0;\nfor (const l of Object.keys(levelsColors)) {\n LEVEL_VALUE_MAX = Math.max(LEVEL_VALUE_MAX, l.length);\n}\n\nconst ERROR_FLAG = '!';\n\nexport interface ObjectTemplate {\n level: LevelCode;\n msg: string;\n sub?: string;\n [key: string]: string | number | object | null | void;\n}\n\nexport function fillInMsgTemplate(\n msg: string,\n templateOptions: ObjectTemplate,\n colors: boolean\n): string {\n const templateRegex = /@{(!?[$A-Za-z_][$0-9A-Za-z\\._]*)}/g;\n\n return msg.replace(templateRegex, (_, name): string => {\n let str = templateOptions;\n let isError;\n if (name[0] === ERROR_FLAG) {\n name = name.slice(1);\n isError = true;\n }\n\n // object can be @{foo.bar.}\n const listAccessors = name.split('.');\n for (let property = 0; property < listAccessors.length; property++) {\n const id = listAccessors[property];\n if (isObject(str)) {\n str = (str as object)[id];\n }\n }\n\n if (typeof str === 'string') {\n if (colors === false || (str as string).includes('\\n')) {\n return str;\n } else if (isError) {\n return red(str);\n }\n return green(str);\n }\n\n // object, showHidden, depth, colors\n return inspect(str, undefined, null, colors);\n });\n}\n\nfunction getMessage(debugLevel, msg, sub, templateObjects, hasColors: boolean) {\n const finalMessage = fillInMsgTemplate(msg, templateObjects, hasColors);\n\n const subSystemType = hasColors\n ? subSystemLevels.color[sub ?? 'default']\n : subSystemLevels.white[sub ?? 'default'];\n if (hasColors) {\n const logString = `${levelsColors[debugLevel](padRight(debugLevel, LEVEL_VALUE_MAX))}${white(\n `${subSystemType} ${finalMessage}`\n )}`;\n\n return logString;\n }\n const logString = `${padRight(debugLevel, LEVEL_VALUE_MAX)}${subSystemType} ${finalMessage}`;\n\n return logString;\n}\n\nexport function printMessage(\n templateObjects: ObjectTemplate,\n options: Pick<PrettyOptionsExtended, 'prettyStamp'>,\n hasColors: boolean\n): string {\n const { prettyStamp } = options;\n const { level, msg, sub } = templateObjects;\n const debugLevel = calculateLevel(level);\n const logMessage = getMessage(debugLevel, msg, sub, templateObjects, hasColors);\n\n return prettyStamp ? formatLoggingDate(templateObjects.time as number, logMessage) : logMessage;\n}\n"],"mappings":";;;;;AAQA,IAAI,kBAAkB;AACtB,KAAK,MAAM,KAAK,OAAO,KAAK,aAAa,CACvC,mBAAkB,KAAK,IAAI,iBAAiB,EAAE,OAAO;AAGvD,IAAM,aAAa;AASnB,SAAgB,kBACd,KACA,iBACA,QACQ;AAGR,QAAO,IAAI,QAFW,uCAEa,GAAG,SAAiB;EACrD,IAAI,MAAM;EACV,IAAI;AACJ,MAAI,KAAK,OAAO,YAAY;AAC1B,UAAO,KAAK,MAAM,EAAE;AACpB,aAAU;;EAIZ,MAAM,gBAAgB,KAAK,MAAM,IAAI;AACrC,OAAK,IAAI,WAAW,GAAG,WAAW,cAAc,QAAQ,YAAY;GAClE,MAAM,KAAK,cAAc;AACzB,OAAI,SAAS,IAAI,CACf,OAAO,IAAe;;AAI1B,MAAI,OAAO,QAAQ,UAAU;AAC3B,OAAI,WAAW,SAAU,IAAe,SAAS,KAAK,CACpD,QAAO;YACE,QACT,QAAO,IAAI,IAAI;AAEjB,UAAO,MAAM,IAAI;;AAInB,SAAO,QAAQ,KAAK,KAAA,GAAW,MAAM,OAAO;GAC5C;;AAGJ,SAAS,WAAW,YAAY,KAAK,KAAK,iBAAiB,WAAoB;CAC7E,MAAM,eAAe,kBAAkB,KAAK,iBAAiB,UAAU;CAEvE,MAAM,gBAAgB,YAClB,gBAAgB,MAAM,OAAO,aAC7B,gBAAgB,MAAM,OAAO;AACjC,KAAI,UAKF,QAJkB,GAAG,aAAa,YAAY,SAAS,YAAY,gBAAgB,CAAC,GAAG,MACrF,GAAG,cAAc,GAAG,eACrB;AAMH,QAFkB,GAAG,SAAS,YAAY,gBAAgB,GAAG,cAAc,GAAG;;AAKhF,SAAgB,aACd,iBACA,SACA,WACQ;CACR,MAAM,EAAE,gBAAgB;CACxB,MAAM,EAAE,OAAO,KAAK,QAAQ;CAE5B,MAAM,aAAa,WADA,eAAe,MAAM,EACE,KAAK,KAAK,iBAAiB,UAAU;AAE/E,QAAO,cAAc,kBAAkB,gBAAgB,MAAgB,WAAW,GAAG"}
1
+ {"version":3,"file":"formatter.mjs","names":[],"sources":["../src/formatter.ts"],"sourcesContent":["import { green, red, white } from 'colorette';\nimport { inspect } from 'node:util';\n\nimport type { LevelCode } from './levels';\nimport { calculateLevel, levelsColors, subSystemLevels } from './levels';\nimport type { PrettyOptionsExtended } from './types';\nimport { formatLoggingDate, isObject, padRight } from './utils';\n\nlet LEVEL_VALUE_MAX = 0;\nfor (const l of Object.keys(levelsColors)) {\n LEVEL_VALUE_MAX = Math.max(LEVEL_VALUE_MAX, l.length);\n}\n\nconst ERROR_FLAG = '!';\n\nexport interface ObjectTemplate {\n level: LevelCode;\n msg: string;\n sub?: string;\n [key: string]: string | number | object | null | void;\n}\n\nexport function fillInMsgTemplate(\n msg: string,\n templateOptions: ObjectTemplate,\n colors: boolean\n): string {\n const templateRegex = /@{(!?[$A-Za-z_][$0-9A-Za-z\\._]*)}/g;\n\n return msg.replace(templateRegex, (_, name): string => {\n let str = templateOptions;\n let isError;\n if (name[0] === ERROR_FLAG) {\n name = name.slice(1);\n isError = true;\n }\n\n // object can be @{foo.bar.}\n const listAccessors = name.split('.');\n for (let property = 0; property < listAccessors.length; property++) {\n const id = listAccessors[property];\n if (isObject(str)) {\n str = (str as object)[id];\n }\n }\n\n if (typeof str === 'string') {\n if (colors === false || (str as string).includes('\\n')) {\n return str;\n } else if (isError) {\n return red(str);\n }\n return green(str);\n }\n\n // object, showHidden, depth, colors\n return inspect(str, undefined, null, colors);\n });\n}\n\nfunction getMessage(debugLevel, msg, sub, templateObjects, hasColors: boolean) {\n const finalMessage = fillInMsgTemplate(msg, templateObjects, hasColors);\n\n const subSystemType = hasColors\n ? subSystemLevels.color[sub ?? 'default']\n : subSystemLevels.white[sub ?? 'default'];\n if (hasColors) {\n const logString = `${levelsColors[debugLevel](padRight(debugLevel, LEVEL_VALUE_MAX))}${white(\n `${subSystemType} ${finalMessage}`\n )}`;\n\n return logString;\n }\n const logString = `${padRight(debugLevel, LEVEL_VALUE_MAX)}${subSystemType} ${finalMessage}`;\n\n return logString;\n}\n\nexport function printMessage(\n templateObjects: ObjectTemplate,\n options: Pick<PrettyOptionsExtended, 'prettyStamp'>,\n hasColors: boolean\n): string {\n const { prettyStamp } = options;\n const { level, msg, sub } = templateObjects;\n const debugLevel = calculateLevel(level);\n const logMessage = getMessage(debugLevel, msg, sub, templateObjects, hasColors);\n\n return prettyStamp ? formatLoggingDate(templateObjects.time as number, logMessage) : logMessage;\n}\n"],"mappings":";;;;;AAQA,IAAI,kBAAkB;AACtB,KAAK,MAAM,KAAK,OAAO,KAAK,YAAY,GACtC,kBAAkB,KAAK,IAAI,iBAAiB,EAAE,MAAM;AAGtD,IAAM,aAAa;AASnB,SAAgB,kBACd,KACA,iBACA,QACQ;CAGR,OAAO,IAAI,QAAQ,uCAAgB,GAAG,SAAiB;EACrD,IAAI,MAAM;EACV,IAAI;EACJ,IAAI,KAAK,OAAO,YAAY;GAC1B,OAAO,KAAK,MAAM,CAAC;GACnB,UAAU;EACZ;EAGA,MAAM,gBAAgB,KAAK,MAAM,GAAG;EACpC,KAAK,IAAI,WAAW,GAAG,WAAW,cAAc,QAAQ,YAAY;GAClE,MAAM,KAAK,cAAc;GACzB,IAAI,SAAS,GAAG,GACd,MAAO,IAAe;EAE1B;EAEA,IAAI,OAAO,QAAQ,UAAU;GAC3B,IAAI,WAAW,SAAU,IAAe,SAAS,IAAI,GACnD,OAAO;QACF,IAAI,SACT,OAAO,IAAI,GAAG;GAEhB,OAAO,MAAM,GAAG;EAClB;EAGA,OAAO,QAAQ,KAAK,KAAA,GAAW,MAAM,MAAM;CAC7C,CAAC;AACH;AAEA,SAAS,WAAW,YAAY,KAAK,KAAK,iBAAiB,WAAoB;CAC7E,MAAM,eAAe,kBAAkB,KAAK,iBAAiB,SAAS;CAEtE,MAAM,gBAAgB,YAClB,gBAAgB,MAAM,OAAO,aAC7B,gBAAgB,MAAM,OAAO;CACjC,IAAI,WAKF,OAAO,GAJc,aAAa,YAAY,SAAS,YAAY,eAAe,CAAC,IAAI,MACrF,GAAG,cAAc,GAAG,cACtB;CAMF,OAAO,GAFc,SAAS,YAAY,eAAe,IAAI,cAAc,GAAG;AAGhF;AAEA,SAAgB,aACd,iBACA,SACA,WACQ;CACR,MAAM,EAAE,gBAAgB;CACxB,MAAM,EAAE,OAAO,KAAK,QAAQ;CAE5B,MAAM,aAAa,WADA,eAAe,KACJ,GAAY,KAAK,KAAK,iBAAiB,SAAS;CAE9E,OAAO,cAAc,kBAAkB,gBAAgB,MAAgB,UAAU,IAAI;AACvF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import pino from 'pino';\n\nimport type { Logger, LoggerConfigItem } from '@verdaccio/types';\n\nimport { prepareSetup } from './logger';\n\nexport { createLogger, prepareSetup, willUseTransport } from './logger';\nexport type { LogPlugin, LoggerConfig } from './logger';\nexport { default as prettifyTransport, autoEnd, buildPretty, buildSafeSonicBoom } from './prettify';\nexport { hasColors } from './colors';\nexport { fillInMsgTemplate, printMessage } from './formatter';\nexport { createPrettyTransport, isPrettyFormat } from './transport';\nexport type { LevelCode } from './levels';\nexport { formatLoggingDate, padRight } from './utils';\n\n/**\n * Initialize the logger singleton.\n */\nexport async function setup(options: LoggerConfigItem): Promise<Logger> {\n if (typeof logger !== 'undefined') {\n return logger;\n }\n\n logger = await prepareSetup(options, pino);\n return logger;\n}\n\nexport let logger: Logger;\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,eAAsB,MAAM,SAA4C;AACtE,KAAI,OAAO,WAAW,YACpB,QAAO;AAGT,UAAS,MAAM,eAAA,aAAa,SAAS,KAAA,QAAK;AAC1C,QAAO;;AAGT,IAAW"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import pino from 'pino';\n\nimport type { Logger, LoggerConfigItem } from '@verdaccio/types';\n\nimport { prepareSetup } from './logger';\n\nexport { createLogger, prepareSetup, willUseTransport } from './logger';\nexport type { LogPlugin, LoggerConfig } from './logger';\nexport { default as prettifyTransport, autoEnd, buildPretty, buildSafeSonicBoom } from './prettify';\nexport { hasColors } from './colors';\nexport { fillInMsgTemplate, printMessage } from './formatter';\nexport { createPrettyTransport, isPrettyFormat } from './transport';\nexport type { LevelCode } from './levels';\nexport { formatLoggingDate, padRight } from './utils';\n\n/**\n * Initialize the logger singleton.\n */\nexport async function setup(options: LoggerConfigItem): Promise<Logger> {\n if (typeof logger !== 'undefined') {\n return logger;\n }\n\n logger = await prepareSetup(options, pino);\n return logger;\n}\n\nexport let logger: Logger;\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,eAAsB,MAAM,SAA4C;CACtE,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,SAAS,MAAM,eAAA,aAAa,SAAS,KAAA,OAAI;CACzC,OAAO;AACT;AAEA,IAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import pino from 'pino';\n\nimport type { Logger, LoggerConfigItem } from '@verdaccio/types';\n\nimport { prepareSetup } from './logger';\n\nexport { createLogger, prepareSetup, willUseTransport } from './logger';\nexport type { LogPlugin, LoggerConfig } from './logger';\nexport { default as prettifyTransport, autoEnd, buildPretty, buildSafeSonicBoom } from './prettify';\nexport { hasColors } from './colors';\nexport { fillInMsgTemplate, printMessage } from './formatter';\nexport { createPrettyTransport, isPrettyFormat } from './transport';\nexport type { LevelCode } from './levels';\nexport { formatLoggingDate, padRight } from './utils';\n\n/**\n * Initialize the logger singleton.\n */\nexport async function setup(options: LoggerConfigItem): Promise<Logger> {\n if (typeof logger !== 'undefined') {\n return logger;\n }\n\n logger = await prepareSetup(options, pino);\n return logger;\n}\n\nexport let logger: Logger;\n"],"mappings":";;;;;;;;;;;AAkBA,eAAsB,MAAM,SAA4C;AACtE,KAAI,OAAO,WAAW,YACpB,QAAO;AAGT,UAAS,MAAM,aAAa,SAAS,KAAK;AAC1C,QAAO;;AAGT,IAAW"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import pino from 'pino';\n\nimport type { Logger, LoggerConfigItem } from '@verdaccio/types';\n\nimport { prepareSetup } from './logger';\n\nexport { createLogger, prepareSetup, willUseTransport } from './logger';\nexport type { LogPlugin, LoggerConfig } from './logger';\nexport { default as prettifyTransport, autoEnd, buildPretty, buildSafeSonicBoom } from './prettify';\nexport { hasColors } from './colors';\nexport { fillInMsgTemplate, printMessage } from './formatter';\nexport { createPrettyTransport, isPrettyFormat } from './transport';\nexport type { LevelCode } from './levels';\nexport { formatLoggingDate, padRight } from './utils';\n\n/**\n * Initialize the logger singleton.\n */\nexport async function setup(options: LoggerConfigItem): Promise<Logger> {\n if (typeof logger !== 'undefined') {\n return logger;\n }\n\n logger = await prepareSetup(options, pino);\n return logger;\n}\n\nexport let logger: Logger;\n"],"mappings":";;;;;;;;;;;AAkBA,eAAsB,MAAM,SAA4C;CACtE,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,SAAS,MAAM,aAAa,SAAS,IAAI;CACzC,OAAO;AACT;AAEA,IAAW"}
package/build/levels.js CHANGED
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.js");
2
1
  let colorette = require("colorette");
3
2
  //#region src/levels.ts
4
3
  function calculateLevel(levelCode) {
@@ -22,27 +21,20 @@ var levelsColors = {
22
21
  debug: colorette.green,
23
22
  trace: colorette.white
24
23
  };
25
- var ARROWS = /* @__PURE__ */ function(ARROWS) {
26
- ARROWS["LEFT"] = "<--";
27
- ARROWS["RIGHT"] = "-->";
28
- ARROWS["EQUAL"] = "-=-";
29
- ARROWS["NEUTRAL"] = "---";
30
- return ARROWS;
31
- }(ARROWS || {});
32
24
  var subSystemLevels = {
33
25
  color: {
34
- in: (0, colorette.green)(ARROWS.LEFT),
35
- out: (0, colorette.yellow)(ARROWS.RIGHT),
36
- auth: (0, colorette.blue)(ARROWS.NEUTRAL),
37
- fs: (0, colorette.black)(ARROWS.EQUAL),
38
- default: (0, colorette.blue)(ARROWS.NEUTRAL)
26
+ in: (0, colorette.green)("<--"),
27
+ out: (0, colorette.yellow)("-->"),
28
+ auth: (0, colorette.blue)("---"),
29
+ fs: (0, colorette.black)("-=-"),
30
+ default: (0, colorette.blue)("---")
39
31
  },
40
32
  white: {
41
- in: ARROWS.LEFT,
42
- out: ARROWS.RIGHT,
43
- auth: ARROWS.NEUTRAL,
44
- fs: ARROWS.EQUAL,
45
- default: ARROWS.NEUTRAL
33
+ in: "<--",
34
+ out: "-->",
35
+ auth: "---",
36
+ fs: "-=-",
37
+ default: "---"
46
38
  }
47
39
  };
48
40
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"levels.js","names":[],"sources":["../src/levels.ts"],"sourcesContent":["import { black, blue, cyan, green, magenta, red, white, yellow } from 'colorette';\n\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'http' | 'warn' | 'error' | 'fatal';\n\nexport type LevelCode = number;\n\nexport function calculateLevel(levelCode: LevelCode): LogLevel {\n switch (true) {\n case levelCode === 10:\n return 'trace';\n case levelCode === 20:\n return 'debug';\n case levelCode === 25:\n return 'http';\n case levelCode === 30:\n return 'info';\n case levelCode === 40:\n return 'warn';\n case levelCode === 50:\n return 'error';\n case levelCode === 60:\n return 'fatal';\n default:\n return 'fatal';\n }\n}\n\nexport const levelsColors = {\n fatal: red,\n error: red,\n warn: yellow,\n http: magenta,\n info: cyan,\n debug: green,\n trace: white,\n};\n\nenum ARROWS {\n LEFT = '<--',\n RIGHT = '-->',\n EQUAL = '-=-',\n NEUTRAL = '---',\n}\n\nexport const subSystemLevels = {\n color: {\n in: green(ARROWS.LEFT),\n out: yellow(ARROWS.RIGHT),\n auth: blue(ARROWS.NEUTRAL),\n fs: black(ARROWS.EQUAL),\n default: blue(ARROWS.NEUTRAL),\n },\n white: {\n in: ARROWS.LEFT,\n out: ARROWS.RIGHT,\n auth: ARROWS.NEUTRAL,\n fs: ARROWS.EQUAL,\n default: ARROWS.NEUTRAL,\n },\n};\n"],"mappings":";;;AAMA,SAAgB,eAAe,WAAgC;AAC7D,SAAQ,MAAR;EACE,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,QACE,QAAO;;;AAIb,IAAa,eAAe;CAC1B,OAAO,UAAA;CACP,OAAO,UAAA;CACP,MAAM,UAAA;CACN,MAAM,UAAA;CACN,MAAM,UAAA;CACN,OAAO,UAAA;CACP,OAAO,UAAA;CACR;AAED,IAAK,SAAL,yBAAA,QAAA;AACE,QAAA,UAAA;AACA,QAAA,WAAA;AACA,QAAA,WAAA;AACA,QAAA,aAAA;;EAJG,UAAA,EAAA,CAKJ;AAED,IAAa,kBAAkB;CAC7B,OAAO;EACL,KAAA,GAAA,UAAA,OAAU,OAAO,KAAK;EACtB,MAAA,GAAA,UAAA,QAAY,OAAO,MAAM;EACzB,OAAA,GAAA,UAAA,MAAW,OAAO,QAAQ;EAC1B,KAAA,GAAA,UAAA,OAAU,OAAO,MAAM;EACvB,UAAA,GAAA,UAAA,MAAc,OAAO,QAAQ;EAC9B;CACD,OAAO;EACL,IAAI,OAAO;EACX,KAAK,OAAO;EACZ,MAAM,OAAO;EACb,IAAI,OAAO;EACX,SAAS,OAAO;EACjB;CACF"}
1
+ {"version":3,"file":"levels.js","names":[],"sources":["../src/levels.ts"],"sourcesContent":["import { black, blue, cyan, green, magenta, red, white, yellow } from 'colorette';\n\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'http' | 'warn' | 'error' | 'fatal';\n\nexport type LevelCode = number;\n\nexport function calculateLevel(levelCode: LevelCode): LogLevel {\n switch (true) {\n case levelCode === 10:\n return 'trace';\n case levelCode === 20:\n return 'debug';\n case levelCode === 25:\n return 'http';\n case levelCode === 30:\n return 'info';\n case levelCode === 40:\n return 'warn';\n case levelCode === 50:\n return 'error';\n case levelCode === 60:\n return 'fatal';\n default:\n return 'fatal';\n }\n}\n\nexport const levelsColors = {\n fatal: red,\n error: red,\n warn: yellow,\n http: magenta,\n info: cyan,\n debug: green,\n trace: white,\n};\n\nenum ARROWS {\n LEFT = '<--',\n RIGHT = '-->',\n EQUAL = '-=-',\n NEUTRAL = '---',\n}\n\nexport const subSystemLevels = {\n color: {\n in: green(ARROWS.LEFT),\n out: yellow(ARROWS.RIGHT),\n auth: blue(ARROWS.NEUTRAL),\n fs: black(ARROWS.EQUAL),\n default: blue(ARROWS.NEUTRAL),\n },\n white: {\n in: ARROWS.LEFT,\n out: ARROWS.RIGHT,\n auth: ARROWS.NEUTRAL,\n fs: ARROWS.EQUAL,\n default: ARROWS.NEUTRAL,\n },\n};\n"],"mappings":";;AAMA,SAAgB,eAAe,WAAgC;CAC7D,QAAQ,MAAR;EACE,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,IAAa,eAAe;CAC1B,OAAO,UAAA;CACP,OAAO,UAAA;CACP,MAAM,UAAA;CACN,MAAM,UAAA;CACN,MAAM,UAAA;CACN,OAAO,UAAA;CACP,OAAO,UAAA;AACT;AASA,IAAa,kBAAkB;CAC7B,OAAO;EACL,KAAA,GAAA,UAAA,OAAI,KAAiB;EACrB,MAAA,GAAA,UAAA,QAAK,KAAmB;EACxB,OAAA,GAAA,UAAA,MAAM,KAAmB;EACzB,KAAA,GAAA,UAAA,OAAI,KAAkB;EACtB,UAAA,GAAA,UAAA,MAAS,KAAmB;CAC9B;CACA,OAAO;EACL,IAAA;EACA,KAAA;EACA,MAAA;EACA,IAAA;EACA,SAAA;CACF;AACF"}
package/build/levels.mjs CHANGED
@@ -21,27 +21,20 @@ var levelsColors = {
21
21
  debug: green,
22
22
  trace: white
23
23
  };
24
- var ARROWS = /* @__PURE__ */ function(ARROWS) {
25
- ARROWS["LEFT"] = "<--";
26
- ARROWS["RIGHT"] = "-->";
27
- ARROWS["EQUAL"] = "-=-";
28
- ARROWS["NEUTRAL"] = "---";
29
- return ARROWS;
30
- }(ARROWS || {});
31
24
  var subSystemLevels = {
32
25
  color: {
33
- in: green(ARROWS.LEFT),
34
- out: yellow(ARROWS.RIGHT),
35
- auth: blue(ARROWS.NEUTRAL),
36
- fs: black(ARROWS.EQUAL),
37
- default: blue(ARROWS.NEUTRAL)
26
+ in: green("<--"),
27
+ out: yellow("-->"),
28
+ auth: blue("---"),
29
+ fs: black("-=-"),
30
+ default: blue("---")
38
31
  },
39
32
  white: {
40
- in: ARROWS.LEFT,
41
- out: ARROWS.RIGHT,
42
- auth: ARROWS.NEUTRAL,
43
- fs: ARROWS.EQUAL,
44
- default: ARROWS.NEUTRAL
33
+ in: "<--",
34
+ out: "-->",
35
+ auth: "---",
36
+ fs: "-=-",
37
+ default: "---"
45
38
  }
46
39
  };
47
40
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"levels.mjs","names":[],"sources":["../src/levels.ts"],"sourcesContent":["import { black, blue, cyan, green, magenta, red, white, yellow } from 'colorette';\n\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'http' | 'warn' | 'error' | 'fatal';\n\nexport type LevelCode = number;\n\nexport function calculateLevel(levelCode: LevelCode): LogLevel {\n switch (true) {\n case levelCode === 10:\n return 'trace';\n case levelCode === 20:\n return 'debug';\n case levelCode === 25:\n return 'http';\n case levelCode === 30:\n return 'info';\n case levelCode === 40:\n return 'warn';\n case levelCode === 50:\n return 'error';\n case levelCode === 60:\n return 'fatal';\n default:\n return 'fatal';\n }\n}\n\nexport const levelsColors = {\n fatal: red,\n error: red,\n warn: yellow,\n http: magenta,\n info: cyan,\n debug: green,\n trace: white,\n};\n\nenum ARROWS {\n LEFT = '<--',\n RIGHT = '-->',\n EQUAL = '-=-',\n NEUTRAL = '---',\n}\n\nexport const subSystemLevels = {\n color: {\n in: green(ARROWS.LEFT),\n out: yellow(ARROWS.RIGHT),\n auth: blue(ARROWS.NEUTRAL),\n fs: black(ARROWS.EQUAL),\n default: blue(ARROWS.NEUTRAL),\n },\n white: {\n in: ARROWS.LEFT,\n out: ARROWS.RIGHT,\n auth: ARROWS.NEUTRAL,\n fs: ARROWS.EQUAL,\n default: ARROWS.NEUTRAL,\n },\n};\n"],"mappings":";;AAMA,SAAgB,eAAe,WAAgC;AAC7D,SAAQ,MAAR;EACE,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,KAAK,cAAc,GACjB,QAAO;EACT,QACE,QAAO;;;AAIb,IAAa,eAAe;CAC1B,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACR;AAED,IAAK,SAAL,yBAAA,QAAA;AACE,QAAA,UAAA;AACA,QAAA,WAAA;AACA,QAAA,WAAA;AACA,QAAA,aAAA;;EAJG,UAAA,EAAA,CAKJ;AAED,IAAa,kBAAkB;CAC7B,OAAO;EACL,IAAI,MAAM,OAAO,KAAK;EACtB,KAAK,OAAO,OAAO,MAAM;EACzB,MAAM,KAAK,OAAO,QAAQ;EAC1B,IAAI,MAAM,OAAO,MAAM;EACvB,SAAS,KAAK,OAAO,QAAQ;EAC9B;CACD,OAAO;EACL,IAAI,OAAO;EACX,KAAK,OAAO;EACZ,MAAM,OAAO;EACb,IAAI,OAAO;EACX,SAAS,OAAO;EACjB;CACF"}
1
+ {"version":3,"file":"levels.mjs","names":[],"sources":["../src/levels.ts"],"sourcesContent":["import { black, blue, cyan, green, magenta, red, white, yellow } from 'colorette';\n\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'http' | 'warn' | 'error' | 'fatal';\n\nexport type LevelCode = number;\n\nexport function calculateLevel(levelCode: LevelCode): LogLevel {\n switch (true) {\n case levelCode === 10:\n return 'trace';\n case levelCode === 20:\n return 'debug';\n case levelCode === 25:\n return 'http';\n case levelCode === 30:\n return 'info';\n case levelCode === 40:\n return 'warn';\n case levelCode === 50:\n return 'error';\n case levelCode === 60:\n return 'fatal';\n default:\n return 'fatal';\n }\n}\n\nexport const levelsColors = {\n fatal: red,\n error: red,\n warn: yellow,\n http: magenta,\n info: cyan,\n debug: green,\n trace: white,\n};\n\nenum ARROWS {\n LEFT = '<--',\n RIGHT = '-->',\n EQUAL = '-=-',\n NEUTRAL = '---',\n}\n\nexport const subSystemLevels = {\n color: {\n in: green(ARROWS.LEFT),\n out: yellow(ARROWS.RIGHT),\n auth: blue(ARROWS.NEUTRAL),\n fs: black(ARROWS.EQUAL),\n default: blue(ARROWS.NEUTRAL),\n },\n white: {\n in: ARROWS.LEFT,\n out: ARROWS.RIGHT,\n auth: ARROWS.NEUTRAL,\n fs: ARROWS.EQUAL,\n default: ARROWS.NEUTRAL,\n },\n};\n"],"mappings":";;AAMA,SAAgB,eAAe,WAAgC;CAC7D,QAAQ,MAAR;EACE,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,KAAK,cAAc,IACjB,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,IAAa,eAAe;CAC1B,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;AACT;AASA,IAAa,kBAAkB;CAC7B,OAAO;EACL,IAAI,MAAA,KAAiB;EACrB,KAAK,OAAA,KAAmB;EACxB,MAAM,KAAA,KAAmB;EACzB,IAAI,MAAA,KAAkB;EACtB,SAAS,KAAA,KAAmB;CAC9B;CACA,OAAO;EACL,IAAA;EACA,KAAA;EACA,MAAA;EACA,IAAA;EACA,SAAA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","names":[],"sources":["../src/logger.ts"],"sourcesContent":["// <reference types=\"node\" />\nimport buildDebug from 'debug';\nimport type { LoggerOptions } from 'pino';\n\nimport type { Logger, LoggerConfigItem, LoggerFormat } from '@verdaccio/types';\n\nimport { fillInMsgTemplate } from './formatter';\nimport { createPrettyTransport, isPrettyFormat } from './transport';\n\nconst debug = buildDebug('verdaccio:logger');\n\nfunction isProd() {\n return process.env.NODE_ENV === 'production';\n}\n\nconst DEFAULT_LOG_FORMAT = isProd() ? 'json' : 'pretty';\ndebug('default log format: %s', DEFAULT_LOG_FORMAT);\n\nexport type LogPlugin = {\n dest: string;\n options?: any[];\n};\n\nexport function createLogger(\n options: LoggerConfigItem = { level: 'http' },\n destination: NodeJS.WritableStream | undefined,\n format: LoggerFormat = DEFAULT_LOG_FORMAT,\n pino\n): any {\n debug('setup logger');\n let pinoConfig: LoggerOptions = {\n customLevels: {\n http: 25,\n },\n level: options.level,\n serializers: {\n err: pino.stdSerializers.err,\n req: pino.stdSerializers.req,\n res: pino.stdSerializers.res,\n },\n redact: options.redact,\n };\n\n debug('has prettifier? %o', !isProd());\n let logger;\n // pretty logs are not allowed in production for performance reasons\n if (isPrettyFormat(format) && isProd() === false) {\n const transport = createPrettyTransport(pino, options, format);\n logger = pino(pinoConfig, transport);\n } else {\n pinoConfig = {\n ...pinoConfig,\n // https://getpino.io/#/docs/api?id=hooks-object\n hooks: {\n logMethod(args: [obj: unknown, msg?: string, ...rest: unknown[]], method, _level) {\n const [templateObject, message, ...otherArgs] = args;\n const templateVars =\n !!templateObject && typeof templateObject === 'object'\n ? Object.getOwnPropertyNames(templateObject)\n : [];\n if (!message || !templateVars.length) return method.apply(this, args);\n const hydratedMessage = fillInMsgTemplate(message, templateObject as any, false);\n return method.apply(this, [templateObject, hydratedMessage, ...otherArgs] as any);\n },\n },\n };\n logger = pino(pinoConfig, destination);\n }\n\n if (process.env.DEBUG) {\n logger.on('level-change', (lvl, val, prevLvl, prevVal, instance) => {\n if (logger !== instance) {\n return;\n }\n debug('%s (%d) was changed to %s (%d)', lvl, val, prevLvl, prevVal);\n });\n }\n\n return logger;\n}\n\nconst DEFAULT_LOGGER_CONF: LoggerConfigItem = {\n type: 'stdout',\n format: 'pretty',\n level: 'http',\n};\n\nexport type LoggerConfig = LoggerConfigItem;\n\nexport function willUseTransport(format: LoggerFormat | undefined): boolean {\n const resolvedFormat = format ?? (isProd() ? 'json' : 'pretty');\n return isPrettyFormat(resolvedFormat) && isProd() === false;\n}\n\nexport async function prepareSetup(\n options: LoggerConfigItem = DEFAULT_LOGGER_CONF,\n pino\n): Promise<Logger> {\n let loggerConfig = options;\n if (!loggerConfig?.level) {\n loggerConfig = {\n ...loggerConfig,\n level: 'http',\n };\n }\n if (loggerConfig.type === 'file') {\n debug('logging file enabled');\n // Pretty format uses a pino transport that creates its own destination stream,\n // so no destination is needed here.\n if (willUseTransport(loggerConfig.format)) {\n return createLogger(loggerConfig, undefined, loggerConfig.format, pino);\n }\n // For file destinations (json format), wait for the fd to be ready\n // so we fail fast on bad paths / permissions instead of losing early logs\n const destination = pino.destination(loggerConfig.path);\n await new Promise<void>((resolve, reject) => {\n destination.once('ready', resolve);\n destination.once('error', reject);\n });\n debug('file destination ready: %s', loggerConfig.path);\n process.on('SIGUSR2', () => destination.reopen());\n return createLogger(loggerConfig, destination, loggerConfig.format, pino);\n }\n debug('logging stdout enabled');\n return createLogger(loggerConfig, pino.destination(1), loggerConfig.format, pino);\n}\n"],"mappings":";;;;;;AASA,IAAM,WAAA,GAAA,MAAA,SAAmB,mBAAmB;AAE5C,SAAS,SAAS;AAChB,QAAA,QAAA,IAAA,aAAgC;;AAGlC,IAAM,qBAAqB,QAAQ,GAAG,SAAS;AAC/C,QAAM,0BAA0B,mBAAmB;AAOnD,SAAgB,aACd,UAA4B,EAAE,OAAO,QAAQ,EAC7C,aACA,SAAuB,oBACvB,MACK;AACL,SAAM,eAAe;CACrB,IAAI,aAA4B;EAC9B,cAAc,EACZ,MAAM,IACP;EACD,OAAO,QAAQ;EACf,aAAa;GACX,KAAK,KAAK,eAAe;GACzB,KAAK,KAAK,eAAe;GACzB,KAAK,KAAK,eAAe;GAC1B;EACD,QAAQ,QAAQ;EACjB;AAED,SAAM,sBAAsB,CAAC,QAAQ,CAAC;CACtC,IAAI;AAEJ,KAAI,kBAAA,eAAe,OAAO,IAAI,QAAQ,KAAK,OAAO;EAChD,MAAM,YAAY,kBAAA,sBAAsB,MAAM,SAAS,OAAO;AAC9D,WAAS,KAAK,YAAY,UAAU;QAC/B;AACL,eAAa;GACX,GAAG;GAEH,OAAO,EACL,UAAU,MAAwD,QAAQ,QAAQ;IAChF,MAAM,CAAC,gBAAgB,SAAS,GAAG,aAAa;AAKhD,QAAI,CAAC,WAAW,EAHd,CAAC,CAAC,kBAAkB,OAAO,mBAAmB,WAC1C,OAAO,oBAAoB,eAAe,GAC1C,EAAE,EACsB,OAAQ,QAAO,OAAO,MAAM,MAAM,KAAK;IACrE,MAAM,kBAAkB,kBAAA,kBAAkB,SAAS,gBAAuB,MAAM;AAChF,WAAO,OAAO,MAAM,MAAM;KAAC;KAAgB;KAAiB,GAAG;KAAU,CAAQ;MAEpF;GACF;AACD,WAAS,KAAK,YAAY,YAAY;;AAGxC,KAAI,QAAQ,IAAI,MACd,QAAO,GAAG,iBAAiB,KAAK,KAAK,SAAS,SAAS,aAAa;AAClE,MAAI,WAAW,SACb;AAEF,UAAM,kCAAkC,KAAK,KAAK,SAAS,QAAQ;GACnE;AAGJ,QAAO;;AAGT,IAAM,sBAAwC;CAC5C,MAAM;CACN,QAAQ;CACR,OAAO;CACR;AAID,SAAgB,iBAAiB,QAA2C;AAE1E,QAAO,kBAAA,eADgB,WAAW,QAAQ,GAAG,SAAS,UACjB,IAAI,QAAQ,KAAK;;AAGxD,eAAsB,aACpB,UAA4B,qBAC5B,MACiB;CACjB,IAAI,eAAe;AACnB,KAAI,CAAC,cAAc,MACjB,gBAAe;EACb,GAAG;EACH,OAAO;EACR;AAEH,KAAI,aAAa,SAAS,QAAQ;AAChC,UAAM,uBAAuB;AAG7B,MAAI,iBAAiB,aAAa,OAAO,CACvC,QAAO,aAAa,cAAc,KAAA,GAAW,aAAa,QAAQ,KAAK;EAIzE,MAAM,cAAc,KAAK,YAAY,aAAa,KAAK;AACvD,QAAM,IAAI,SAAe,SAAS,WAAW;AAC3C,eAAY,KAAK,SAAS,QAAQ;AAClC,eAAY,KAAK,SAAS,OAAO;IACjC;AACF,UAAM,8BAA8B,aAAa,KAAK;AACtD,UAAQ,GAAG,iBAAiB,YAAY,QAAQ,CAAC;AACjD,SAAO,aAAa,cAAc,aAAa,aAAa,QAAQ,KAAK;;AAE3E,SAAM,yBAAyB;AAC/B,QAAO,aAAa,cAAc,KAAK,YAAY,EAAE,EAAE,aAAa,QAAQ,KAAK"}
1
+ {"version":3,"file":"logger.js","names":[],"sources":["../src/logger.ts"],"sourcesContent":["// <reference types=\"node\" />\nimport buildDebug from 'debug';\nimport type { LoggerOptions } from 'pino';\n\nimport type { Logger, LoggerConfigItem, LoggerFormat } from '@verdaccio/types';\n\nimport { fillInMsgTemplate } from './formatter';\nimport { createPrettyTransport, isPrettyFormat } from './transport';\n\nconst debug = buildDebug('verdaccio:logger');\n\nfunction isProd() {\n return process.env.NODE_ENV === 'production';\n}\n\nconst DEFAULT_LOG_FORMAT = isProd() ? 'json' : 'pretty';\ndebug('default log format: %s', DEFAULT_LOG_FORMAT);\n\nexport type LogPlugin = {\n dest: string;\n options?: any[];\n};\n\nexport function createLogger(\n options: LoggerConfigItem = { level: 'http' },\n destination: NodeJS.WritableStream | undefined,\n format: LoggerFormat = DEFAULT_LOG_FORMAT,\n pino\n): any {\n debug('setup logger');\n let pinoConfig: LoggerOptions = {\n customLevels: {\n http: 25,\n },\n level: options.level,\n serializers: {\n err: pino.stdSerializers.err,\n req: pino.stdSerializers.req,\n res: pino.stdSerializers.res,\n },\n redact: options.redact,\n };\n\n debug('has prettifier? %o', !isProd());\n let logger;\n // pretty logs are not allowed in production for performance reasons\n if (isPrettyFormat(format) && isProd() === false) {\n const transport = createPrettyTransport(pino, options, format);\n logger = pino(pinoConfig, transport);\n } else {\n pinoConfig = {\n ...pinoConfig,\n // https://getpino.io/#/docs/api?id=hooks-object\n hooks: {\n logMethod(args: [obj: unknown, msg?: string, ...rest: unknown[]], method, _level) {\n const [templateObject, message, ...otherArgs] = args;\n const templateVars =\n !!templateObject && typeof templateObject === 'object'\n ? Object.getOwnPropertyNames(templateObject)\n : [];\n if (!message || !templateVars.length) return method.apply(this, args);\n const hydratedMessage = fillInMsgTemplate(message, templateObject as any, false);\n return method.apply(this, [templateObject, hydratedMessage, ...otherArgs] as any);\n },\n },\n };\n logger = pino(pinoConfig, destination);\n }\n\n if (process.env.DEBUG) {\n logger.on('level-change', (lvl, val, prevLvl, prevVal, instance) => {\n if (logger !== instance) {\n return;\n }\n debug('%s (%d) was changed to %s (%d)', lvl, val, prevLvl, prevVal);\n });\n }\n\n return logger;\n}\n\nconst DEFAULT_LOGGER_CONF: LoggerConfigItem = {\n type: 'stdout',\n format: 'pretty',\n level: 'http',\n};\n\nexport type LoggerConfig = LoggerConfigItem;\n\nexport function willUseTransport(format: LoggerFormat | undefined): boolean {\n const resolvedFormat = format ?? (isProd() ? 'json' : 'pretty');\n return isPrettyFormat(resolvedFormat) && isProd() === false;\n}\n\nexport async function prepareSetup(\n options: LoggerConfigItem = DEFAULT_LOGGER_CONF,\n pino\n): Promise<Logger> {\n let loggerConfig = options;\n if (!loggerConfig?.level) {\n loggerConfig = {\n ...loggerConfig,\n level: 'http',\n };\n }\n if (loggerConfig.type === 'file') {\n debug('logging file enabled');\n // Pretty format uses a pino transport that creates its own destination stream,\n // so no destination is needed here.\n if (willUseTransport(loggerConfig.format)) {\n return createLogger(loggerConfig, undefined, loggerConfig.format, pino);\n }\n // For file destinations (json format), wait for the fd to be ready\n // so we fail fast on bad paths / permissions instead of losing early logs\n const destination = pino.destination(loggerConfig.path);\n await new Promise<void>((resolve, reject) => {\n destination.once('ready', resolve);\n destination.once('error', reject);\n });\n debug('file destination ready: %s', loggerConfig.path);\n process.on('SIGUSR2', () => destination.reopen());\n return createLogger(loggerConfig, destination, loggerConfig.format, pino);\n }\n debug('logging stdout enabled');\n return createLogger(loggerConfig, pino.destination(1), loggerConfig.format, pino);\n}\n"],"mappings":";;;;;;AASA,IAAM,WAAA,GAAA,MAAA,SAAmB,kBAAkB;AAE3C,SAAS,SAAS;CAChB,OAAA,QAAA,IAAA,aAAgC;AAClC;AAEA,IAAM,qBAAqB,OAAO,IAAI,SAAS;AAC/C,QAAM,0BAA0B,kBAAkB;AAOlD,SAAgB,aACd,UAA4B,EAAE,OAAO,OAAO,GAC5C,aACA,SAAuB,oBACvB,MACK;CACL,QAAM,cAAc;CACpB,IAAI,aAA4B;EAC9B,cAAc,EACZ,MAAM,GACR;EACA,OAAO,QAAQ;EACf,aAAa;GACX,KAAK,KAAK,eAAe;GACzB,KAAK,KAAK,eAAe;GACzB,KAAK,KAAK,eAAe;EAC3B;EACA,QAAQ,QAAQ;CAClB;CAEA,QAAM,sBAAsB,CAAC,OAAO,CAAC;CACrC,IAAI;CAEJ,IAAI,kBAAA,eAAe,MAAM,KAAK,OAAO,MAAM,OAAO;EAChD,MAAM,YAAY,kBAAA,sBAAsB,MAAM,SAAS,MAAM;EAC7D,SAAS,KAAK,YAAY,SAAS;CACrC,OAAO;EACL,aAAa;GACX,GAAG;GAEH,OAAO,EACL,UAAU,MAAwD,QAAQ,QAAQ;IAChF,MAAM,CAAC,gBAAgB,SAAS,GAAG,aAAa;IAKhD,IAAI,CAAC,WAAW,EAHd,CAAC,CAAC,kBAAkB,OAAO,mBAAmB,WAC1C,OAAO,oBAAoB,cAAc,IACzC,CAAC,GACuB,QAAQ,OAAO,OAAO,MAAM,MAAM,IAAI;IACpE,MAAM,kBAAkB,kBAAA,kBAAkB,SAAS,gBAAuB,KAAK;IAC/E,OAAO,OAAO,MAAM,MAAM;KAAC;KAAgB;KAAiB,GAAG;IAAS,CAAQ;GAClF,EACF;EACF;EACA,SAAS,KAAK,YAAY,WAAW;CACvC;CAEA,IAAI,QAAQ,IAAI,OACd,OAAO,GAAG,iBAAiB,KAAK,KAAK,SAAS,SAAS,aAAa;EAClE,IAAI,WAAW,UACb;EAEF,QAAM,kCAAkC,KAAK,KAAK,SAAS,OAAO;CACpE,CAAC;CAGH,OAAO;AACT;AAEA,IAAM,sBAAwC;CAC5C,MAAM;CACN,QAAQ;CACR,OAAO;AACT;AAIA,SAAgB,iBAAiB,QAA2C;CAE1E,OAAO,kBAAA,eADgB,WAAW,OAAO,IAAI,SAAS,SAClB,KAAK,OAAO,MAAM;AACxD;AAEA,eAAsB,aACpB,UAA4B,qBAC5B,MACiB;CACjB,IAAI,eAAe;CACnB,IAAI,CAAC,cAAc,OACjB,eAAe;EACb,GAAG;EACH,OAAO;CACT;CAEF,IAAI,aAAa,SAAS,QAAQ;EAChC,QAAM,sBAAsB;EAG5B,IAAI,iBAAiB,aAAa,MAAM,GACtC,OAAO,aAAa,cAAc,KAAA,GAAW,aAAa,QAAQ,IAAI;EAIxE,MAAM,cAAc,KAAK,YAAY,aAAa,IAAI;EACtD,MAAM,IAAI,SAAe,SAAS,WAAW;GAC3C,YAAY,KAAK,SAAS,OAAO;GACjC,YAAY,KAAK,SAAS,MAAM;EAClC,CAAC;EACD,QAAM,8BAA8B,aAAa,IAAI;EACrD,QAAQ,GAAG,iBAAiB,YAAY,OAAO,CAAC;EAChD,OAAO,aAAa,cAAc,aAAa,aAAa,QAAQ,IAAI;CAC1E;CACA,QAAM,wBAAwB;CAC9B,OAAO,aAAa,cAAc,KAAK,YAAY,CAAC,GAAG,aAAa,QAAQ,IAAI;AAClF"}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.mjs","names":[],"sources":["../src/logger.ts"],"sourcesContent":["// <reference types=\"node\" />\nimport buildDebug from 'debug';\nimport type { LoggerOptions } from 'pino';\n\nimport type { Logger, LoggerConfigItem, LoggerFormat } from '@verdaccio/types';\n\nimport { fillInMsgTemplate } from './formatter';\nimport { createPrettyTransport, isPrettyFormat } from './transport';\n\nconst debug = buildDebug('verdaccio:logger');\n\nfunction isProd() {\n return process.env.NODE_ENV === 'production';\n}\n\nconst DEFAULT_LOG_FORMAT = isProd() ? 'json' : 'pretty';\ndebug('default log format: %s', DEFAULT_LOG_FORMAT);\n\nexport type LogPlugin = {\n dest: string;\n options?: any[];\n};\n\nexport function createLogger(\n options: LoggerConfigItem = { level: 'http' },\n destination: NodeJS.WritableStream | undefined,\n format: LoggerFormat = DEFAULT_LOG_FORMAT,\n pino\n): any {\n debug('setup logger');\n let pinoConfig: LoggerOptions = {\n customLevels: {\n http: 25,\n },\n level: options.level,\n serializers: {\n err: pino.stdSerializers.err,\n req: pino.stdSerializers.req,\n res: pino.stdSerializers.res,\n },\n redact: options.redact,\n };\n\n debug('has prettifier? %o', !isProd());\n let logger;\n // pretty logs are not allowed in production for performance reasons\n if (isPrettyFormat(format) && isProd() === false) {\n const transport = createPrettyTransport(pino, options, format);\n logger = pino(pinoConfig, transport);\n } else {\n pinoConfig = {\n ...pinoConfig,\n // https://getpino.io/#/docs/api?id=hooks-object\n hooks: {\n logMethod(args: [obj: unknown, msg?: string, ...rest: unknown[]], method, _level) {\n const [templateObject, message, ...otherArgs] = args;\n const templateVars =\n !!templateObject && typeof templateObject === 'object'\n ? Object.getOwnPropertyNames(templateObject)\n : [];\n if (!message || !templateVars.length) return method.apply(this, args);\n const hydratedMessage = fillInMsgTemplate(message, templateObject as any, false);\n return method.apply(this, [templateObject, hydratedMessage, ...otherArgs] as any);\n },\n },\n };\n logger = pino(pinoConfig, destination);\n }\n\n if (process.env.DEBUG) {\n logger.on('level-change', (lvl, val, prevLvl, prevVal, instance) => {\n if (logger !== instance) {\n return;\n }\n debug('%s (%d) was changed to %s (%d)', lvl, val, prevLvl, prevVal);\n });\n }\n\n return logger;\n}\n\nconst DEFAULT_LOGGER_CONF: LoggerConfigItem = {\n type: 'stdout',\n format: 'pretty',\n level: 'http',\n};\n\nexport type LoggerConfig = LoggerConfigItem;\n\nexport function willUseTransport(format: LoggerFormat | undefined): boolean {\n const resolvedFormat = format ?? (isProd() ? 'json' : 'pretty');\n return isPrettyFormat(resolvedFormat) && isProd() === false;\n}\n\nexport async function prepareSetup(\n options: LoggerConfigItem = DEFAULT_LOGGER_CONF,\n pino\n): Promise<Logger> {\n let loggerConfig = options;\n if (!loggerConfig?.level) {\n loggerConfig = {\n ...loggerConfig,\n level: 'http',\n };\n }\n if (loggerConfig.type === 'file') {\n debug('logging file enabled');\n // Pretty format uses a pino transport that creates its own destination stream,\n // so no destination is needed here.\n if (willUseTransport(loggerConfig.format)) {\n return createLogger(loggerConfig, undefined, loggerConfig.format, pino);\n }\n // For file destinations (json format), wait for the fd to be ready\n // so we fail fast on bad paths / permissions instead of losing early logs\n const destination = pino.destination(loggerConfig.path);\n await new Promise<void>((resolve, reject) => {\n destination.once('ready', resolve);\n destination.once('error', reject);\n });\n debug('file destination ready: %s', loggerConfig.path);\n process.on('SIGUSR2', () => destination.reopen());\n return createLogger(loggerConfig, destination, loggerConfig.format, pino);\n }\n debug('logging stdout enabled');\n return createLogger(loggerConfig, pino.destination(1), loggerConfig.format, pino);\n}\n"],"mappings":";;;;AASA,IAAM,QAAQ,WAAW,mBAAmB;AAE5C,SAAS,SAAS;AAChB,QAAA,QAAA,IAAA,aAAgC;;AAGlC,IAAM,qBAAqB,QAAQ,GAAG,SAAS;AAC/C,MAAM,0BAA0B,mBAAmB;AAOnD,SAAgB,aACd,UAA4B,EAAE,OAAO,QAAQ,EAC7C,aACA,SAAuB,oBACvB,MACK;AACL,OAAM,eAAe;CACrB,IAAI,aAA4B;EAC9B,cAAc,EACZ,MAAM,IACP;EACD,OAAO,QAAQ;EACf,aAAa;GACX,KAAK,KAAK,eAAe;GACzB,KAAK,KAAK,eAAe;GACzB,KAAK,KAAK,eAAe;GAC1B;EACD,QAAQ,QAAQ;EACjB;AAED,OAAM,sBAAsB,CAAC,QAAQ,CAAC;CACtC,IAAI;AAEJ,KAAI,eAAe,OAAO,IAAI,QAAQ,KAAK,OAAO;EAChD,MAAM,YAAY,sBAAsB,MAAM,SAAS,OAAO;AAC9D,WAAS,KAAK,YAAY,UAAU;QAC/B;AACL,eAAa;GACX,GAAG;GAEH,OAAO,EACL,UAAU,MAAwD,QAAQ,QAAQ;IAChF,MAAM,CAAC,gBAAgB,SAAS,GAAG,aAAa;AAKhD,QAAI,CAAC,WAAW,EAHd,CAAC,CAAC,kBAAkB,OAAO,mBAAmB,WAC1C,OAAO,oBAAoB,eAAe,GAC1C,EAAE,EACsB,OAAQ,QAAO,OAAO,MAAM,MAAM,KAAK;IACrE,MAAM,kBAAkB,kBAAkB,SAAS,gBAAuB,MAAM;AAChF,WAAO,OAAO,MAAM,MAAM;KAAC;KAAgB;KAAiB,GAAG;KAAU,CAAQ;MAEpF;GACF;AACD,WAAS,KAAK,YAAY,YAAY;;AAGxC,KAAI,QAAQ,IAAI,MACd,QAAO,GAAG,iBAAiB,KAAK,KAAK,SAAS,SAAS,aAAa;AAClE,MAAI,WAAW,SACb;AAEF,QAAM,kCAAkC,KAAK,KAAK,SAAS,QAAQ;GACnE;AAGJ,QAAO;;AAGT,IAAM,sBAAwC;CAC5C,MAAM;CACN,QAAQ;CACR,OAAO;CACR;AAID,SAAgB,iBAAiB,QAA2C;AAE1E,QAAO,eADgB,WAAW,QAAQ,GAAG,SAAS,UACjB,IAAI,QAAQ,KAAK;;AAGxD,eAAsB,aACpB,UAA4B,qBAC5B,MACiB;CACjB,IAAI,eAAe;AACnB,KAAI,CAAC,cAAc,MACjB,gBAAe;EACb,GAAG;EACH,OAAO;EACR;AAEH,KAAI,aAAa,SAAS,QAAQ;AAChC,QAAM,uBAAuB;AAG7B,MAAI,iBAAiB,aAAa,OAAO,CACvC,QAAO,aAAa,cAAc,KAAA,GAAW,aAAa,QAAQ,KAAK;EAIzE,MAAM,cAAc,KAAK,YAAY,aAAa,KAAK;AACvD,QAAM,IAAI,SAAe,SAAS,WAAW;AAC3C,eAAY,KAAK,SAAS,QAAQ;AAClC,eAAY,KAAK,SAAS,OAAO;IACjC;AACF,QAAM,8BAA8B,aAAa,KAAK;AACtD,UAAQ,GAAG,iBAAiB,YAAY,QAAQ,CAAC;AACjD,SAAO,aAAa,cAAc,aAAa,aAAa,QAAQ,KAAK;;AAE3E,OAAM,yBAAyB;AAC/B,QAAO,aAAa,cAAc,KAAK,YAAY,EAAE,EAAE,aAAa,QAAQ,KAAK"}
1
+ {"version":3,"file":"logger.mjs","names":[],"sources":["../src/logger.ts"],"sourcesContent":["// <reference types=\"node\" />\nimport buildDebug from 'debug';\nimport type { LoggerOptions } from 'pino';\n\nimport type { Logger, LoggerConfigItem, LoggerFormat } from '@verdaccio/types';\n\nimport { fillInMsgTemplate } from './formatter';\nimport { createPrettyTransport, isPrettyFormat } from './transport';\n\nconst debug = buildDebug('verdaccio:logger');\n\nfunction isProd() {\n return process.env.NODE_ENV === 'production';\n}\n\nconst DEFAULT_LOG_FORMAT = isProd() ? 'json' : 'pretty';\ndebug('default log format: %s', DEFAULT_LOG_FORMAT);\n\nexport type LogPlugin = {\n dest: string;\n options?: any[];\n};\n\nexport function createLogger(\n options: LoggerConfigItem = { level: 'http' },\n destination: NodeJS.WritableStream | undefined,\n format: LoggerFormat = DEFAULT_LOG_FORMAT,\n pino\n): any {\n debug('setup logger');\n let pinoConfig: LoggerOptions = {\n customLevels: {\n http: 25,\n },\n level: options.level,\n serializers: {\n err: pino.stdSerializers.err,\n req: pino.stdSerializers.req,\n res: pino.stdSerializers.res,\n },\n redact: options.redact,\n };\n\n debug('has prettifier? %o', !isProd());\n let logger;\n // pretty logs are not allowed in production for performance reasons\n if (isPrettyFormat(format) && isProd() === false) {\n const transport = createPrettyTransport(pino, options, format);\n logger = pino(pinoConfig, transport);\n } else {\n pinoConfig = {\n ...pinoConfig,\n // https://getpino.io/#/docs/api?id=hooks-object\n hooks: {\n logMethod(args: [obj: unknown, msg?: string, ...rest: unknown[]], method, _level) {\n const [templateObject, message, ...otherArgs] = args;\n const templateVars =\n !!templateObject && typeof templateObject === 'object'\n ? Object.getOwnPropertyNames(templateObject)\n : [];\n if (!message || !templateVars.length) return method.apply(this, args);\n const hydratedMessage = fillInMsgTemplate(message, templateObject as any, false);\n return method.apply(this, [templateObject, hydratedMessage, ...otherArgs] as any);\n },\n },\n };\n logger = pino(pinoConfig, destination);\n }\n\n if (process.env.DEBUG) {\n logger.on('level-change', (lvl, val, prevLvl, prevVal, instance) => {\n if (logger !== instance) {\n return;\n }\n debug('%s (%d) was changed to %s (%d)', lvl, val, prevLvl, prevVal);\n });\n }\n\n return logger;\n}\n\nconst DEFAULT_LOGGER_CONF: LoggerConfigItem = {\n type: 'stdout',\n format: 'pretty',\n level: 'http',\n};\n\nexport type LoggerConfig = LoggerConfigItem;\n\nexport function willUseTransport(format: LoggerFormat | undefined): boolean {\n const resolvedFormat = format ?? (isProd() ? 'json' : 'pretty');\n return isPrettyFormat(resolvedFormat) && isProd() === false;\n}\n\nexport async function prepareSetup(\n options: LoggerConfigItem = DEFAULT_LOGGER_CONF,\n pino\n): Promise<Logger> {\n let loggerConfig = options;\n if (!loggerConfig?.level) {\n loggerConfig = {\n ...loggerConfig,\n level: 'http',\n };\n }\n if (loggerConfig.type === 'file') {\n debug('logging file enabled');\n // Pretty format uses a pino transport that creates its own destination stream,\n // so no destination is needed here.\n if (willUseTransport(loggerConfig.format)) {\n return createLogger(loggerConfig, undefined, loggerConfig.format, pino);\n }\n // For file destinations (json format), wait for the fd to be ready\n // so we fail fast on bad paths / permissions instead of losing early logs\n const destination = pino.destination(loggerConfig.path);\n await new Promise<void>((resolve, reject) => {\n destination.once('ready', resolve);\n destination.once('error', reject);\n });\n debug('file destination ready: %s', loggerConfig.path);\n process.on('SIGUSR2', () => destination.reopen());\n return createLogger(loggerConfig, destination, loggerConfig.format, pino);\n }\n debug('logging stdout enabled');\n return createLogger(loggerConfig, pino.destination(1), loggerConfig.format, pino);\n}\n"],"mappings":";;;;AASA,IAAM,QAAQ,WAAW,kBAAkB;AAE3C,SAAS,SAAS;CAChB,OAAA,QAAA,IAAA,aAAgC;AAClC;AAEA,IAAM,qBAAqB,OAAO,IAAI,SAAS;AAC/C,MAAM,0BAA0B,kBAAkB;AAOlD,SAAgB,aACd,UAA4B,EAAE,OAAO,OAAO,GAC5C,aACA,SAAuB,oBACvB,MACK;CACL,MAAM,cAAc;CACpB,IAAI,aAA4B;EAC9B,cAAc,EACZ,MAAM,GACR;EACA,OAAO,QAAQ;EACf,aAAa;GACX,KAAK,KAAK,eAAe;GACzB,KAAK,KAAK,eAAe;GACzB,KAAK,KAAK,eAAe;EAC3B;EACA,QAAQ,QAAQ;CAClB;CAEA,MAAM,sBAAsB,CAAC,OAAO,CAAC;CACrC,IAAI;CAEJ,IAAI,eAAe,MAAM,KAAK,OAAO,MAAM,OAAO;EAChD,MAAM,YAAY,sBAAsB,MAAM,SAAS,MAAM;EAC7D,SAAS,KAAK,YAAY,SAAS;CACrC,OAAO;EACL,aAAa;GACX,GAAG;GAEH,OAAO,EACL,UAAU,MAAwD,QAAQ,QAAQ;IAChF,MAAM,CAAC,gBAAgB,SAAS,GAAG,aAAa;IAKhD,IAAI,CAAC,WAAW,EAHd,CAAC,CAAC,kBAAkB,OAAO,mBAAmB,WAC1C,OAAO,oBAAoB,cAAc,IACzC,CAAC,GACuB,QAAQ,OAAO,OAAO,MAAM,MAAM,IAAI;IACpE,MAAM,kBAAkB,kBAAkB,SAAS,gBAAuB,KAAK;IAC/E,OAAO,OAAO,MAAM,MAAM;KAAC;KAAgB;KAAiB,GAAG;IAAS,CAAQ;GAClF,EACF;EACF;EACA,SAAS,KAAK,YAAY,WAAW;CACvC;CAEA,IAAI,QAAQ,IAAI,OACd,OAAO,GAAG,iBAAiB,KAAK,KAAK,SAAS,SAAS,aAAa;EAClE,IAAI,WAAW,UACb;EAEF,MAAM,kCAAkC,KAAK,KAAK,SAAS,OAAO;CACpE,CAAC;CAGH,OAAO;AACT;AAEA,IAAM,sBAAwC;CAC5C,MAAM;CACN,QAAQ;CACR,OAAO;AACT;AAIA,SAAgB,iBAAiB,QAA2C;CAE1E,OAAO,eADgB,WAAW,OAAO,IAAI,SAAS,SAClB,KAAK,OAAO,MAAM;AACxD;AAEA,eAAsB,aACpB,UAA4B,qBAC5B,MACiB;CACjB,IAAI,eAAe;CACnB,IAAI,CAAC,cAAc,OACjB,eAAe;EACb,GAAG;EACH,OAAO;CACT;CAEF,IAAI,aAAa,SAAS,QAAQ;EAChC,MAAM,sBAAsB;EAG5B,IAAI,iBAAiB,aAAa,MAAM,GACtC,OAAO,aAAa,cAAc,KAAA,GAAW,aAAa,QAAQ,IAAI;EAIxE,MAAM,cAAc,KAAK,YAAY,aAAa,IAAI;EACtD,MAAM,IAAI,SAAe,SAAS,WAAW;GAC3C,YAAY,KAAK,SAAS,OAAO;GACjC,YAAY,KAAK,SAAS,MAAM;EAClC,CAAC;EACD,MAAM,8BAA8B,aAAa,IAAI;EACrD,QAAQ,GAAG,iBAAiB,YAAY,OAAO,CAAC;EAChD,OAAO,aAAa,cAAc,aAAa,aAAa,QAAQ,IAAI;CAC1E;CACA,MAAM,wBAAwB;CAC9B,OAAO,aAAa,cAAc,KAAK,YAAY,CAAC,GAAG,aAAa,QAAQ,IAAI;AAClF"}
@@ -1 +1 @@
1
- {"version":3,"file":"prettify.js","names":[],"sources":["../src/prettify.ts"],"sourcesContent":["import type { WriteStream } from 'node:fs';\nimport { Transform, pipeline } from 'node:stream';\nimport { isMainThread } from 'node:worker_threads';\nimport build from 'pino-abstract-transport';\nimport type { SonicBoomOpts } from 'sonic-boom';\nimport SonicBoom from 'sonic-boom';\n\nimport { hasColors } from './colors';\nimport { fillInMsgTemplate, printMessage } from './formatter';\nimport type { PrettyOptionsExtended } from './types';\n\nexport { fillInMsgTemplate };\n\nfunction noop() {}\n\n/**\n * Creates a safe SonicBoom instance\n *\n * @param {object} opts Options for SonicBoom\n *\n * @returns {object} A new SonicBoom stream\n */\nexport function buildSafeSonicBoom(opts: SonicBoomOpts) {\n const stream = new SonicBoom(opts);\n stream.on('error', filterBrokenPipe);\n if (!opts.sync && isMainThread) {\n setupOnExit(stream);\n }\n return stream;\n\n function filterBrokenPipe(err) {\n if (err.code === 'EPIPE') {\n // @ts-ignore\n stream.write = noop;\n stream.end = noop;\n stream.flushSync = noop;\n stream.destroy = noop;\n return;\n }\n stream.removeListener('error', filterBrokenPipe);\n }\n}\n\nexport function autoEnd(stream: SonicBoom & { destroyed?: boolean }, eventName: string) {\n if (stream.destroyed) {\n return;\n }\n\n if (eventName === 'beforeExit') {\n stream.flush();\n stream.on('drain', function () {\n stream.end();\n });\n } else {\n // Guard against SonicBoom not being ready (file not yet opened)\n // to prevent \"sonic boom is not ready yet\" crash on early process exit\n try {\n stream.flushSync();\n } catch (err: unknown) {\n if (err instanceof Error && err.message?.includes('not ready')) {\n // Stream not ready, nothing to flush\n return;\n }\n // Re-throw real I/O errors (disk full, permission denied, etc.)\n throw err;\n }\n }\n}\n\nfunction setupOnExit(stream) {\n // WeakRef/FinalizationRegistry are guaranteed available in Node 20+ (pino v10 minimum)\n const onExit = require('on-exit-leak-free');\n onExit.register(stream, autoEnd);\n stream.on('close', function () {\n onExit.unregister(stream);\n });\n}\n\nexport { hasColors } from './colors';\n\nexport function buildPretty(opts: PrettyOptionsExtended) {\n return (chunk) => {\n const colors = hasColors(opts.colors);\n return printMessage(chunk, { prettyStamp: opts.prettyStamp }, colors);\n };\n}\n\nexport default function (opts) {\n const pretty = buildPretty(opts);\n // @ts-ignore\n return build(function (source) {\n const stream = new Transform({\n objectMode: true,\n autoDestroy: true,\n transform(chunk, enc, cb) {\n const line = pretty(chunk) + '\\n';\n cb(null, line);\n },\n });\n const destination = buildSafeSonicBoom({\n dest: opts.destination || 1,\n // Defaults to async (false). The transport runs in a worker thread,\n // so sync only blocks the worker, not the main thread.\n // Can be set to true via config for deterministic log ordering (like console.log).\n sync: opts.sync ?? false,\n }) as unknown as WriteStream;\n\n source.on('unknown', function (line) {\n destination.write(line + '\\n');\n });\n\n pipeline(source, stream, destination, (err) => {\n if (err) {\n console.error('prettify pipeline error ', err);\n }\n });\n return stream;\n });\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAS,OAAO;;;;;;;;AAShB,SAAgB,mBAAmB,MAAqB;CACtD,MAAM,SAAS,IAAI,WAAA,QAAU,KAAK;AAClC,QAAO,GAAG,SAAS,iBAAiB;AACpC,KAAI,CAAC,KAAK,QAAQ,oBAAA,aAChB,aAAY,OAAO;AAErB,QAAO;CAEP,SAAS,iBAAiB,KAAK;AAC7B,MAAI,IAAI,SAAS,SAAS;AAExB,UAAO,QAAQ;AACf,UAAO,MAAM;AACb,UAAO,YAAY;AACnB,UAAO,UAAU;AACjB;;AAEF,SAAO,eAAe,SAAS,iBAAiB;;;AAIpD,SAAgB,QAAQ,QAA6C,WAAmB;AACtF,KAAI,OAAO,UACT;AAGF,KAAI,cAAc,cAAc;AAC9B,SAAO,OAAO;AACd,SAAO,GAAG,SAAS,WAAY;AAC7B,UAAO,KAAK;IACZ;OAIF,KAAI;AACF,SAAO,WAAW;UACX,KAAc;AACrB,MAAI,eAAe,SAAS,IAAI,SAAS,SAAS,YAAY,CAE5D;AAGF,QAAM;;;AAKZ,SAAS,YAAY,QAAQ;CAE3B,MAAM,SAAS,QAAQ,oBAAoB;AAC3C,QAAO,SAAS,QAAQ,QAAQ;AAChC,QAAO,GAAG,SAAS,WAAY;AAC7B,SAAO,WAAW,OAAO;GACzB;;AAKJ,SAAgB,YAAY,MAA6B;AACvD,SAAQ,UAAU;EAChB,MAAM,SAAS,eAAA,UAAU,KAAK,OAAO;AACrC,SAAO,kBAAA,aAAa,OAAO,EAAE,aAAa,KAAK,aAAa,EAAE,OAAO;;;AAIzE,SAAA,iBAAyB,MAAM;CAC7B,MAAM,SAAS,YAAY,KAAK;AAEhC,SAAA,GAAA,wBAAA,SAAa,SAAU,QAAQ;EAC7B,MAAM,SAAS,IAAI,YAAA,UAAU;GAC3B,YAAY;GACZ,aAAa;GACb,UAAU,OAAO,KAAK,IAAI;AAExB,OAAG,MADU,OAAO,MAAM,GAAG,KACf;;GAEjB,CAAC;EACF,MAAM,cAAc,mBAAmB;GACrC,MAAM,KAAK,eAAe;GAI1B,MAAM,KAAK,QAAQ;GACpB,CAAC;AAEF,SAAO,GAAG,WAAW,SAAU,MAAM;AACnC,eAAY,MAAM,OAAO,KAAK;IAC9B;AAEF,GAAA,GAAA,YAAA,UAAS,QAAQ,QAAQ,cAAc,QAAQ;AAC7C,OAAI,IACF,SAAQ,MAAM,4BAA4B,IAAI;IAEhD;AACF,SAAO;GACP"}
1
+ {"version":3,"file":"prettify.js","names":[],"sources":["../src/prettify.ts"],"sourcesContent":["import type { WriteStream } from 'node:fs';\nimport { Transform, pipeline } from 'node:stream';\nimport { isMainThread } from 'node:worker_threads';\nimport build from 'pino-abstract-transport';\nimport type { SonicBoomOpts } from 'sonic-boom';\nimport SonicBoom from 'sonic-boom';\n\nimport { hasColors } from './colors';\nimport { fillInMsgTemplate, printMessage } from './formatter';\nimport type { PrettyOptionsExtended } from './types';\n\nexport { fillInMsgTemplate };\n\nfunction noop() {}\n\n/**\n * Creates a safe SonicBoom instance\n *\n * @param {object} opts Options for SonicBoom\n *\n * @returns {object} A new SonicBoom stream\n */\nexport function buildSafeSonicBoom(opts: SonicBoomOpts) {\n const stream = new SonicBoom(opts);\n stream.on('error', filterBrokenPipe);\n if (!opts.sync && isMainThread) {\n setupOnExit(stream);\n }\n return stream;\n\n function filterBrokenPipe(err) {\n if (err.code === 'EPIPE') {\n // @ts-ignore\n stream.write = noop;\n stream.end = noop;\n stream.flushSync = noop;\n stream.destroy = noop;\n return;\n }\n stream.removeListener('error', filterBrokenPipe);\n }\n}\n\nexport function autoEnd(stream: SonicBoom & { destroyed?: boolean }, eventName: string) {\n if (stream.destroyed) {\n return;\n }\n\n if (eventName === 'beforeExit') {\n stream.flush();\n stream.on('drain', function () {\n stream.end();\n });\n } else {\n // Guard against SonicBoom not being ready (file not yet opened)\n // to prevent \"sonic boom is not ready yet\" crash on early process exit\n try {\n stream.flushSync();\n } catch (err: unknown) {\n if (err instanceof Error && err.message?.includes('not ready')) {\n // Stream not ready, nothing to flush\n return;\n }\n // Re-throw real I/O errors (disk full, permission denied, etc.)\n throw err;\n }\n }\n}\n\nfunction setupOnExit(stream) {\n // WeakRef/FinalizationRegistry are guaranteed available in Node 20+ (pino v10 minimum)\n const onExit = require('on-exit-leak-free');\n onExit.register(stream, autoEnd);\n stream.on('close', function () {\n onExit.unregister(stream);\n });\n}\n\nexport { hasColors } from './colors';\n\nexport function buildPretty(opts: PrettyOptionsExtended) {\n return (chunk) => {\n const colors = hasColors(opts.colors);\n return printMessage(chunk, { prettyStamp: opts.prettyStamp }, colors);\n };\n}\n\nexport default function (opts) {\n const pretty = buildPretty(opts);\n // @ts-ignore\n return build(function (source) {\n const stream = new Transform({\n objectMode: true,\n autoDestroy: true,\n transform(chunk, enc, cb) {\n const line = pretty(chunk) + '\\n';\n cb(null, line);\n },\n });\n const destination = buildSafeSonicBoom({\n dest: opts.destination || 1,\n // Defaults to async (false). The transport runs in a worker thread,\n // so sync only blocks the worker, not the main thread.\n // Can be set to true via config for deterministic log ordering (like console.log).\n sync: opts.sync ?? false,\n }) as unknown as WriteStream;\n\n source.on('unknown', function (line) {\n destination.write(line + '\\n');\n });\n\n pipeline(source, stream, destination, (err) => {\n if (err) {\n console.error('prettify pipeline error ', err);\n }\n });\n return stream;\n });\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAS,OAAO,CAAC;;;;;;;;AASjB,SAAgB,mBAAmB,MAAqB;CACtD,MAAM,SAAS,IAAI,WAAA,QAAU,IAAI;CACjC,OAAO,GAAG,SAAS,gBAAgB;CACnC,IAAI,CAAC,KAAK,QAAQ,oBAAA,cAChB,YAAY,MAAM;CAEpB,OAAO;CAEP,SAAS,iBAAiB,KAAK;EAC7B,IAAI,IAAI,SAAS,SAAS;GAExB,OAAO,QAAQ;GACf,OAAO,MAAM;GACb,OAAO,YAAY;GACnB,OAAO,UAAU;GACjB;EACF;EACA,OAAO,eAAe,SAAS,gBAAgB;CACjD;AACF;AAEA,SAAgB,QAAQ,QAA6C,WAAmB;CACtF,IAAI,OAAO,WACT;CAGF,IAAI,cAAc,cAAc;EAC9B,OAAO,MAAM;EACb,OAAO,GAAG,SAAS,WAAY;GAC7B,OAAO,IAAI;EACb,CAAC;CACH,OAGE,IAAI;EACF,OAAO,UAAU;CACnB,SAAS,KAAc;EACrB,IAAI,eAAe,SAAS,IAAI,SAAS,SAAS,WAAW,GAE3D;EAGF,MAAM;CACR;AAEJ;AAEA,SAAS,YAAY,QAAQ;CAE3B,MAAM,SAAS,QAAQ,mBAAmB;CAC1C,OAAO,SAAS,QAAQ,OAAO;CAC/B,OAAO,GAAG,SAAS,WAAY;EAC7B,OAAO,WAAW,MAAM;CAC1B,CAAC;AACH;AAIA,SAAgB,YAAY,MAA6B;CACvD,QAAQ,UAAU;EAChB,MAAM,SAAS,eAAA,UAAU,KAAK,MAAM;EACpC,OAAO,kBAAA,aAAa,OAAO,EAAE,aAAa,KAAK,YAAY,GAAG,MAAM;CACtE;AACF;AAEA,SAAA,iBAAyB,MAAM;CAC7B,MAAM,SAAS,YAAY,IAAI;CAE/B,QAAA,GAAA,wBAAA,SAAa,SAAU,QAAQ;EAC7B,MAAM,SAAS,IAAI,YAAA,UAAU;GAC3B,YAAY;GACZ,aAAa;GACb,UAAU,OAAO,KAAK,IAAI;IAExB,GAAG,MADU,OAAO,KAAK,IAAI,IAChB;GACf;EACF,CAAC;EACD,MAAM,cAAc,mBAAmB;GACrC,MAAM,KAAK,eAAe;GAI1B,MAAM,KAAK,QAAQ;EACrB,CAAC;EAED,OAAO,GAAG,WAAW,SAAU,MAAM;GACnC,YAAY,MAAM,OAAO,IAAI;EAC/B,CAAC;EAED,CAAA,GAAA,YAAA,UAAS,QAAQ,QAAQ,cAAc,QAAQ;GAC7C,IAAI,KACF,QAAQ,MAAM,4BAA4B,GAAG;EAEjD,CAAC;EACD,OAAO;CACT,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"prettify.mjs","names":[],"sources":["../src/prettify.ts"],"sourcesContent":["import type { WriteStream } from 'node:fs';\nimport { Transform, pipeline } from 'node:stream';\nimport { isMainThread } from 'node:worker_threads';\nimport build from 'pino-abstract-transport';\nimport type { SonicBoomOpts } from 'sonic-boom';\nimport SonicBoom from 'sonic-boom';\n\nimport { hasColors } from './colors';\nimport { fillInMsgTemplate, printMessage } from './formatter';\nimport type { PrettyOptionsExtended } from './types';\n\nexport { fillInMsgTemplate };\n\nfunction noop() {}\n\n/**\n * Creates a safe SonicBoom instance\n *\n * @param {object} opts Options for SonicBoom\n *\n * @returns {object} A new SonicBoom stream\n */\nexport function buildSafeSonicBoom(opts: SonicBoomOpts) {\n const stream = new SonicBoom(opts);\n stream.on('error', filterBrokenPipe);\n if (!opts.sync && isMainThread) {\n setupOnExit(stream);\n }\n return stream;\n\n function filterBrokenPipe(err) {\n if (err.code === 'EPIPE') {\n // @ts-ignore\n stream.write = noop;\n stream.end = noop;\n stream.flushSync = noop;\n stream.destroy = noop;\n return;\n }\n stream.removeListener('error', filterBrokenPipe);\n }\n}\n\nexport function autoEnd(stream: SonicBoom & { destroyed?: boolean }, eventName: string) {\n if (stream.destroyed) {\n return;\n }\n\n if (eventName === 'beforeExit') {\n stream.flush();\n stream.on('drain', function () {\n stream.end();\n });\n } else {\n // Guard against SonicBoom not being ready (file not yet opened)\n // to prevent \"sonic boom is not ready yet\" crash on early process exit\n try {\n stream.flushSync();\n } catch (err: unknown) {\n if (err instanceof Error && err.message?.includes('not ready')) {\n // Stream not ready, nothing to flush\n return;\n }\n // Re-throw real I/O errors (disk full, permission denied, etc.)\n throw err;\n }\n }\n}\n\nfunction setupOnExit(stream) {\n // WeakRef/FinalizationRegistry are guaranteed available in Node 20+ (pino v10 minimum)\n const onExit = require('on-exit-leak-free');\n onExit.register(stream, autoEnd);\n stream.on('close', function () {\n onExit.unregister(stream);\n });\n}\n\nexport { hasColors } from './colors';\n\nexport function buildPretty(opts: PrettyOptionsExtended) {\n return (chunk) => {\n const colors = hasColors(opts.colors);\n return printMessage(chunk, { prettyStamp: opts.prettyStamp }, colors);\n };\n}\n\nexport default function (opts) {\n const pretty = buildPretty(opts);\n // @ts-ignore\n return build(function (source) {\n const stream = new Transform({\n objectMode: true,\n autoDestroy: true,\n transform(chunk, enc, cb) {\n const line = pretty(chunk) + '\\n';\n cb(null, line);\n },\n });\n const destination = buildSafeSonicBoom({\n dest: opts.destination || 1,\n // Defaults to async (false). The transport runs in a worker thread,\n // so sync only blocks the worker, not the main thread.\n // Can be set to true via config for deterministic log ordering (like console.log).\n sync: opts.sync ?? false,\n }) as unknown as WriteStream;\n\n source.on('unknown', function (line) {\n destination.write(line + '\\n');\n });\n\n pipeline(source, stream, destination, (err) => {\n if (err) {\n console.error('prettify pipeline error ', err);\n }\n });\n return stream;\n });\n}\n"],"mappings":";;;;;;;;AAaA,SAAS,OAAO;;;;;;;;AAShB,SAAgB,mBAAmB,MAAqB;CACtD,MAAM,SAAS,IAAI,UAAU,KAAK;AAClC,QAAO,GAAG,SAAS,iBAAiB;AACpC,KAAI,CAAC,KAAK,QAAQ,aAChB,aAAY,OAAO;AAErB,QAAO;CAEP,SAAS,iBAAiB,KAAK;AAC7B,MAAI,IAAI,SAAS,SAAS;AAExB,UAAO,QAAQ;AACf,UAAO,MAAM;AACb,UAAO,YAAY;AACnB,UAAO,UAAU;AACjB;;AAEF,SAAO,eAAe,SAAS,iBAAiB;;;AAIpD,SAAgB,QAAQ,QAA6C,WAAmB;AACtF,KAAI,OAAO,UACT;AAGF,KAAI,cAAc,cAAc;AAC9B,SAAO,OAAO;AACd,SAAO,GAAG,SAAS,WAAY;AAC7B,UAAO,KAAK;IACZ;OAIF,KAAI;AACF,SAAO,WAAW;UACX,KAAc;AACrB,MAAI,eAAe,SAAS,IAAI,SAAS,SAAS,YAAY,CAE5D;AAGF,QAAM;;;AAKZ,SAAS,YAAY,QAAQ;CAE3B,MAAM,SAAA,UAAiB,oBAAoB;AAC3C,QAAO,SAAS,QAAQ,QAAQ;AAChC,QAAO,GAAG,SAAS,WAAY;AAC7B,SAAO,WAAW,OAAO;GACzB;;AAKJ,SAAgB,YAAY,MAA6B;AACvD,SAAQ,UAAU;EAChB,MAAM,SAAS,UAAU,KAAK,OAAO;AACrC,SAAO,aAAa,OAAO,EAAE,aAAa,KAAK,aAAa,EAAE,OAAO;;;AAIzE,SAAA,iBAAyB,MAAM;CAC7B,MAAM,SAAS,YAAY,KAAK;AAEhC,QAAO,MAAM,SAAU,QAAQ;EAC7B,MAAM,SAAS,IAAI,UAAU;GAC3B,YAAY;GACZ,aAAa;GACb,UAAU,OAAO,KAAK,IAAI;AAExB,OAAG,MADU,OAAO,MAAM,GAAG,KACf;;GAEjB,CAAC;EACF,MAAM,cAAc,mBAAmB;GACrC,MAAM,KAAK,eAAe;GAI1B,MAAM,KAAK,QAAQ;GACpB,CAAC;AAEF,SAAO,GAAG,WAAW,SAAU,MAAM;AACnC,eAAY,MAAM,OAAO,KAAK;IAC9B;AAEF,WAAS,QAAQ,QAAQ,cAAc,QAAQ;AAC7C,OAAI,IACF,SAAQ,MAAM,4BAA4B,IAAI;IAEhD;AACF,SAAO;GACP"}
1
+ {"version":3,"file":"prettify.mjs","names":[],"sources":["../src/prettify.ts"],"sourcesContent":["import type { WriteStream } from 'node:fs';\nimport { Transform, pipeline } from 'node:stream';\nimport { isMainThread } from 'node:worker_threads';\nimport build from 'pino-abstract-transport';\nimport type { SonicBoomOpts } from 'sonic-boom';\nimport SonicBoom from 'sonic-boom';\n\nimport { hasColors } from './colors';\nimport { fillInMsgTemplate, printMessage } from './formatter';\nimport type { PrettyOptionsExtended } from './types';\n\nexport { fillInMsgTemplate };\n\nfunction noop() {}\n\n/**\n * Creates a safe SonicBoom instance\n *\n * @param {object} opts Options for SonicBoom\n *\n * @returns {object} A new SonicBoom stream\n */\nexport function buildSafeSonicBoom(opts: SonicBoomOpts) {\n const stream = new SonicBoom(opts);\n stream.on('error', filterBrokenPipe);\n if (!opts.sync && isMainThread) {\n setupOnExit(stream);\n }\n return stream;\n\n function filterBrokenPipe(err) {\n if (err.code === 'EPIPE') {\n // @ts-ignore\n stream.write = noop;\n stream.end = noop;\n stream.flushSync = noop;\n stream.destroy = noop;\n return;\n }\n stream.removeListener('error', filterBrokenPipe);\n }\n}\n\nexport function autoEnd(stream: SonicBoom & { destroyed?: boolean }, eventName: string) {\n if (stream.destroyed) {\n return;\n }\n\n if (eventName === 'beforeExit') {\n stream.flush();\n stream.on('drain', function () {\n stream.end();\n });\n } else {\n // Guard against SonicBoom not being ready (file not yet opened)\n // to prevent \"sonic boom is not ready yet\" crash on early process exit\n try {\n stream.flushSync();\n } catch (err: unknown) {\n if (err instanceof Error && err.message?.includes('not ready')) {\n // Stream not ready, nothing to flush\n return;\n }\n // Re-throw real I/O errors (disk full, permission denied, etc.)\n throw err;\n }\n }\n}\n\nfunction setupOnExit(stream) {\n // WeakRef/FinalizationRegistry are guaranteed available in Node 20+ (pino v10 minimum)\n const onExit = require('on-exit-leak-free');\n onExit.register(stream, autoEnd);\n stream.on('close', function () {\n onExit.unregister(stream);\n });\n}\n\nexport { hasColors } from './colors';\n\nexport function buildPretty(opts: PrettyOptionsExtended) {\n return (chunk) => {\n const colors = hasColors(opts.colors);\n return printMessage(chunk, { prettyStamp: opts.prettyStamp }, colors);\n };\n}\n\nexport default function (opts) {\n const pretty = buildPretty(opts);\n // @ts-ignore\n return build(function (source) {\n const stream = new Transform({\n objectMode: true,\n autoDestroy: true,\n transform(chunk, enc, cb) {\n const line = pretty(chunk) + '\\n';\n cb(null, line);\n },\n });\n const destination = buildSafeSonicBoom({\n dest: opts.destination || 1,\n // Defaults to async (false). The transport runs in a worker thread,\n // so sync only blocks the worker, not the main thread.\n // Can be set to true via config for deterministic log ordering (like console.log).\n sync: opts.sync ?? false,\n }) as unknown as WriteStream;\n\n source.on('unknown', function (line) {\n destination.write(line + '\\n');\n });\n\n pipeline(source, stream, destination, (err) => {\n if (err) {\n console.error('prettify pipeline error ', err);\n }\n });\n return stream;\n });\n}\n"],"mappings":";;;;;;;;AAaA,SAAS,OAAO,CAAC;;;;;;;;AASjB,SAAgB,mBAAmB,MAAqB;CACtD,MAAM,SAAS,IAAI,UAAU,IAAI;CACjC,OAAO,GAAG,SAAS,gBAAgB;CACnC,IAAI,CAAC,KAAK,QAAQ,cAChB,YAAY,MAAM;CAEpB,OAAO;CAEP,SAAS,iBAAiB,KAAK;EAC7B,IAAI,IAAI,SAAS,SAAS;GAExB,OAAO,QAAQ;GACf,OAAO,MAAM;GACb,OAAO,YAAY;GACnB,OAAO,UAAU;GACjB;EACF;EACA,OAAO,eAAe,SAAS,gBAAgB;CACjD;AACF;AAEA,SAAgB,QAAQ,QAA6C,WAAmB;CACtF,IAAI,OAAO,WACT;CAGF,IAAI,cAAc,cAAc;EAC9B,OAAO,MAAM;EACb,OAAO,GAAG,SAAS,WAAY;GAC7B,OAAO,IAAI;EACb,CAAC;CACH,OAGE,IAAI;EACF,OAAO,UAAU;CACnB,SAAS,KAAc;EACrB,IAAI,eAAe,SAAS,IAAI,SAAS,SAAS,WAAW,GAE3D;EAGF,MAAM;CACR;AAEJ;AAEA,SAAS,YAAY,QAAQ;CAE3B,MAAM,SAAA,UAAiB,mBAAmB;CAC1C,OAAO,SAAS,QAAQ,OAAO;CAC/B,OAAO,GAAG,SAAS,WAAY;EAC7B,OAAO,WAAW,MAAM;CAC1B,CAAC;AACH;AAIA,SAAgB,YAAY,MAA6B;CACvD,QAAQ,UAAU;EAChB,MAAM,SAAS,UAAU,KAAK,MAAM;EACpC,OAAO,aAAa,OAAO,EAAE,aAAa,KAAK,YAAY,GAAG,MAAM;CACtE;AACF;AAEA,SAAA,iBAAyB,MAAM;CAC7B,MAAM,SAAS,YAAY,IAAI;CAE/B,OAAO,MAAM,SAAU,QAAQ;EAC7B,MAAM,SAAS,IAAI,UAAU;GAC3B,YAAY;GACZ,aAAa;GACb,UAAU,OAAO,KAAK,IAAI;IAExB,GAAG,MADU,OAAO,KAAK,IAAI,IAChB;GACf;EACF,CAAC;EACD,MAAM,cAAc,mBAAmB;GACrC,MAAM,KAAK,eAAe;GAI1B,MAAM,KAAK,QAAQ;EACrB,CAAC;EAED,OAAO,GAAG,WAAW,SAAU,MAAM;GACnC,YAAY,MAAM,OAAO,IAAI;EAC/B,CAAC;EAED,SAAS,QAAQ,QAAQ,cAAc,QAAQ;GAC7C,IAAI,KACF,QAAQ,MAAM,4BAA4B,GAAG;EAEjD,CAAC;EACD,OAAO;CACT,CAAC;AACH"}
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.js");
2
1
  const require_colors = require("./colors.js");
3
2
  let node_path = require("node:path");
4
3
  let node_url = require("node:url");
@@ -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 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"}
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,CAAA,EAA8C,GAAG,CAAC,GACjD,MAAM,SAAS,aAAa;AAElE,SAAgB,eAAe,QAA2C;CACxE,OAAO,CAAC,sBAAsB,QAAQ,EAAE,SAAS,UAAU,QAAQ;AACrE;;;;AAKA,SAAgB,sBAAsB,MAAW,SAA2B,QAAsB;CAChG,OAAO,KAAK,UAAU;EACpB,QAAQ;EACR,SAAS;GACP,aAAa,QAAQ,QAAQ;GAC7B,QAAQ,eAAA,UAAU,QAAQ,MAAM;GAChC,aAAa,WAAW;GACxB,MAAM,QAAQ,QAAQ;EACxB;EACA,QAAQ,EACN,MAAM,4BACR;CACF,CAAC;AACH"}
@@ -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 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"}
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,GAAG,CAAC,GACjD,MAAM,SAAS,aAAa;AAElE,SAAgB,eAAe,QAA2C;CACxE,OAAO,CAAC,sBAAsB,QAAQ,EAAE,SAAS,UAAU,QAAQ;AACrE;;;;AAKA,SAAgB,sBAAsB,MAAW,SAA2B,QAAsB;CAChG,OAAO,KAAK,UAAU;EACpB,QAAQ;EACR,SAAS;GACP,aAAa,QAAQ,QAAQ;GAC7B,QAAQ,UAAU,QAAQ,MAAM;GAChC,aAAa,WAAW;GACxB,MAAM,QAAQ,QAAQ;EACxB;EACA,QAAQ,EACN,MAAM,4BACR;CACF,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nexport const FORMAT_DATE = 'YYYY-MM-DD HH:mm:ss';\nexport const CUSTOM_PAD_LENGTH = 1;\n\nexport function isObject(obj: unknown): boolean {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj);\n}\n\nexport function padRight(message: string, max = message.length + CUSTOM_PAD_LENGTH) {\n return message.padEnd(max, ' ');\n}\n\nexport function formatLoggingDate(time: number, message: string): string {\n const timeFormatted = dayjs(time).format(FORMAT_DATE);\n\n return `[${timeFormatted}] ${message}`;\n}\n"],"mappings":";;;;AAEA,IAAa,cAAc;AAG3B,SAAgB,SAAS,KAAuB;AAC9C,QAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,CAAC,MAAM,QAAQ,IAAI;;AAGvE,SAAgB,SAAS,SAAiB,MAAM,QAAQ,SAAA,GAA4B;AAClF,QAAO,QAAQ,OAAO,KAAK,IAAI;;AAGjC,SAAgB,kBAAkB,MAAc,SAAyB;AAGvE,QAAO,KAAA,GAAA,MAAA,SAFqB,KAAK,CAAC,OAAO,YAAY,CAE5B,IAAI"}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nexport const FORMAT_DATE = 'YYYY-MM-DD HH:mm:ss';\nexport const CUSTOM_PAD_LENGTH = 1;\n\nexport function isObject(obj: unknown): boolean {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj);\n}\n\nexport function padRight(message: string, max = message.length + CUSTOM_PAD_LENGTH) {\n return message.padEnd(max, ' ');\n}\n\nexport function formatLoggingDate(time: number, message: string): string {\n const timeFormatted = dayjs(time).format(FORMAT_DATE);\n\n return `[${timeFormatted}] ${message}`;\n}\n"],"mappings":";;;;AAEA,IAAa,cAAc;AAG3B,SAAgB,SAAS,KAAuB;CAC9C,OAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,CAAC,MAAM,QAAQ,GAAG;AACtE;AAEA,SAAgB,SAAS,SAAiB,MAAM,QAAQ,SAAA,GAA4B;CAClF,OAAO,QAAQ,OAAO,KAAK,GAAG;AAChC;AAEA,SAAgB,kBAAkB,MAAc,SAAyB;CAGvE,OAAO,KAAA,GAAA,MAAA,SAFqB,IAAI,EAAE,OAAO,WAE9B,EAAc,IAAI;AAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nexport const FORMAT_DATE = 'YYYY-MM-DD HH:mm:ss';\nexport const CUSTOM_PAD_LENGTH = 1;\n\nexport function isObject(obj: unknown): boolean {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj);\n}\n\nexport function padRight(message: string, max = message.length + CUSTOM_PAD_LENGTH) {\n return message.padEnd(max, ' ');\n}\n\nexport function formatLoggingDate(time: number, message: string): string {\n const timeFormatted = dayjs(time).format(FORMAT_DATE);\n\n return `[${timeFormatted}] ${message}`;\n}\n"],"mappings":";;AAEA,IAAa,cAAc;AAG3B,SAAgB,SAAS,KAAuB;AAC9C,QAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,CAAC,MAAM,QAAQ,IAAI;;AAGvE,SAAgB,SAAS,SAAiB,MAAM,QAAQ,SAAA,GAA4B;AAClF,QAAO,QAAQ,OAAO,KAAK,IAAI;;AAGjC,SAAgB,kBAAkB,MAAc,SAAyB;AAGvE,QAAO,IAFe,MAAM,KAAK,CAAC,OAAO,YAAY,CAE5B,IAAI"}
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nexport const FORMAT_DATE = 'YYYY-MM-DD HH:mm:ss';\nexport const CUSTOM_PAD_LENGTH = 1;\n\nexport function isObject(obj: unknown): boolean {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj);\n}\n\nexport function padRight(message: string, max = message.length + CUSTOM_PAD_LENGTH) {\n return message.padEnd(max, ' ');\n}\n\nexport function formatLoggingDate(time: number, message: string): string {\n const timeFormatted = dayjs(time).format(FORMAT_DATE);\n\n return `[${timeFormatted}] ${message}`;\n}\n"],"mappings":";;AAEA,IAAa,cAAc;AAG3B,SAAgB,SAAS,KAAuB;CAC9C,OAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,CAAC,MAAM,QAAQ,GAAG;AACtE;AAEA,SAAgB,SAAS,SAAiB,MAAM,QAAQ,SAAA,GAA4B;CAClF,OAAO,QAAQ,OAAO,KAAK,GAAG;AAChC;AAEA,SAAgB,kBAAkB,MAAc,SAAyB;CAGvE,OAAO,IAFe,MAAM,IAAI,EAAE,OAAO,WAE9B,EAAc,IAAI;AAC/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/logger",
3
- "version": "9.0.0-next-9.16",
3
+ "version": "9.0.0-next-9.18",
4
4
  "description": "Verdaccio Logger",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "node": ">=24"
34
34
  },
35
35
  "dependencies": {
36
- "@verdaccio/core": "9.0.0-next-9.16",
36
+ "@verdaccio/core": "9.0.0-next-9.18",
37
37
  "colorette": "2.0.20",
38
38
  "dayjs": "1.11.20",
39
39
  "debug": "4.4.3",
@@ -43,9 +43,9 @@
43
43
  "sonic-boom": "4.2.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@verdaccio/types": "14.0.0-next-9.7",
46
+ "@verdaccio/types": "14.0.0-next-9.9",
47
47
  "pino": "10.3.1",
48
- "vitest": "4.1.0"
48
+ "vitest": "4.1.7"
49
49
  },
50
50
  "funding": {
51
51
  "type": "opencollective",
@@ -1,6 +1,6 @@
1
1
  import { execFileSync } from 'node:child_process';
2
2
  import { readFile } from 'node:fs/promises';
3
- import { join } from 'node:path';
3
+ import { join, posix, win32 } from 'node:path';
4
4
  import { setTimeout } from 'node:timers/promises';
5
5
  import pino from 'pino';
6
6
  import { describe, expect, test } from 'vitest';
@@ -20,6 +20,11 @@ async function createLogFile() {
20
20
  return file;
21
21
  }
22
22
 
23
+ /** POSIX paths are safe to embed in inline `node -e` scripts (no backslash escapes). */
24
+ function toPosixPath(path: string): string {
25
+ return path.split(win32.sep).join(posix.sep);
26
+ }
27
+
23
28
  const defaultOptions = {
24
29
  format: 'json',
25
30
  level: 'http',
@@ -187,10 +192,12 @@ describe('logger test', () => {
187
192
  // Before the fix, this would crash with "sonic boom is not ready yet" because
188
193
  // prepareSetup created an unused pino.destination(path) that registered with
189
194
  // on-exit-leak-free but was never opened before the process exited.
195
+ const buildPath = toPosixPath(join(import.meta.dirname, '..', 'build'));
196
+ const logPath = toPosixPath(file);
190
197
  const script = `
191
198
  const pino = require('pino');
192
- const { prepareSetup } = require('${join(import.meta.dirname, '..', 'build')}');
193
- const result = prepareSetup({ type: 'file', path: '${file}', level: 'info', format: 'pretty', colors: false }, pino);
199
+ const { prepareSetup } = require('${buildPath}');
200
+ const result = prepareSetup({ type: 'file', path: '${logPath}', level: 'info', format: 'pretty', colors: false }, pino);
194
201
  if (result instanceof Promise) { result.then(() => process.exit(0)); } else { process.exit(0); }
195
202
  `;
196
203
  expect(() => {