@mks2508/better-logger 1.1.0 → 1.2.1
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/.claude/settings.local.json +3 -2
- package/CHANGELOG.md +82 -0
- package/bun.lock +10 -0
- package/dist/Logger.d.ts.map +1 -1
- package/dist/chunks/{Logger-Th9SfADL.js → Logger-B7L-ujY4.js} +12 -6
- package/dist/chunks/{Logger-Th9SfADL.js.map → Logger-B7L-ujY4.js.map} +1 -1
- package/dist/chunks/{Logger-C9zTFYBh.js → Logger-DzU_c5sX.js} +2 -2
- package/dist/chunks/{Logger-C9zTFYBh.js.map → Logger-DzU_c5sX.js.map} +1 -1
- package/dist/chunks/{ScopedLogger-HgV_J-ug.js → ScopedLogger-BY3-E8Ov.js} +2 -2
- package/dist/chunks/{ScopedLogger-HgV_J-ug.js.map → ScopedLogger-BY3-E8Ov.js.map} +1 -1
- package/dist/chunks/{ScopedLogger-uAAeJkfA.js → ScopedLogger-D-RbiFZn.js} +2 -2
- package/dist/chunks/{ScopedLogger-uAAeJkfA.js.map → ScopedLogger-D-RbiFZn.js.map} +1 -1
- package/dist/chunks/environment-Ba5kShbx.js +4 -0
- package/dist/chunks/environment-Ba5kShbx.js.map +1 -0
- package/dist/chunks/environment-TI2ByCPT.js +1209 -0
- package/dist/chunks/environment-TI2ByCPT.js.map +1 -0
- package/dist/chunks/{formatting-CiFnwe1I.js → formatting-Blwy-f0W.js} +2 -2
- package/dist/chunks/{formatting-CiFnwe1I.js.map → formatting-Blwy-f0W.js.map} +1 -1
- package/dist/chunks/{formatting-DIhpRCCk.js → formatting-CuNUqGks.js} +2 -2
- package/dist/chunks/{formatting-DIhpRCCk.js.map → formatting-CuNUqGks.js.map} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/exports.cjs +1 -1
- package/dist/exports.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +6 -6
- package/dist/styling.cjs +1 -1
- package/dist/styling.js +3 -3
- package/dist/terminal/terminal-renderer.d.ts +63 -0
- package/dist/terminal/terminal-renderer.d.ts.map +1 -0
- package/dist/utils/adapter.d.ts +48 -0
- package/dist/utils/adapter.d.ts.map +1 -0
- package/dist/utils/environment-detector.d.ts +35 -0
- package/dist/utils/environment-detector.d.ts.map +1 -0
- package/dist/utils/environment.d.ts +1 -1
- package/dist/utils/output.d.ts +7 -2
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/stackTrace.d.ts.map +1 -1
- package/package.json +10 -2
- package/src/Logger.ts +21 -13
- package/src/terminal/terminal-renderer.ts +347 -0
- package/src/utils/adapter.ts +291 -0
- package/src/utils/environment-detector.ts +148 -0
- package/src/utils/output.ts +43 -1
- package/src/utils/stackTrace.ts +54 -5
- package/dist/chunks/environment-5I5unY89.js +0 -4
- package/dist/chunks/environment-5I5unY89.js.map +0 -1
- package/dist/chunks/environment-wXLQvk5g.js +0 -636
- package/dist/chunks/environment-wXLQvk5g.js.map +0 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment Detector - Robust environment detection for logger
|
|
3
|
+
* Detects browser, terminal, server, and other runtime environments
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type Environment = 'browser' | 'terminal' | 'server' | 'webworker' | 'deno' | 'unknown';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Main environment detection function
|
|
10
|
+
*/
|
|
11
|
+
export function getEnvironment(): Environment {
|
|
12
|
+
// Check for Deno first
|
|
13
|
+
if (typeof globalThis !== 'undefined' && (globalThis as any).Deno) {
|
|
14
|
+
return 'deno';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Check for WebWorker
|
|
18
|
+
if (typeof window === 'undefined' && typeof self !== 'undefined' && typeof (self as any).importScripts === 'function') {
|
|
19
|
+
return 'webworker';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Check for Node.js (server environment)
|
|
23
|
+
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
|
|
24
|
+
// Determine if it's running in a terminal or as a server
|
|
25
|
+
if (isRunningInTerminal()) {
|
|
26
|
+
return 'terminal';
|
|
27
|
+
}
|
|
28
|
+
return 'server';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Check for browser
|
|
32
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
33
|
+
return 'browser';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return 'unknown';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check if running in an interactive terminal
|
|
41
|
+
*/
|
|
42
|
+
export function isRunningInTerminal(): boolean {
|
|
43
|
+
// Check for common terminal indicators
|
|
44
|
+
if (typeof process === 'undefined') return false;
|
|
45
|
+
|
|
46
|
+
const isTTY = process.stdout && process.stdout.isTTY;
|
|
47
|
+
const hasTerminalEnv = process.env && (
|
|
48
|
+
process.env.TERM ||
|
|
49
|
+
process.env.TERM_PROGRAM ||
|
|
50
|
+
process.env.SSH_TTY ||
|
|
51
|
+
process.env.TERM_SESSION_ID
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// Check if we're running in common terminal programs
|
|
55
|
+
const terminalPrograms = [
|
|
56
|
+
'vscode',
|
|
57
|
+
'hyper',
|
|
58
|
+
'iterm',
|
|
59
|
+
'terminal',
|
|
60
|
+
'alacritty',
|
|
61
|
+
'kitty',
|
|
62
|
+
'gnome-terminal',
|
|
63
|
+
'konsole',
|
|
64
|
+
'xterm',
|
|
65
|
+
'tmux',
|
|
66
|
+
'screen'
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const isTerminalProgram = hasTerminalEnv && terminalPrograms.some(program =>
|
|
70
|
+
process.env.TERM_PROGRAM?.toLowerCase().includes(program) ||
|
|
71
|
+
process.env.TERM?.toLowerCase().includes(program)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return Boolean(isTTY || hasTerminalEnv || isTerminalProgram);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Check if environment supports ANSI colors
|
|
79
|
+
*/
|
|
80
|
+
export function supportsANSI(): boolean {
|
|
81
|
+
const env = getEnvironment();
|
|
82
|
+
|
|
83
|
+
if (env === 'browser') return false;
|
|
84
|
+
if (env === 'terminal') return true;
|
|
85
|
+
if (env === 'server') return checkServerANSISupport();
|
|
86
|
+
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Check if server environment supports ANSI colors
|
|
92
|
+
*/
|
|
93
|
+
function checkServerANSISupport(): boolean {
|
|
94
|
+
if (typeof process === 'undefined') return false;
|
|
95
|
+
|
|
96
|
+
// Check common environment variables that indicate ANSI support
|
|
97
|
+
const supportsANSI = process.env && (
|
|
98
|
+
process.env.COLORTERM ||
|
|
99
|
+
process.env.FORCE_COLOR ||
|
|
100
|
+
(process.env.TERM && process.env.TERM !== 'dumb') ||
|
|
101
|
+
process.env.TERM_PROGRAM
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return Boolean(supportsANSI);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get environment-specific color capability
|
|
109
|
+
*/
|
|
110
|
+
export function getColorCapability(): 'full' | 'basic' | 'none' {
|
|
111
|
+
const env = getEnvironment();
|
|
112
|
+
|
|
113
|
+
if (env === 'browser') {
|
|
114
|
+
return 'full'; // CSS colors
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (!supportsANSI()) {
|
|
118
|
+
return 'none';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Check for 256-color or truecolor support
|
|
122
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
123
|
+
const hasTrueColor = process.env.COLORTERM === 'truecolor' || process.env.COLORTERM === '24bit';
|
|
124
|
+
const has256Colors = process.env.TERM && process.env.TERM.includes('256');
|
|
125
|
+
|
|
126
|
+
if (hasTrueColor || has256Colors) {
|
|
127
|
+
return 'full';
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return 'basic'; // Basic 16 colors
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Environment information for debugging
|
|
136
|
+
*/
|
|
137
|
+
export function getEnvironmentInfo() {
|
|
138
|
+
return {
|
|
139
|
+
environment: getEnvironment(),
|
|
140
|
+
supportsANSI: supportsANSI(),
|
|
141
|
+
colorCapability: getColorCapability(),
|
|
142
|
+
isTTY: typeof process !== 'undefined' ? Boolean(process.stdout?.isTTY) : false,
|
|
143
|
+
platform: typeof process !== 'undefined' ? process.platform : 'unknown',
|
|
144
|
+
nodeVersion: typeof process !== 'undefined' ? process.versions?.node : null,
|
|
145
|
+
term: typeof process !== 'undefined' ? process.env?.TERM : null,
|
|
146
|
+
colorTerm: typeof process !== 'undefined' ? process.env?.COLORTERM : null
|
|
147
|
+
};
|
|
148
|
+
}
|
package/src/utils/output.ts
CHANGED
|
@@ -6,6 +6,9 @@ import type { LogLevel, StackInfo, DevToolsTheme, AdaptiveColors } from '../type
|
|
|
6
6
|
import { formatTimestamp } from './timestamps.js';
|
|
7
7
|
import { StyleBuilder } from '../styling/index.js';
|
|
8
8
|
import { ADAPTIVE_COLORS } from '../constants.js';
|
|
9
|
+
import { getEnvironment, supportsANSI } from './environment-detector.js';
|
|
10
|
+
import { adaptToTerminal } from './adapter.js';
|
|
11
|
+
import type { LogStyles } from '../types/index.js';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* Style configuration for each log level
|
|
@@ -77,6 +80,7 @@ export function setupThemeChangeListener(callback: (theme: DevToolsTheme) => voi
|
|
|
77
80
|
|
|
78
81
|
/**
|
|
79
82
|
* Creates styled console output with multiple %c formatters
|
|
83
|
+
* Automatically adapts to browser or terminal environment
|
|
80
84
|
*/
|
|
81
85
|
export function createStyledOutput(
|
|
82
86
|
level: LogLevel,
|
|
@@ -84,10 +88,20 @@ export function createStyledOutput(
|
|
|
84
88
|
prefix: string | undefined,
|
|
85
89
|
message: string,
|
|
86
90
|
stackInfo: StackInfo | null,
|
|
87
|
-
autoDetectTheme: boolean = true
|
|
91
|
+
autoDetectTheme: boolean = true,
|
|
92
|
+
presetStyles?: LogStyles,
|
|
93
|
+
presetName?: string
|
|
88
94
|
): [string, ...string[]] {
|
|
89
95
|
const levelConfig = levelStyles[level];
|
|
90
96
|
const timestamp = formatTimestamp();
|
|
97
|
+
const environment = getEnvironment();
|
|
98
|
+
|
|
99
|
+
// Check if we should use terminal rendering
|
|
100
|
+
if (environment !== 'browser' && supportsANSI()) {
|
|
101
|
+
return createTerminalOutput(level, message, timestamp, prefix, stackInfo, presetStyles, presetName);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Browser rendering (existing logic)
|
|
91
105
|
const currentTheme = autoDetectTheme ? detectDevToolsTheme() : 'light';
|
|
92
106
|
|
|
93
107
|
// Base styles with adaptive colors
|
|
@@ -182,4 +196,32 @@ export function safeStringify(obj: any, _maxDepth = 3): string {
|
|
|
182
196
|
} catch (error) {
|
|
183
197
|
return String(obj);
|
|
184
198
|
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Create terminal output with ANSI colors and formatting
|
|
203
|
+
*/
|
|
204
|
+
export function createTerminalOutput(
|
|
205
|
+
level: LogLevel,
|
|
206
|
+
message: string,
|
|
207
|
+
timestamp?: string,
|
|
208
|
+
prefix?: string,
|
|
209
|
+
stackInfo?: StackInfo | null,
|
|
210
|
+
presetStyles?: LogStyles,
|
|
211
|
+
presetName?: string
|
|
212
|
+
): [string, ...string[]] {
|
|
213
|
+
const location = stackInfo ? `${stackInfo.file}:${stackInfo.line}:${stackInfo.column}` : undefined;
|
|
214
|
+
|
|
215
|
+
// Use the adapter to convert styles to ANSI
|
|
216
|
+
const ansiStyle = adaptToTerminal(
|
|
217
|
+
level,
|
|
218
|
+
message,
|
|
219
|
+
timestamp,
|
|
220
|
+
prefix,
|
|
221
|
+
location,
|
|
222
|
+
presetStyles,
|
|
223
|
+
presetName
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
return [ansiStyle.text];
|
|
185
227
|
}
|
package/src/utils/stackTrace.ts
CHANGED
|
@@ -4,6 +4,42 @@
|
|
|
4
4
|
|
|
5
5
|
import type { StackInfo } from '../types/index.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Check if a filename represents a minified/bundle file
|
|
9
|
+
*/
|
|
10
|
+
function isMinifiedFile(filename: string): boolean {
|
|
11
|
+
// Skip if filename contains minified patterns
|
|
12
|
+
const minifiedPatterns = [
|
|
13
|
+
/\.min\.js$/,
|
|
14
|
+
/\.bundle\.js$/,
|
|
15
|
+
/\.chunk\.js$/,
|
|
16
|
+
/-[\w\d]{8,}\.js$/, // Hash-based filenames
|
|
17
|
+
/Logger-[A-Za-z0-9]+\.js$/, // Logger bundle files
|
|
18
|
+
/node_modules/,
|
|
19
|
+
/dist\//,
|
|
20
|
+
/build\//,
|
|
21
|
+
/\.mjs$/
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
return minifiedPatterns.some(pattern => pattern.test(filename));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Extract clean filename from full path
|
|
29
|
+
*/
|
|
30
|
+
function extractCleanFilename(fullPath: string): string {
|
|
31
|
+
// Extract just the filename from the full path
|
|
32
|
+
const filename = fullPath.split(/[/\\]/).pop() || fullPath;
|
|
33
|
+
|
|
34
|
+
// Remove common build/minified suffixes
|
|
35
|
+
return filename
|
|
36
|
+
.replace(/\.min\.js$/, '.js')
|
|
37
|
+
.replace(/\.bundle\.js$/, '.js')
|
|
38
|
+
.replace(/\.chunk\.js$/, '.js')
|
|
39
|
+
.replace(/-[\w\d]{8,}\.js$/, '.js')
|
|
40
|
+
.replace(/Logger-[A-Za-z0-9]+\.js$/, 'logger.ts');
|
|
41
|
+
}
|
|
42
|
+
|
|
7
43
|
/**
|
|
8
44
|
* Parses the current stack trace to extract caller information
|
|
9
45
|
*/
|
|
@@ -38,16 +74,31 @@ export function parseStackTrace(): StackInfo | null {
|
|
|
38
74
|
// Chrome format: "at functionName (file:line:column)" or "at file:line:column"
|
|
39
75
|
const chromeMatch = line.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);
|
|
40
76
|
if (chromeMatch) {
|
|
77
|
+
const filename = chromeMatch[2];
|
|
78
|
+
// Skip minified/bundle files
|
|
79
|
+
if (filename && isMinifiedFile(filename)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
41
82
|
match = chromeMatch;
|
|
42
83
|
} else {
|
|
43
84
|
// Firefox format: "functionName@file:line:column"
|
|
44
85
|
const firefoxMatch = line.match(/(.+?)@(.+?):(\d+):(\d+)$/);
|
|
45
86
|
if (firefoxMatch) {
|
|
87
|
+
const filename = firefoxMatch[2];
|
|
88
|
+
// Skip minified/bundle files
|
|
89
|
+
if (filename && isMinifiedFile(filename)) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
46
92
|
match = firefoxMatch;
|
|
47
93
|
} else {
|
|
48
94
|
// Safari/other formats
|
|
49
95
|
const safariMatch = line.match(/(\S+)?@(.+?):(\d+):(\d+)$/);
|
|
50
96
|
if (safariMatch) {
|
|
97
|
+
const filename = safariMatch[2];
|
|
98
|
+
// Skip minified/bundle files
|
|
99
|
+
if (filename && isMinifiedFile(filename)) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
51
102
|
match = safariMatch;
|
|
52
103
|
}
|
|
53
104
|
}
|
|
@@ -63,13 +114,11 @@ export function parseStackTrace(): StackInfo | null {
|
|
|
63
114
|
continue;
|
|
64
115
|
}
|
|
65
116
|
|
|
66
|
-
//
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
if (!fileName) {
|
|
117
|
+
// Use clean filename extraction to avoid minified files
|
|
118
|
+
const cleanFileName = extractCleanFilename(file).split('?')[0];
|
|
119
|
+
if (!cleanFileName) {
|
|
70
120
|
continue;
|
|
71
121
|
}
|
|
72
|
-
const cleanFileName = fileName.split('?')[0];
|
|
73
122
|
|
|
74
123
|
// Parse line and column numbers
|
|
75
124
|
const lineNum = lineStr ? parseInt(lineStr, 10) : 0;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";const e={verbosity:"info",enableColors:!0,enableTimestamps:!0,enableStackTrace:!0,theme:"default",bannerType:"simple",bufferSize:1e3,autoDetectTheme:!0,outputFormat:"auto"},t={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},r={timestamp:{light:"#666666",dark:"#a0a0a0"},messageText:{light:"#2d3748",dark:"#f7fafc"},prefix:{light:"#2d3748",dark:"#e2e8f0"},prefixBackground:{light:"#2d3748",dark:"#4a5568"},location:{light:"#718096",dark:"#a0aec0"}},s={nextjs:{verbosity:"info",enableColors:!0,enableTimestamps:!1,enableStackTrace:!1,autoDetectTheme:!1,outputFormat:"build"},webpack:{verbosity:"info",enableColors:!0,enableTimestamps:!0,enableStackTrace:!1,autoDetectTheme:!1,outputFormat:"build"},ci:{verbosity:"info",enableColors:!1,enableTimestamps:!0,enableStackTrace:!0,autoDetectTheme:!1,outputFormat:"ci"},terminal:{verbosity:"debug",enableColors:!0,enableTimestamps:!0,enableStackTrace:!0,autoDetectTheme:!1,outputFormat:"ansi"}},n={isNextJS:"undefined"!=typeof process&&(process.env.NEXT_RUNTIME||process.env.NEXT_PUBLIC_VERCEL_ENV||process.argv&&process.argv.some(e=>e.includes("next"))),isWebpack:"undefined"!=typeof process&&(process.env.WEBPACK_ENV||process.env.WEBPACK_BUILD||process.argv&&process.argv.some(e=>e.includes("webpack"))),isCI:"undefined"!=typeof process&&(process.env.CI||process.env.GITHUB_ACTIONS||process.env.JENKINS_URL||process.env.GITLAB_CI||process.env.TRAVIS||process.env.CIRCLECI),isBuild:"undefined"!=typeof process&&!0,isTerminal:"undefined"!=typeof process&&!0===process.stdout?.isTTY&&"dumb"!==process.env.TERM};function detectEnvironmentPreset(){return n.isCI?"ci":n.isNextJS?"nextjs":n.isWebpack?"webpack":"terminal"}function formatTimestamp(){try{/* @__PURE__ */
|
|
2
|
-
return(new Date).toISOString()}catch{/* @__PURE__ */
|
|
3
|
-
return(new Date).toISOString()}}class StyleBuilder{styles=[];constructor(e=""){e&&this.styles.push(e)}bg(e){return this.styles.push(`background: ${e}`),this}color(e){return this.styles.push(`color: ${e}`),this}border(e){return this.styles.push(`border: ${e}`),this}shadow(e){return this.styles.push(`box-shadow: ${e}`),this}padding(e){return this.styles.push(`padding: ${e}`),this}margin(e){return this.styles.push(`margin: ${e}`),this}rounded(e="4px"){return this.styles.push(`border-radius: ${e}`),this}bold(){return this.styles.push("font-weight: bold"),this}font(e){return this.styles.push(`font-family: ${e}`),this}mono(){return this.font('Monaco, Consolas, "Courier New", monospace')}system(){return this.font('system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif')}size(e){return this.styles.push(`font-size: ${e}`),this}lineHeight(e){return this.styles.push(`line-height: ${e}`),this}underline(){return this.styles.push("text-decoration: underline"),this}uppercase(){return this.styles.push("text-transform: uppercase"),this}opacity(e){return this.styles.push(`opacity: ${e}`),this}display(e){return this.styles.push(`display: ${e}`),this}position(e){return this.styles.push(`position: ${e}`),this}transform(e){return this.styles.push(`transform: ${e}`),this}animation(e){return this.styles.push(`animation: ${e}`),this}transition(e){return this.styles.push(`transition: ${e}`),this}cursor(e){return this.styles.push(`cursor: ${e}`),this}custom(e,t){return this.styles.push(`${e}: ${t}`),this}css(e,t){return this.custom(e,t)}build(){return this.styles.join("; ")}clear(){return this.styles=[],this}clone(){const e=new StyleBuilder;return e.styles=[...this.styles],e}merge(e){return this.styles.push(...e.styles),this}}!function(){const e=new StyleBuilder;new Proxy(e,{get(e,t){if(t in e){const r=e[t];return"function"==typeof r?r.bind(e):r}}})}();const o={success:()=>(new StyleBuilder).bg("linear-gradient(135deg, #00b894 0%, #00a085 100%)").color("#ffffff").padding("4px 8px").rounded("4px").bold(),error:()=>(new StyleBuilder).bg("linear-gradient(135deg, #e84393 0%, #d63031 100%)").color("#ffffff").padding("4px 8px").rounded("4px").bold(),warning:()=>(new StyleBuilder).bg("linear-gradient(135deg, #fdcb6e 0%, #e17055 100%)").color("#2d3436").padding("4px 8px").rounded("4px").bold(),info:()=>(new StyleBuilder).bg("linear-gradient(135deg, #74b9ff 0%, #0984e3 100%)").color("#ffffff").padding("4px 8px").rounded("4px").bold(),debug:()=>(new StyleBuilder).bg("linear-gradient(135deg, #667eea 0%, #764ba2 100%)").color("#ffffff").padding("4px 8px").rounded("4px").bold(),muted:()=>(new StyleBuilder).color("#6c757d").font("Monaco, Consolas, monospace").size("12px"),accent:()=>(new StyleBuilder).bg("#f8f9fa").color("#495057").padding("2px 6px").rounded("3px").border("1px solid #dee2e6"),neon:()=>(new StyleBuilder).bg("linear-gradient(135deg, #0f3460 0%, #e94560 100%)").color("#00ffff").padding("4px 8px").rounded("4px").bold().shadow("0 0 10px rgba(0, 255, 255, 0.5)")};function detectDevToolsTheme(){try{return"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return console.warn("Failed to detect DevTools theme:",e),"light"}}function getAdaptiveColor(e,t){return e[t??detectDevToolsTheme()]}const i="undefined"!=typeof process&&process.versions&&process.versions.node,a="undefined"!=typeof window&&"undefined"!=typeof document;exports.ADAPTIVE_COLORS=r,exports.BUFFER_LIMITS={MIN_SIZE:50,DEFAULT_SIZE:1e3,MAX_SIZE:1e4},exports.BUILD_PRESETS=s,exports.DEFAULT_CONFIG=e,exports.ENVIRONMENT_DETECTION=n,exports.EXPORT_FORMATS={json:{extension:".json",mimeType:"application/json"},csv:{extension:".csv",mimeType:"text/csv"},markdown:{extension:".md",mimeType:"text/markdown"},plain:{extension:".txt",mimeType:"text/plain"},html:{extension:".html",mimeType:"text/html"}},exports.LEVEL_STYLES={debug:{emoji:"🔍",label:"DEBUG",background:"linear-gradient(90deg, #6c757d, #495057)",color:"#ffffff",border:"1px solid #6c757d",shadow:"0 2px 4px rgba(108, 117, 125, 0.3)"},info:{emoji:"ℹ️",label:"INFO",background:"linear-gradient(90deg, #007bff, #0056b3)",color:"#ffffff",border:"1px solid #007bff",shadow:"0 2px 4px rgba(0, 123, 255, 0.3)"},warn:{emoji:"⚠️",label:"WARN",background:"linear-gradient(90deg, #ffc107, #e0a800)",color:"#000000",border:"1px solid #ffc107",shadow:"0 2px 4px rgba(255, 193, 7, 0.3)"},error:{emoji:"❌",label:"ERROR",background:"linear-gradient(90deg, #dc3545, #c82333)",color:"#ffffff",border:"1px solid #dc3545",shadow:"0 2px 4px rgba(220, 53, 69, 0.3)"},critical:{emoji:"🚨",label:"CRITICAL",background:"linear-gradient(90deg, #8B0000, #FF0000)",color:"#ffffff",border:"2px solid #FF0000",shadow:"0 4px 8px rgba(255, 0, 0, 0.4)"},success:{emoji:"✅",label:"SUCCESS",background:"linear-gradient(90deg, #28a745, #1e7e34)",color:"#ffffff",border:"1px solid #28a745",shadow:"0 2px 4px rgba(40, 167, 69, 0.3)"}},exports.StyleBuilder=StyleBuilder,exports.StylePresets=o,exports.createStyledOutput=function(e,t,s,n,o,i=!0){const a=t[e],l=formatTimestamp(),d=i?detectDevToolsTheme():"light",c=(new StyleBuilder).color(getAdaptiveColor(r.timestamp,d)).size("11px").font("Monaco, Consolas, monospace").build(),p=(new StyleBuilder).bg(a.background).color(a.color).border(a.border).shadow(a.shadow).padding("2px 8px").rounded("4px").bold().font("Monaco, Consolas, monospace").size("12px").build(),u=(new StyleBuilder).bg(getAdaptiveColor(r.prefixBackground,d)).color(getAdaptiveColor(r.prefix,d)).padding("2px 6px").rounded("3px").bold().font("Monaco, Consolas, monospace").size("11px").build(),f=(new StyleBuilder).color(getAdaptiveColor(r.messageText,d)).font("system-ui, -apple-system, sans-serif").size("14px").build(),h=(new StyleBuilder).color(getAdaptiveColor(r.location,d)).size("11px").font("Monaco, Consolas, monospace").build();let m=`%c${l.slice(11,23)} %c${a.emoji} ${a.label}`;const g=[c,p];return s&&(m+=` %c${s}`,g.push(u)),m+=` %c${n}`,g.push(f),o&&(m+=` %c(${o.file}:${o.line}:${o.column})`,g.push(h)),[m,...g]},exports.detectEnvironmentPreset=detectEnvironmentPreset,exports.escapeHtml=function(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML},exports.formatDisplayTime=function(e,t="short"){switch(t){case"time-only":return e.toTimeString().slice(0,8);case"full":return e.toISOString();default:return e.toISOString().slice(11,23)}},exports.formatTimestamp=formatTimestamp,exports.generateLogId=function(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`},exports.getAdaptiveColor=getAdaptiveColor,exports.getOptimalConfig=function(){const t=detectEnvironmentPreset();return{...e,...s[t]}},exports.isBrowser=a,exports.isNode=i,exports.parseStackTrace=function(){try{const e=(new Error).stack;if(!e)return null;const t=e.split("\n").filter(e=>e.trim());for(let r=1;r<t.length;r++){const e=t[r];if(!e)continue;if(e.includes("parseStackTrace")||e.includes("Logger.")||e.includes(".log(")||e.includes("createStyledOutput"))continue;let s;const n=e.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);if(n)s=n;else{const t=e.match(/(.+?)@(.+?):(\d+):(\d+)$/);if(t)s=t;else{const t=e.match(/(\S+)?@(.+?):(\d+):(\d+)$/);t&&(s=t)}}if(!s)continue;const[,o,i,a,l]=s;if(!i)continue;const d=i.split("/"),c=d[d.length-1];if(!c)continue;const p=c.split("?")[0],u=a?parseInt(a,10):0;return{file:p||"unknown",line:u,column:l?parseInt(l,10):0,function:o&&o.trim()?o.trim():void 0}}return null}catch{return null}},exports.parseTimeInput=function(e){if(e instanceof Date)return e;if("number"==typeof e)return new Date(Date.now()-e*t.h);if("string"==typeof e){const r=new Date(e);if(!isNaN(r.getTime()))return r;try{const r=function(e){const r=e.match(/^(\d+)(ms|s|m|h|d)$/);if(!r)throw new Error(`Invalid time format: ${e}. Use format like "2h", "30m", "1d"`);const[,s,n]=r,o=t[n];return parseInt(s||"0",10)*o}(e);return new Date(Date.now()-r)}catch{throw new Error(`Invalid time format: ${e}`)}}throw new Error("Unsupported time input type: "+typeof e)},exports.safeStringify=function(e,t=3){try{return JSON.stringify(e,(e,t)=>"function"==typeof t?"[Function]":t instanceof Error?`[Error: ${t.message}]`:t instanceof Date?t.toISOString():void 0===t?"[undefined]":t,2)}catch(r){return String(e)}},exports.setupThemeChangeListener=function(e){try{if("undefined"==typeof window||!window.matchMedia)return null;const t=window.matchMedia("(prefers-color-scheme: dark)"),handler=t=>{e(t.matches?"dark":"light")};return t.addEventListener?(t.addEventListener("change",handler),()=>t.removeEventListener("change",handler)):t.addListener?(t.addListener(handler),()=>t.removeListener?.(handler)):null}catch(t){return console.warn("Failed to set up theme change listener:",t),null}},exports.supportsANSIColors=function(){return!!i&&(!0===process.stdout?.isTTY||"1"===process.env.FORCE_COLOR||"true"===process.env.FORCE_COLOR)},exports.supportsCSSColors=function(){return a};
|
|
4
|
-
//# sourceMappingURL=environment-5I5unY89.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment-5I5unY89.js","sources":["../../src/constants.ts","../../src/utils/timestamps.ts","../../src/styling/StyleBuilder.ts","../../src/utils/output.ts","../../src/utils/environment.ts","../../src/utils/stackTrace.ts"],"sourcesContent":["/**\n * @fileoverview Global constants for Advanced Logger\n */\n\nimport type { LogLevel, AdaptiveColors } from './types/index.js';\nimport type { LevelStyleConfig } from './utils/index.js';\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG = {\n verbosity: 'info' as const,\n enableColors: true,\n enableTimestamps: true,\n enableStackTrace: true,\n theme: 'default' as const,\n bannerType: 'simple' as const,\n bufferSize: 1000,\n autoDetectTheme: true,\n outputFormat: 'auto' as const,\n} as const;\n\n/**\n * Basic level styles for core module (minimal CSS styling)\n */\nexport const LEVEL_STYLES: Record<LogLevel | 'success', LevelStyleConfig> = {\n debug: {\n emoji: '🔍',\n label: 'DEBUG',\n background: 'linear-gradient(90deg, #6c757d, #495057)',\n color: '#ffffff',\n border: '1px solid #6c757d',\n shadow: '0 2px 4px rgba(108, 117, 125, 0.3)'\n },\n info: {\n emoji: 'ℹ️',\n label: 'INFO',\n background: 'linear-gradient(90deg, #007bff, #0056b3)',\n color: '#ffffff',\n border: '1px solid #007bff',\n shadow: '0 2px 4px rgba(0, 123, 255, 0.3)'\n },\n warn: {\n emoji: '⚠️',\n label: 'WARN',\n background: 'linear-gradient(90deg, #ffc107, #e0a800)',\n color: '#000000',\n border: '1px solid #ffc107',\n shadow: '0 2px 4px rgba(255, 193, 7, 0.3)'\n },\n error: {\n emoji: '❌',\n label: 'ERROR',\n background: 'linear-gradient(90deg, #dc3545, #c82333)',\n color: '#ffffff',\n border: '1px solid #dc3545',\n shadow: '0 2px 4px rgba(220, 53, 69, 0.3)'\n },\n critical: {\n emoji: '🚨',\n label: 'CRITICAL',\n background: 'linear-gradient(90deg, #8B0000, #FF0000)',\n color: '#ffffff',\n border: '2px solid #FF0000',\n shadow: '0 4px 8px rgba(255, 0, 0, 0.4)'\n },\n success: {\n emoji: '✅',\n label: 'SUCCESS',\n background: 'linear-gradient(90deg, #28a745, #1e7e34)',\n color: '#ffffff',\n border: '1px solid #28a745',\n shadow: '0 2px 4px rgba(40, 167, 69, 0.3)'\n }\n} as const;\n\n/**\n * Maximum allowed buffer sizes for performance\n */\nexport const BUFFER_LIMITS = {\n MIN_SIZE: 50,\n DEFAULT_SIZE: 1000,\n MAX_SIZE: 10000,\n} as const;\n\n/**\n * Export format definitions with extensions\n */\nexport const EXPORT_FORMATS = {\n json: { extension: '.json', mimeType: 'application/json' },\n csv: { extension: '.csv', mimeType: 'text/csv' },\n markdown: { extension: '.md', mimeType: 'text/markdown' },\n plain: { extension: '.txt', mimeType: 'text/plain' },\n html: { extension: '.html', mimeType: 'text/html' },\n} as const;\n\n/**\n * CLI command definitions\n */\nexport const CLI_COMMANDS = {\n config: 'config',\n help: 'help',\n themes: 'themes',\n banners: 'banners',\n banner: 'banner',\n status: 'status',\n reset: 'reset',\n demo: 'demo',\n export: 'export',\n copy: 'copy',\n 'buffer-size': 'buffer-size',\n 'clear-buffer': 'clear-buffer',\n 'buffer-info': 'buffer-info',\n} as const;\n\n/**\n * Time parsing constants for relative time filters\n */\nexport const TIME_UNITS = {\n ms: 1,\n s: 1000,\n m: 60 * 1000,\n h: 60 * 60 * 1000,\n d: 24 * 60 * 60 * 1000,\n} as const;\n\n/**\n * Default styling values\n */\nexport const STYLE_DEFAULTS = {\n FONT_FAMILY: 'Monaco, Consolas, monospace',\n FONT_SIZE: '12px',\n BORDER_RADIUS: '4px',\n PADDING: '4px 8px',\n} as const;\n\n/**\n * Level priority mapping for filtering\n */\nexport const LEVEL_PRIORITIES: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n critical: 4,\n} as const;\n\n/**\n * Adaptive color configurations for DevTools theme compatibility\n */\nexport const ADAPTIVE_COLORS = {\n timestamp: {\n light: '#666666',\n dark: '#a0a0a0',\n },\n messageText: {\n light: '#2d3748',\n dark: '#f7fafc',\n },\n prefix: {\n light: '#2d3748',\n dark: '#e2e8f0',\n },\n prefixBackground: {\n light: '#2d3748',\n dark: '#4a5568',\n },\n location: {\n light: '#718096',\n dark: '#a0aec0',\n },\n} as const satisfies Record<string, AdaptiveColors>;\n\n/**\n * Presets específicos para diferentes entornos de build\n */\nexport const BUILD_PRESETS = {\n /**\n * Configuración optimizada para Next.js builds\n */\n nextjs: {\n verbosity: 'info' as const,\n enableColors: true,\n enableTimestamps: false,\n enableStackTrace: false,\n autoDetectTheme: false,\n outputFormat: 'build' as const,\n },\n\n /**\n * Configuración para Webpack builds\n */\n webpack: {\n verbosity: 'info' as const,\n enableColors: true,\n enableTimestamps: true,\n enableStackTrace: false,\n autoDetectTheme: false,\n outputFormat: 'build' as const,\n },\n\n /**\n * Configuración para CI/CD environments\n */\n ci: {\n verbosity: 'info' as const,\n enableColors: false,\n enableTimestamps: true,\n enableStackTrace: true,\n autoDetectTheme: false,\n outputFormat: 'ci' as const,\n },\n\n /**\n * Configuración para desarrollo terminal\n */\n terminal: {\n verbosity: 'debug' as const,\n enableColors: true,\n enableTimestamps: true,\n enableStackTrace: true,\n autoDetectTheme: false,\n outputFormat: 'ansi' as const,\n }\n} as const;\n\n/**\n * Mapeo de variables de entorno a presets\n */\nexport const ENVIRONMENT_DETECTION = {\n // Next.js detection\n isNextJS: typeof process !== 'undefined' && (\n process.env.NEXT_RUNTIME ||\n process.env.NEXT_PUBLIC_VERCEL_ENV ||\n (process.argv && process.argv.some(arg => arg.includes('next')))\n ),\n\n // Webpack detection\n isWebpack: typeof process !== 'undefined' && (\n process.env.WEBPACK_ENV ||\n process.env.WEBPACK_BUILD ||\n (process.argv && process.argv.some(arg => arg.includes('webpack')))\n ),\n\n // CI/CD detection\n isCI: typeof process !== 'undefined' && (\n process.env.CI ||\n process.env.GITHUB_ACTIONS ||\n process.env.JENKINS_URL ||\n process.env.GITLAB_CI ||\n process.env.TRAVIS ||\n process.env.CIRCLECI\n ),\n\n // Build detection\n isBuild: typeof process !== 'undefined' && (\n process.env.NODE_ENV === 'production' ||\n process.env.BUILD_MODE === 'production' ||\n (process.argv && process.argv.some(arg => arg.includes('build')))\n ),\n\n // Terminal with ANSI support\n isTerminal: typeof process !== 'undefined' && (\n process.stdout?.isTTY === true &&\n process.env.TERM !== 'dumb'\n )\n} as const;\n\n/**\n * Auto-detects the best preset based on current environment\n */\nexport function detectEnvironmentPreset(): keyof typeof BUILD_PRESETS {\n if (ENVIRONMENT_DETECTION.isCI) {\n return 'ci';\n }\n\n if (ENVIRONMENT_DETECTION.isNextJS) {\n return 'nextjs';\n }\n\n if (ENVIRONMENT_DETECTION.isWebpack) {\n return 'webpack';\n }\n\n if (ENVIRONMENT_DETECTION.isTerminal) {\n return 'terminal';\n }\n\n return 'terminal'; // Default fallback\n}\n\n/**\n * Gets the optimal configuration for current environment\n */\nexport function getOptimalConfig() {\n const preset = detectEnvironmentPreset();\n return {\n ...DEFAULT_CONFIG,\n ...BUILD_PRESETS[preset]\n };\n}","/**\n * @fileoverview Timestamp utilities for Advanced Logger\n */\n\nimport { TIME_UNITS } from '../constants.js';\n\n/**\n * Formats the timestamp using modern Date API\n */\nexport function formatTimestamp(): string {\n try {\n // Use modern Temporal API if available, fallback to Date\n const now = new Date();\n return now.toISOString();\n } catch {\n return new Date().toISOString();\n }\n}\n\n/**\n * Parse relative time strings like \"2h\", \"30m\", \"1d\" into milliseconds\n */\nexport function parseRelativeTime(timeStr: string): number {\n const match = timeStr.match(/^(\\d+)(ms|s|m|h|d)$/);\n if (!match) {\n throw new Error(`Invalid time format: ${timeStr}. Use format like \"2h\", \"30m\", \"1d\"`);\n }\n\n const [, amount, unit] = match;\n const multiplier = TIME_UNITS[unit as keyof typeof TIME_UNITS];\n \n return parseInt(amount || '0', 10) * multiplier;\n}\n\n/**\n * Parse time input which can be Date, ISO string, or relative time\n */\nexport function parseTimeInput(input: Date | string | number): Date {\n if (input instanceof Date) {\n return input;\n }\n\n if (typeof input === 'number') {\n // Assume hours ago\n return new Date(Date.now() - input * TIME_UNITS.h);\n }\n\n if (typeof input === 'string') {\n // Try parsing as ISO date first\n const isoDate = new Date(input);\n if (!isNaN(isoDate.getTime())) {\n return isoDate;\n }\n\n // Try parsing as relative time\n try {\n const ms = parseRelativeTime(input);\n return new Date(Date.now() - ms);\n } catch {\n throw new Error(`Invalid time format: ${input}`);\n }\n }\n\n throw new Error(`Unsupported time input type: ${typeof input}`);\n}\n\n/**\n * Format timestamp for display in different contexts\n */\nexport function formatDisplayTime(date: Date, format: 'short' | 'full' | 'time-only' = 'short'): string {\n switch (format) {\n case 'time-only':\n return date.toTimeString().slice(0, 8); // HH:MM:SS\n case 'full':\n return date.toISOString();\n case 'short':\n default:\n return date.toISOString().slice(11, 23); // HH:MM:SS.mmm\n }\n}","/**\n * @fileoverview StyleBuilder class for Advanced Logger\n */\n\n/**\n * Utility class for creating dynamic console styles with method chaining\n */\nexport class StyleBuilder {\n private styles: string[] = [];\n\n constructor(baseStyle = '') {\n if (baseStyle) this.styles.push(baseStyle);\n }\n\n /**\n * Add background color or gradient\n */\n bg(background: string): StyleBuilder {\n this.styles.push(`background: ${background}`);\n return this;\n }\n\n /**\n * Add text color\n */\n color(color: string): StyleBuilder {\n this.styles.push(`color: ${color}`);\n return this;\n }\n\n /**\n * Add border styling\n */\n border(border: string): StyleBuilder {\n this.styles.push(`border: ${border}`);\n return this;\n }\n\n /**\n * Add box shadow\n */\n shadow(shadow: string): StyleBuilder {\n this.styles.push(`box-shadow: ${shadow}`);\n return this;\n }\n\n /**\n * Add padding\n */\n padding(padding: string): StyleBuilder {\n this.styles.push(`padding: ${padding}`);\n return this;\n }\n\n /**\n * Add margin\n */\n margin(margin: string): StyleBuilder {\n this.styles.push(`margin: ${margin}`);\n return this;\n }\n\n /**\n * Add border radius\n */\n rounded(radius: string = '4px'): StyleBuilder {\n this.styles.push(`border-radius: ${radius}`);\n return this;\n }\n\n /**\n * Add font weight\n */\n bold(): StyleBuilder {\n this.styles.push('font-weight: bold');\n return this;\n }\n\n /**\n * Add font styling\n */\n font(font: string): StyleBuilder {\n this.styles.push(`font-family: ${font}`);\n return this;\n }\n\n /**\n * Set monospace font family (alias for common monospace fonts)\n */\n mono(): StyleBuilder {\n return this.font('Monaco, Consolas, \"Courier New\", monospace');\n }\n\n /**\n * Set system font family (alias for system fonts)\n */\n system(): StyleBuilder {\n return this.font('system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif');\n }\n\n /**\n * Add font size\n */\n size(size: string): StyleBuilder {\n this.styles.push(`font-size: ${size}`);\n return this;\n }\n\n /**\n * Add line height\n */\n lineHeight(height: string): StyleBuilder {\n this.styles.push(`line-height: ${height}`);\n return this;\n }\n\n /**\n * Add text decoration\n */\n underline(): StyleBuilder {\n this.styles.push('text-decoration: underline');\n return this;\n }\n\n /**\n * Add text transform\n */\n uppercase(): StyleBuilder {\n this.styles.push('text-transform: uppercase');\n return this;\n }\n\n /**\n * Add opacity\n */\n opacity(value: number): StyleBuilder {\n this.styles.push(`opacity: ${value}`);\n return this;\n }\n\n /**\n * Add display property\n */\n display(value: string): StyleBuilder {\n this.styles.push(`display: ${value}`);\n return this;\n }\n\n /**\n * Add position property\n */\n position(value: string): StyleBuilder {\n this.styles.push(`position: ${value}`);\n return this;\n }\n\n /**\n * Add transform property\n */\n transform(value: string): StyleBuilder {\n this.styles.push(`transform: ${value}`);\n return this;\n }\n\n /**\n * Add animation property\n */\n animation(value: string): StyleBuilder {\n this.styles.push(`animation: ${value}`);\n return this;\n }\n\n /**\n * Add transition property\n */\n transition(value: string): StyleBuilder {\n this.styles.push(`transition: ${value}`);\n return this;\n }\n\n /**\n * Add cursor property\n */\n cursor(value: string): StyleBuilder {\n this.styles.push(`cursor: ${value}`);\n return this;\n }\n\n /**\n * Add any custom CSS property\n */\n custom(property: string, value: string): StyleBuilder {\n this.styles.push(`${property}: ${value}`);\n return this;\n }\n\n /**\n * Add any CSS property (alias for custom)\n */\n css(property: string, value: string): StyleBuilder {\n return this.custom(property, value);\n }\n\n /**\n * Build the final CSS string\n */\n build(): string {\n return this.styles.join('; ');\n }\n\n /**\n * Clear all styles and start fresh\n */\n clear(): StyleBuilder {\n this.styles = [];\n return this;\n }\n\n /**\n * Clone this StyleBuilder with the same styles\n */\n clone(): StyleBuilder {\n const cloned = new StyleBuilder();\n cloned.styles = [...this.styles];\n return cloned;\n }\n\n /**\n * Merge another StyleBuilder's styles into this one\n */\n merge(other: StyleBuilder): StyleBuilder {\n this.styles.push(...other.styles);\n return this;\n }\n}\n\n/**\n * Proxy-based dynamic styler for chainable console styling\n */\nfunction createStyler(): any {\n const builder = new StyleBuilder();\n return new Proxy(builder, {\n get(target: StyleBuilder, prop: string) {\n if (prop in target) {\n const method = (target as any)[prop];\n if (typeof method === 'function') {\n return method.bind(target);\n }\n return method;\n }\n return undefined;\n }\n });\n}\n\n/**\n * Dynamic styler instance for external use\n */\nexport const $ = createStyler();\n\n/**\n * Pre-defined style presets for common use cases\n */\nexport const StylePresets = {\n success: () => new StyleBuilder()\n .bg('linear-gradient(135deg, #00b894 0%, #00a085 100%)')\n .color('#ffffff')\n .padding('4px 8px')\n .rounded('4px')\n .bold(),\n\n error: () => new StyleBuilder()\n .bg('linear-gradient(135deg, #e84393 0%, #d63031 100%)')\n .color('#ffffff')\n .padding('4px 8px')\n .rounded('4px')\n .bold(),\n\n warning: () => new StyleBuilder()\n .bg('linear-gradient(135deg, #fdcb6e 0%, #e17055 100%)')\n .color('#2d3436')\n .padding('4px 8px')\n .rounded('4px')\n .bold(),\n\n info: () => new StyleBuilder()\n .bg('linear-gradient(135deg, #74b9ff 0%, #0984e3 100%)')\n .color('#ffffff')\n .padding('4px 8px')\n .rounded('4px')\n .bold(),\n\n debug: () => new StyleBuilder()\n .bg('linear-gradient(135deg, #667eea 0%, #764ba2 100%)')\n .color('#ffffff')\n .padding('4px 8px')\n .rounded('4px')\n .bold(),\n\n muted: () => new StyleBuilder()\n .color('#6c757d')\n .font('Monaco, Consolas, monospace')\n .size('12px'),\n\n accent: () => new StyleBuilder()\n .bg('#f8f9fa')\n .color('#495057')\n .padding('2px 6px')\n .rounded('3px')\n .border('1px solid #dee2e6'),\n\n neon: () => new StyleBuilder()\n .bg('linear-gradient(135deg, #0f3460 0%, #e94560 100%)')\n .color('#00ffff')\n .padding('4px 8px')\n .rounded('4px')\n .bold()\n .shadow('0 0 10px rgba(0, 255, 255, 0.5)'),\n};","/**\n * @fileoverview Styled output creation utilities for Advanced Logger\n */\n\nimport type { LogLevel, StackInfo, DevToolsTheme, AdaptiveColors } from '../types/index.js';\nimport { formatTimestamp } from './timestamps.js';\nimport { StyleBuilder } from '../styling/index.js';\nimport { ADAPTIVE_COLORS } from '../constants.js';\n\n/**\n * Style configuration for each log level\n */\nexport interface LevelStyleConfig {\n emoji: string;\n label: string;\n background: string;\n color: string;\n border: string;\n shadow: string;\n}\n\n/**\n * Detects the current DevTools theme preference\n */\nexport function detectDevToolsTheme(): DevToolsTheme {\n try {\n if (typeof window === 'undefined' || !window.matchMedia) {\n return 'light'; // Safe fallback for SSR or older browsers\n }\n \n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n return mediaQuery.matches ? 'dark' : 'light';\n } catch (error) {\n console.warn('Failed to detect DevTools theme:', error);\n return 'light'; // Fallback to light theme\n }\n}\n\n/**\n * Gets adaptive color based on current DevTools theme\n */\nexport function getAdaptiveColor(colors: AdaptiveColors, theme?: DevToolsTheme): string {\n const currentTheme = theme ?? detectDevToolsTheme();\n return colors[currentTheme];\n}\n\n/**\n * Sets up theme change listener for dynamic updates\n */\nexport function setupThemeChangeListener(callback: (theme: DevToolsTheme) => void): (() => void) | null {\n try {\n if (typeof window === 'undefined' || !window.matchMedia) {\n return null;\n }\n\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n const handler = (e: MediaQueryListEvent) => {\n callback(e.matches ? 'dark' : 'light');\n };\n\n // Use newer addEventListener if available, fallback to addListener\n if (mediaQuery.addEventListener) {\n mediaQuery.addEventListener('change', handler);\n return () => mediaQuery.removeEventListener('change', handler);\n } else if (mediaQuery.addListener) {\n mediaQuery.addListener(handler);\n return () => mediaQuery.removeListener?.(handler);\n }\n\n return null;\n } catch (error) {\n console.warn('Failed to set up theme change listener:', error);\n return null;\n }\n}\n\n\n/**\n * Creates styled console output with multiple %c formatters\n */\nexport function createStyledOutput(\n level: LogLevel,\n levelStyles: Record<LogLevel | 'success', LevelStyleConfig>,\n prefix: string | undefined,\n message: string,\n stackInfo: StackInfo | null,\n autoDetectTheme: boolean = true\n): [string, ...string[]] {\n const levelConfig = levelStyles[level];\n const timestamp = formatTimestamp();\n const currentTheme = autoDetectTheme ? detectDevToolsTheme() : 'light';\n\n // Base styles with adaptive colors\n const timestampStyle = new StyleBuilder()\n .color(getAdaptiveColor(ADAPTIVE_COLORS.timestamp, currentTheme))\n .size('11px')\n .font('Monaco, Consolas, monospace')\n .build();\n\n const levelStyle = new StyleBuilder()\n .bg(levelConfig.background)\n .color(levelConfig.color)\n .border(levelConfig.border)\n .shadow(levelConfig.shadow)\n .padding('2px 8px')\n .rounded('4px')\n .bold()\n .font('Monaco, Consolas, monospace')\n .size('12px')\n .build();\n\n const prefixStyle = new StyleBuilder()\n .bg(getAdaptiveColor(ADAPTIVE_COLORS.prefixBackground, currentTheme))\n .color(getAdaptiveColor(ADAPTIVE_COLORS.prefix, currentTheme))\n .padding('2px 6px')\n .rounded('3px')\n .bold()\n .font('Monaco, Consolas, monospace')\n .size('11px')\n .build();\n\n const messageStyle = new StyleBuilder()\n .color(getAdaptiveColor(ADAPTIVE_COLORS.messageText, currentTheme))\n .font('system-ui, -apple-system, sans-serif')\n .size('14px')\n .build();\n\n const locationStyle = new StyleBuilder()\n .color(getAdaptiveColor(ADAPTIVE_COLORS.location, currentTheme))\n .size('11px')\n .font('Monaco, Consolas, monospace')\n .build();\n\n // Build format string and styles\n let format = `%c${timestamp.slice(11, 23)} %c${levelConfig.emoji} ${levelConfig.label}`;\n const styles = [timestampStyle, levelStyle];\n\n if (prefix) {\n format += ` %c${prefix}`;\n styles.push(prefixStyle);\n }\n\n format += ` %c${message}`;\n styles.push(messageStyle);\n\n if (stackInfo) {\n format += ` %c(${stackInfo.file}:${stackInfo.line}:${stackInfo.column})`;\n styles.push(locationStyle);\n }\n\n return [format, ...styles];\n}\n\n/**\n * Create a unique ID for log entries\n */\nexport function generateLogId(): string {\n return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n}\n\n/**\n * Escape HTML entities for safe HTML output\n */\nexport function escapeHtml(text: string): string {\n const div = document.createElement('div');\n div.textContent = text;\n return div.innerHTML;\n}\n\n/**\n * Convert objects to safe string representation for logging\n */\nexport function safeStringify(obj: any, _maxDepth = 3): string {\n try {\n return JSON.stringify(obj, (_key, value) => {\n if (typeof value === 'function') return '[Function]';\n if (value instanceof Error) return `[Error: ${value.message}]`;\n if (value instanceof Date) return value.toISOString();\n if (typeof value === 'undefined') return '[undefined]';\n return value;\n }, 2);\n } catch (error) {\n return String(obj);\n }\n}","/**\n * @fileoverview Environment detection utilities for Universal Logger\n */\n\n/**\n * Checks if running in Node.js environment\n */\nexport const isNode = typeof process !== 'undefined' && \n process.versions && \n process.versions.node;\n\n/**\n * Checks if running in browser environment\n */\nexport const isBrowser = typeof window !== 'undefined' && \n typeof document !== 'undefined';\n\n/**\n * Checks if running in web worker environment\n */\nexport const isWebWorker = typeof self !== 'undefined' && \n typeof (self as any).importScripts === 'function';\n\n/**\n * Checks if running in Deno environment\n */\nexport const isDeno = typeof globalThis !== 'undefined' && \n 'Deno' in globalThis;\n\n/**\n * Gets the current runtime environment\n */\nexport function getRuntimeEnvironment(): 'node' | 'browser' | 'webworker' | 'deno' | 'unknown' {\n if (isNode) return 'node';\n if (isBrowser) return 'browser';\n if (isWebWorker) return 'webworker';\n if (isDeno) return 'deno';\n return 'unknown';\n}\n\n/**\n * Checks if colors/styling should be supported in current environment\n */\nexport function supportsColors(): boolean {\n if (isBrowser) {\n // Browser always supports CSS colors\n return true;\n }\n \n if (isNode) {\n // Check if Node.js supports colors\n return process.stdout?.isTTY === true || \n process.env.FORCE_COLOR === '1' ||\n process.env.FORCE_COLOR === 'true';\n }\n \n return false;\n}\n\n/**\n * Checks if CSS styling is supported (browser-only feature)\n */\nexport function supportsCSSColors(): boolean {\n return isBrowser;\n}\n\n/**\n * Checks if ANSI colors are supported (terminal environments)\n */\nexport function supportsANSIColors(): boolean {\n if (isNode) {\n return process.stdout?.isTTY === true || \n process.env.FORCE_COLOR === '1' ||\n process.env.FORCE_COLOR === 'true';\n }\n \n return false;\n}\n\n/**\n * Gets environment-specific information\n */\nexport function getEnvironmentInfo() {\n const env = getRuntimeEnvironment();\n \n return {\n runtime: env,\n supportsColors: supportsColors(),\n supportsCSSColors: supportsCSSColors(),\n supportsANSIColors: supportsANSIColors(),\n isProduction: isNode ? process.env.NODE_ENV === 'production' : false,\n version: isNode ? process.versions.node : (isBrowser ? navigator.userAgent : 'unknown')\n };\n}","/**\n * @fileoverview Stack trace parsing utilities for Advanced Logger\n */\n\nimport type { StackInfo } from '../types/index.js';\n\n/**\n * Parses the current stack trace to extract caller information\n */\nexport function parseStackTrace(): StackInfo | null {\n try {\n const stack = new Error().stack;\n if (!stack) {\n return null;\n }\n\n const lines = stack.split('\\n').filter(line => line.trim());\n \n // Find the first caller that's not from Logger methods\n for (let i = 1; i < lines.length; i++) {\n const line = lines[i];\n \n if (!line) {\n continue;\n }\n \n // Skip if line contains Logger methods or parseStackTrace\n if (line.includes('parseStackTrace') || \n line.includes('Logger.') || \n line.includes('.log(') ||\n line.includes('createStyledOutput')) {\n continue;\n }\n\n // Parse different stack trace formats\n let match;\n \n // Chrome format: \"at functionName (file:line:column)\" or \"at file:line:column\"\n const chromeMatch = line.match(/at\\s+(?:(.+?)\\s+\\()?(.+?):(\\d+):(\\d+)\\)?$/);\n if (chromeMatch) {\n match = chromeMatch;\n } else {\n // Firefox format: \"functionName@file:line:column\"\n const firefoxMatch = line.match(/(.+?)@(.+?):(\\d+):(\\d+)$/);\n if (firefoxMatch) {\n match = firefoxMatch;\n } else {\n // Safari/other formats\n const safariMatch = line.match(/(\\S+)?@(.+?):(\\d+):(\\d+)$/);\n if (safariMatch) {\n match = safariMatch;\n }\n }\n }\n\n if (!match) {\n continue;\n }\n\n const [, functionName, file, lineStr, columnStr] = match;\n \n if (!file) {\n continue;\n }\n \n // Process file path - remove query params and get filename\n const fileParts = file.split('/');\n const fileName = fileParts[fileParts.length - 1];\n if (!fileName) {\n continue;\n }\n const cleanFileName = fileName.split('?')[0];\n \n // Parse line and column numbers\n const lineNum = lineStr ? parseInt(lineStr, 10) : 0;\n const columnNum = columnStr ? parseInt(columnStr, 10) : 0;\n \n // Clean function name\n const cleanFunction = functionName && functionName.trim() \n ? functionName.trim() \n : undefined;\n \n return {\n file: cleanFileName ? cleanFileName : 'unknown',\n line: lineNum,\n column: columnNum,\n function: cleanFunction\n };\n }\n \n return null;\n } catch {\n return null;\n }\n}"],"names":["DEFAULT_CONFIG","verbosity","enableColors","enableTimestamps","enableStackTrace","theme","bannerType","bufferSize","autoDetectTheme","outputFormat","TIME_UNITS","ms","s","m","h","d","ADAPTIVE_COLORS","timestamp","light","dark","messageText","prefix","prefixBackground","location","BUILD_PRESETS","nextjs","webpack","ci","terminal","ENVIRONMENT_DETECTION","isNextJS","process","env","NEXT_RUNTIME","NEXT_PUBLIC_VERCEL_ENV","argv","some","arg","includes","isWebpack","WEBPACK_ENV","WEBPACK_BUILD","isCI","CI","GITHUB_ACTIONS","JENKINS_URL","GITLAB_CI","TRAVIS","CIRCLECI","isBuild","isTerminal","stdout","isTTY","TERM","detectEnvironmentPreset","formatTimestamp","Date","toISOString","StyleBuilder","styles","constructor","baseStyle","this","push","bg","background","color","border","shadow","padding","margin","rounded","radius","bold","font","mono","system","size","lineHeight","height","underline","uppercase","opacity","value","display","position","transform","animation","transition","cursor","custom","property","css","build","join","clear","clone","cloned","merge","other","builder","Proxy","get","target","prop","method","bind","createStyler","StylePresets","success","error","warning","info","debug","muted","accent","neon","detectDevToolsTheme","window","matchMedia","matches","console","warn","getAdaptiveColor","colors","isNode","versions","node","isBrowser","document","MIN_SIZE","DEFAULT_SIZE","MAX_SIZE","json","extension","mimeType","csv","markdown","plain","html","emoji","label","critical","level","levelStyles","message","stackInfo","levelConfig","currentTheme","timestampStyle","levelStyle","prefixStyle","messageStyle","locationStyle","format","slice","file","line","column","text","div","createElement","textContent","innerHTML","date","toTimeString","now","Math","random","toString","substr","preset","stack","Error","lines","split","filter","trim","i","length","match","chromeMatch","firefoxMatch","safariMatch","functionName","lineStr","columnStr","fileParts","fileName","cleanFileName","lineNum","parseInt","function","input","isoDate","isNaN","getTime","timeStr","amount","unit","multiplier","parseRelativeTime","obj","_maxDepth","JSON","stringify","_key","String","callback","mediaQuery","handler","e","addEventListener","removeEventListener","addListener","removeListener","FORCE_COLOR"],"mappings":"aAUO,MAAMA,EAAiB,CAC1BC,UA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