@gentrace/core
Version:
Core Gentrace Node.JS library
1 lines • 3.2 kB
Source Map (JSON)
{"version":3,"file":"warnings.mjs","sources":["warnings.js"],"sourcesContent":["import chalk from \"chalk\";\nimport boxen from \"boxen\";\nexport class DeprecationWarning {\n constructor(title, message) {\n this.title = title;\n this.message = Array.isArray(message) ? message : [message];\n }\n display() {\n try {\n // Build the formatted message\n const messageLines = [];\n // Add the main message\n for (const line of this.message) {\n messageLines.push(line);\n }\n const fullMessage = messageLines.join(\"\\n\");\n // Create the title with warning emoji\n const formattedTitle = `⚠️ ${this.title}`;\n // Display using boxen with red border for deprecation\n console.error(\"\\n\" +\n boxen(fullMessage, {\n title: chalk.red.bold(formattedTitle),\n titleAlignment: \"center\",\n padding: 1,\n margin: 1,\n borderStyle: \"round\",\n borderColor: \"red\",\n }) +\n \"\\n\");\n }\n catch (error) {\n // Fallback to simple console error if formatting fails\n console.error(`⚠️ ${this.title}\\n\\n${this.message.join(\"\\n\")}\\n`);\n }\n }\n}\n// Pre-defined deprecation warning\nexport const GentraceDeprecationWarning = () => new DeprecationWarning(\"PACKAGE DEPRECATED\", [\n chalk.red.bold(\"@gentrace/core is deprecated but will continue to receive fixes\"),\n \"\",\n \"Install the new package:\",\n chalk.green(\" npm install gentrace\"),\n \"\",\n \"Learn more:\",\n chalk.cyan(\" https://gentrace.ai/docs\"),\n]);\n"],"names":[],"mappings":";;;AAEO,MAAM,kBAAkB,CAAC;AAChC,IAAI,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE;AAChC,QAAQ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAC3B,QAAQ,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;AACpE,KAAK;AACL,IAAI,OAAO,GAAG;AACd,QAAQ,IAAI;AACZ;AACA,YAAY,MAAM,YAAY,GAAG,EAAE,CAAC;AACpC;AACA,YAAY,KAAK,MAAM,IAA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