@void.01/advanced-logger 0.0.0-stage → 0.4.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.
Files changed (53) hide show
  1. package/ARCHITECTURE.md +342 -0
  2. package/CHANGELOG.md +115 -0
  3. package/LICENSE +21 -0
  4. package/README.md +308 -2
  5. package/dist/actions.d.ts +79 -0
  6. package/dist/actions.d.ts.map +1 -0
  7. package/dist/actions.js +337 -0
  8. package/dist/actions.js.map +1 -0
  9. package/dist/ansi.d.ts +144 -0
  10. package/dist/ansi.d.ts.map +1 -0
  11. package/dist/ansi.js +219 -0
  12. package/dist/ansi.js.map +1 -0
  13. package/dist/caller.d.ts +21 -0
  14. package/dist/caller.d.ts.map +1 -0
  15. package/dist/caller.js +129 -0
  16. package/dist/caller.js.map +1 -0
  17. package/dist/config.d.ts +152 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/config.js +398 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/configFile.d.ts +31 -0
  22. package/dist/configFile.d.ts.map +1 -0
  23. package/dist/configFile.js +211 -0
  24. package/dist/configFile.js.map +1 -0
  25. package/dist/core.d.ts +17 -0
  26. package/dist/core.d.ts.map +1 -0
  27. package/dist/core.js +89 -0
  28. package/dist/core.js.map +1 -0
  29. package/dist/index.d.ts +12 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +60 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/logger.d.ts +7 -0
  34. package/dist/logger.d.ts.map +1 -0
  35. package/dist/logger.js +10 -0
  36. package/dist/logger.js.map +1 -0
  37. package/dist/playwright.d.ts +15 -0
  38. package/dist/playwright.d.ts.map +1 -0
  39. package/dist/playwright.js +47 -0
  40. package/dist/playwright.js.map +1 -0
  41. package/dist/redact.d.ts +8 -0
  42. package/dist/redact.d.ts.map +1 -0
  43. package/dist/redact.js +36 -0
  44. package/dist/redact.js.map +1 -0
  45. package/dist/sinks.d.ts +80 -0
  46. package/dist/sinks.d.ts.map +1 -0
  47. package/dist/sinks.js +461 -0
  48. package/dist/sinks.js.map +1 -0
  49. package/dist/theme.d.ts +71 -0
  50. package/dist/theme.d.ts.map +1 -0
  51. package/dist/theme.js +115 -0
  52. package/dist/theme.js.map +1 -0
  53. package/package.json +51 -4
package/dist/theme.js ADDED
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.THEME_RESET = exports.CALLER_FG = exports.TABLE_COLUMNS_FG = exports.TABLE_TITLE_FG = exports.ACTION_FG = exports.LogIntent = void 0;
4
+ exports.resolveStyle = resolveStyle;
5
+ const ansi_1 = require("./ansi");
6
+ const config_1 = require("./config");
7
+ /** Classifies what a line communicates, independent of level. Port of LogIntent. */
8
+ exports.LogIntent = {
9
+ BASE: 'BASE',
10
+ INTERACTION: 'INTERACTION',
11
+ NAVIGATION: 'NAVIGATION',
12
+ OBSERVE: 'OBSERVE',
13
+ VERIFY: 'VERIFY',
14
+ DATA: 'DATA',
15
+ SUCCESS: 'SUCCESS',
16
+ ALERT: 'ALERT',
17
+ };
18
+ /**
19
+ * The single built-in theme (HIGH_CONTRAST from the Java logger).
20
+ * One background for every level; the foreground is the action's own color (ACTION_FG), else the intent's, else
21
+ * (plain log lines) the level's. The theme is "on" when ANSI is enabled and "off" otherwise.
22
+ */
23
+ const BG = ansi_1.BG_BLACK;
24
+ /** ERROR level and the `failed` action share this red. Brighter than RGB_FG.DEEP_RED, which is under 4.5:1 on dark grey. */
25
+ const ERROR_RED = (0, ansi_1.rgbFg)(248, 75, 75);
26
+ const LEVEL_FG = {
27
+ INFO: ansi_1.FG_BRIGHT_WHITE + ansi_1.BOLD,
28
+ WARN: ansi_1.RGB_FG.DEEP_AMBER + ansi_1.BOLD,
29
+ ERROR: ERROR_RED + ansi_1.BOLD,
30
+ DEBUG: ansi_1.FG_BRIGHT_BLACK + ansi_1.BOLD,
31
+ };
32
+ /** Fallback when a line has an intent but no action (custom LogActions subclasses). Each is its family's anchor. */
33
+ const INTENT_FG = {
34
+ INTERACTION: (0, ansi_1.rgbFg)(70, 166, 255) + ansi_1.BOLD,
35
+ NAVIGATION: (0, ansi_1.rgbFg)(0, 196, 196) + ansi_1.BOLD,
36
+ OBSERVE: ansi_1.FG_BRIGHT_MAGENTA + ansi_1.BOLD,
37
+ VERIFY: (0, ansi_1.rgbFg)(240, 207, 76) + ansi_1.BOLD,
38
+ DATA: (0, ansi_1.rgbFg)(181, 139, 249) + ansi_1.BOLD,
39
+ SUCCESS: (0, ansi_1.rgbFg)(75, 201, 87) + ansi_1.BOLD,
40
+ ALERT: ERROR_RED + ansi_1.BOLD,
41
+ };
42
+ /**
43
+ * One foreground per action, inside its intent's hue family, so `click` and `input` differ while every interaction
44
+ * still reads as blue and every alert as red or orange. Picked in OKLCH, then checked: each color is at least 4.6:1
45
+ * against #1e1e1e, colors in one family are at least 10 apart (CIEDE2000), and colors in different families at
46
+ * least 12. Re-check those numbers when changing a value.
47
+ */
48
+ exports.ACTION_FG = {
49
+ // INTERACTION: blues, from cyan-blue to indigo
50
+ click: (0, ansi_1.rgbFg)(70, 166, 255),
51
+ hover: (0, ansi_1.rgbFg)(76, 142, 182),
52
+ checkbox: (0, ansi_1.rgbFg)(100, 126, 239),
53
+ toggle: (0, ansi_1.rgbFg)(183, 211, 255),
54
+ dropdown: (0, ansi_1.rgbFg)(105, 248, 255),
55
+ input: (0, ansi_1.rgbFg)(0, 207, 247),
56
+ text: (0, ansi_1.rgbFg)(123, 173, 193),
57
+ password: (0, ansi_1.rgbFg)(167, 229, 255),
58
+ clear: (0, ansi_1.rgbFg)(179, 192, 202),
59
+ key: (0, ansi_1.rgbFg)(0, 153, 171),
60
+ upload: (0, ansi_1.rgbFg)(148, 165, 225),
61
+ // NAVIGATION: teals
62
+ navigate: (0, ansi_1.rgbFg)(0, 196, 196),
63
+ tab: (0, ansi_1.rgbFg)(91, 235, 190),
64
+ frame: (0, ansi_1.rgbFg)(71, 161, 144),
65
+ breadcrumb: (0, ansi_1.rgbFg)(164, 219, 206),
66
+ // OBSERVE: pinks and magentas
67
+ wait: (0, ansi_1.rgbFg)(255, 167, 255),
68
+ search: (0, ansi_1.rgbFg)(216, 121, 208),
69
+ result: (0, ansi_1.rgbFg)(215, 161, 197),
70
+ // VERIFY: gold
71
+ verifying: (0, ansi_1.rgbFg)(240, 207, 76),
72
+ // DATA: violets
73
+ grid: (0, ansi_1.rgbFg)(181, 139, 249),
74
+ table: (0, ansi_1.rgbFg)(222, 209, 255),
75
+ row: (0, ansi_1.rgbFg)(149, 122, 187),
76
+ // SUCCESS: greens
77
+ success: (0, ansi_1.rgbFg)(75, 201, 87),
78
+ complete: (0, ansi_1.rgbFg)(14, 160, 83),
79
+ resolved: (0, ansi_1.rgbFg)(151, 191, 62),
80
+ // ALERT: reds and oranges; skip is muted, since a skip is not a failure
81
+ failed: ERROR_RED,
82
+ error: (0, ansi_1.rgbFg)(255, 140, 120),
83
+ timeout: (0, ansi_1.rgbFg)(216, 103, 39),
84
+ validation: (0, ansi_1.rgbFg)(255, 126, 158),
85
+ fallback: (0, ansi_1.rgbFg)(244, 136, 14),
86
+ skip: (0, ansi_1.rgbFg)(219, 198, 185),
87
+ };
88
+ /**
89
+ * Table header rows, both darker than the table body (ACTION_FG.table) and different from each other, so title,
90
+ * column names and data read as three layers of one violet:
91
+ * - title row: dark and saturated. 4.66:1 on #1e1e1e; CIEDE2000 25.8 from the body.
92
+ * - column-name row: a muted mid shade, same hue as the body. 6.15:1; 15.6 from the body, 14.9 from the title.
93
+ * A more saturated column color would drift into the observe pinks (`wait`, `search`).
94
+ */
95
+ exports.TABLE_TITLE_FG = (0, ansi_1.rgbFg)(153, 115, 223);
96
+ exports.TABLE_COLUMNS_FG = (0, ansi_1.rgbFg)(163, 151, 192);
97
+ exports.CALLER_FG = ansi_1.FG_BRIGHT_BLACK;
98
+ exports.THEME_RESET = ansi_1.RESET;
99
+ /**
100
+ * Foreground + background, each part gated by config().fg / config().bg ('' when both are off). The foreground is
101
+ * the action's color when there is one, else the intent's, else (BASE) the level's.
102
+ * Independent of config().ansi: callers (themed()) decide whether any color is wanted at all.
103
+ */
104
+ function resolveStyle(level, intent, action) {
105
+ const { fg: useFg, bg: useBg } = (0, config_1.config)();
106
+ let fg = '';
107
+ if (useFg) {
108
+ if (intent === 'BASE')
109
+ fg = LEVEL_FG[level];
110
+ else
111
+ fg = action !== undefined && action in exports.ACTION_FG ? exports.ACTION_FG[action] + ansi_1.BOLD : INTENT_FG[intent];
112
+ }
113
+ return fg + (useBg ? BG : '');
114
+ }
115
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":";;;AAyHA,oCAQC;AAjID,iCASgB;AAChB,qCAAkC;AAElC,oFAAoF;AACvE,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;IAC1B,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACN,CAAC;AAKX;;;;GAIG;AACH,MAAM,EAAE,GAAG,eAAQ,CAAC;AAEpB,4HAA4H;AAC5H,MAAM,SAAS,GAAG,IAAA,YAAK,EAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAErC,MAAM,QAAQ,GAA8B;IAC1C,IAAI,EAAE,sBAAe,GAAG,WAAI;IAC5B,IAAI,EAAE,aAAM,CAAC,UAAU,GAAG,WAAI;IAC9B,KAAK,EAAE,SAAS,GAAG,WAAI;IACvB,KAAK,EAAE,sBAAe,GAAG,WAAI;CAC9B,CAAC;AAEF,oHAAoH;AACpH,MAAM,SAAS,GAA+C;IAC5D,WAAW,EAAE,IAAA,YAAK,EAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,GA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,6 +1,53 @@
1
1
  {
2
2
  "name": "@void.01/advanced-logger",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.1",
4
+ "description": "Self-contained logger for Playwright/TypeScript. Port of VOID core.logging.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Aryan-Vashishth/advanced-logger.git"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./playwright": {
21
+ "types": "./dist/playwright.d.ts",
22
+ "default": "./dist/playwright.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "ARCHITECTURE.md",
28
+ "CHANGELOG.md"
29
+ ],
30
+ "scripts": {
31
+ "build": "tsc -p tsconfig.build.json",
32
+ "prepare": "npm run build",
33
+ "typecheck": "tsc --noEmit",
34
+ "test:unit": "vitest run",
35
+ "test:e2e": "playwright test --config=test/playwright.config.ts",
36
+ "test": "npm run test:unit && npm run test:e2e",
37
+ "sweep": "playwright test --config=test/sweep/playwright.sweep.config.ts"
38
+ },
39
+ "peerDependencies": {
40
+ "@playwright/test": ">=1.40.0"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "@playwright/test": {
44
+ "optional": true
45
+ }
46
+ },
47
+ "devDependencies": {
48
+ "@playwright/test": "^1.49.0",
49
+ "@types/node": "^22.0.0",
50
+ "typescript": "^5.6.0",
51
+ "vitest": "^2.1.0"
52
+ }
53
+ }