@leftium/gg 0.0.35 → 0.0.36

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.
@@ -521,7 +521,16 @@ export function createGgPlugin(options, gg) {
521
521
  padding-bottom: 4px;
522
522
  border-bottom: 1px solid #ddd;
523
523
  }
524
- /* Level-based styling for warn/error entries */
524
+ /* Level-based styling for info/warn/error entries */
525
+ .gg-level-info .gg-log-diff,
526
+ .gg-level-info .gg-log-ns,
527
+ .gg-level-info .gg-log-content {
528
+ background: rgba(23, 162, 184, 0.08);
529
+ }
530
+ .gg-level-info .gg-log-content {
531
+ border-left: 3px solid #17a2b8;
532
+ padding-left: 6px;
533
+ }
525
534
  .gg-level-warn .gg-log-diff,
526
535
  .gg-level-warn .gg-log-ns,
527
536
  .gg-level-warn .gg-log-content {
@@ -1539,12 +1548,14 @@ export function createGgPlugin(options, gg) {
1539
1548
  }
1540
1549
  }
1541
1550
  const fileTitle = fileTitleText ? ` title="${escapeHtml(fileTitleText)}"` : '';
1542
- // Level class for warn/error styling
1543
- const levelClass = entry.level === 'warn'
1544
- ? ' gg-level-warn'
1545
- : entry.level === 'error'
1546
- ? ' gg-level-error'
1547
- : '';
1551
+ // Level class for info/warn/error styling
1552
+ const levelClass = entry.level === 'info'
1553
+ ? ' gg-level-info'
1554
+ : entry.level === 'warn'
1555
+ ? ' gg-level-warn'
1556
+ : entry.level === 'error'
1557
+ ? ' gg-level-error'
1558
+ : '';
1548
1559
  // Stack trace toggle (for error/trace entries with captured stacks)
1549
1560
  let stackHTML = '';
1550
1561
  if (entry.stack) {
@@ -19,7 +19,7 @@ export interface GgErudaOptions {
19
19
  erudaOptions?: Record<string, unknown>;
20
20
  }
21
21
  /** Log severity level */
22
- export type LogLevel = 'debug' | 'warn' | 'error';
22
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
23
23
  /**
24
24
  * A captured log entry from gg()
25
25
  */
@@ -41,6 +41,7 @@ export default function ggCallSitesPlugin(options = {}) {
41
41
  // Quick bail: no gg calls in this file
42
42
  if (!code.includes('gg(') &&
43
43
  !code.includes('gg.ns(') &&
44
+ !code.includes('gg.info(') &&
44
45
  !code.includes('gg.warn(') &&
45
46
  !code.includes('gg.error(') &&
46
47
  !code.includes('gg.table(') &&
@@ -799,11 +800,11 @@ export function transformGgCalls(code, shortPath, filePath, svelteInfo, jsFuncti
799
800
  i += 6;
800
801
  continue;
801
802
  }
802
- // Case 1b: gg.warn/error/table/trace/assert → gg._warn/_error/_table/_trace/_assert
803
+ // Case 1b: gg.info/warn/error/table/trace/assert → gg._info/_warn/_error/_table/_trace/_assert
803
804
  // These methods are rewritten like bare gg() but with their internal variant.
804
805
  const dotMethodMatch = code
805
806
  .slice(i + 2)
806
- .match(/^\.(warn|error|table|trace|assert|time|timeLog|timeEnd)\(/);
807
+ .match(/^\.(info|warn|error|table|trace|assert|time|timeLog|timeEnd)\(/);
807
808
  if (dotMethodMatch) {
808
809
  const methodName = dotMethodMatch[1];
809
810
  const internalName = `_${methodName}`;
package/dist/gg.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Hook for capturing gg() output (used by Eruda plugin)
3
3
  */
4
- type LogLevel = 'debug' | 'warn' | 'error';
4
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
5
5
  interface CapturedEntry {
6
6
  namespace: string;
7
7
  color: string;
@@ -110,6 +110,7 @@ export declare namespace gg {
110
110
  col?: number;
111
111
  src?: string;
112
112
  };
113
+ let info: (...args: unknown[]) => unknown;
113
114
  let warn: (...args: unknown[]) => unknown;
114
115
  let error: (...args: unknown[]) => unknown;
115
116
  let assert: (condition: unknown, ...args: unknown[]) => unknown;
@@ -118,6 +119,13 @@ export declare namespace gg {
118
119
  let timeLog: (label?: string, ...args: unknown[]) => void;
119
120
  let timeEnd: (label?: string) => void;
120
121
  let trace: (...args: unknown[]) => unknown;
122
+ let _info: (options: {
123
+ ns: string;
124
+ file?: string;
125
+ line?: number;
126
+ col?: number;
127
+ src?: string;
128
+ }, ...args: unknown[]) => unknown;
121
129
  let _warn: (options: {
122
130
  ns: string;
123
131
  file?: string;
package/dist/gg.js CHANGED
@@ -282,8 +282,11 @@ function ggLog(options, ...args) {
282
282
  logArgs = [args[0], ...args.slice(1)];
283
283
  returnValue = args[0];
284
284
  }
285
- // Add level prefix emoji for warn/error
286
- if (level === 'warn') {
285
+ // Add level prefix emoji for info/warn/error
286
+ if (level === 'info') {
287
+ logArgs[0] = `ℹ️ ${logArgs[0]}`;
288
+ }
289
+ else if (level === 'warn') {
287
290
  logArgs[0] = `⚠️ ${logArgs[0]}`;
288
291
  }
289
292
  else if (level === 'error') {
@@ -390,6 +393,29 @@ function getErrorStack(firstArg, skipFrames) {
390
393
  }
391
394
  return captureStack(skipFrames);
392
395
  }
396
+ /**
397
+ * gg.info() - Log at info level.
398
+ *
399
+ * Passthrough: returns the first argument.
400
+ * In Eruda, entries are styled with a blue/info indicator.
401
+ *
402
+ * @example
403
+ * gg.info('System startup complete');
404
+ * const config = gg.info(loadedConfig, 'loaded config');
405
+ */
406
+ gg.info = function (...args) {
407
+ if (!ggConfig.enabled || isCloudflareWorker()) {
408
+ return args.length ? args[0] : undefined;
409
+ }
410
+ const callpoint = resolveCallpoint(3);
411
+ return ggLog({ ns: callpoint, level: 'info' }, ...args);
412
+ };
413
+ /**
414
+ * gg._info() - Internal: info with call-site metadata from Vite plugin.
415
+ */
416
+ gg._info = function (options, ...args) {
417
+ return ggLog({ ...options, level: 'info' }, ...args);
418
+ };
393
419
  /**
394
420
  * gg.warn() - Log at warning level.
395
421
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leftium/gg",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Leftium/gg.git"