console-xray 0.0.4 → 0.0.5

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 (2) hide show
  1. package/dist/index.js +28 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,2 +1,28 @@
1
- // dist/index.js (ESM)
2
- export { xray } from "../src/index.js";
1
+ import chalk from "chalk";
2
+ import dayjs from "dayjs";
3
+ import callsites from "callsites";
4
+
5
+ let lastValue = null;
6
+
7
+ export function xray(value, label = "X-Ray") {
8
+ const caller = callsites()[1];
9
+ const file = caller.getFileName();
10
+ const line = caller.getLineNumber();
11
+
12
+ console.group(chalk.cyan(`🔍 ${label}`));
13
+ console.log(chalk.gray(`📍 ${file}:${line}`));
14
+ console.log(chalk.yellow("⏰ Time:"), dayjs().format("HH:mm:ss"));
15
+ console.log(chalk.green("💠 Value:"), value);
16
+ console.log(chalk.magenta("🔎 Type:"), typeof value);
17
+
18
+ if (lastValue) {
19
+ const changes = JSON.stringify(value) !== JSON.stringify(lastValue)
20
+ ? value
21
+ : null;
22
+ if (changes) console.log(chalk.red("⚡ Changes detected:"), changes);
23
+ else console.log(chalk.gray("⚡ No changes detected"));
24
+ }
25
+
26
+ lastValue = JSON.parse(JSON.stringify(value));
27
+ console.groupEnd();
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "console-xray",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -12,9 +12,9 @@
12
12
  "author": "Dadaso Bandgar",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
+ "callsites": "^4.2.0",
15
16
  "chalk": "^5.6.2",
16
- "dayjs": "^1.11.19",
17
- "callsites": "^4.2.0"
17
+ "dayjs": "^1.11.19"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@babel/core": "^7.28.5",