@ridit/lens 0.1.6 → 0.1.8

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/hello.py ADDED
@@ -0,0 +1,51 @@
1
+ # hello.py
2
+ # A simple script that reads a text file, makes an HTTP request,
3
+ # and prints the result in a friendly way.
4
+
5
+ import json
6
+ import pathlib
7
+ import sys
8
+ from urllib.request import urlopen
9
+
10
+ def read_local_file(path: str) -> str:
11
+ """Read the contents of a file and return it as a string."""
12
+ file_path = pathlib.Path(path)
13
+ if not file_path.is_file():
14
+ raise FileNotFoundError(f"❌ File not found: {path}")
15
+ return file_path.read_text(encoding="utf-8")
16
+
17
+ def fetch_json(url: str) -> dict:
18
+ """Fetch JSON from a URL and decode it into a Python dict."""
19
+ with urlopen(url) as response:
20
+ if response.status != 200:
21
+ raise RuntimeError(f"❌ HTTP {response.status} from {url}")
22
+ data = response.read()
23
+ return json.loads(data)
24
+
25
+ def main():
26
+ # 1️⃣ Read a local file (optional – you can comment this out)
27
+ try:
28
+ local_content = read_local_file("example.txt")
29
+ print("📄 Contents of example.txt:")
30
+ print(local_content)
31
+ except FileNotFoundError:
32
+ print("⚠️ example.txt not found – skipping that step.")
33
+
34
+ # 2️⃣ Fetch some JSON data from a public API
35
+ url = "https://api.github.com/repos/python/cpython"
36
+ print(f"\n🌐 Fetching data from {url} …")
37
+ repo_info = fetch_json(url)
38
+
39
+ # 3️⃣ Extract a couple of useful fields and display them
40
+ name = repo_info.get("name")
41
+ stars = repo_info.get("stargazers_count")
42
+ description = repo_info.get("description")
43
+ print("\n🔎 Repository info:")
44
+ print(f"• Name: {name}")
45
+ print(f"• Stars: {stars:,}") # adds commas for readability
46
+ print(f"• Description: {description}")
47
+
48
+ return 0
49
+
50
+ if __name__ == "__main__":
51
+ sys.exit(main())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ridit/lens",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Know Your Codebase.",
5
5
  "author": "Ridit Jangra <riditjangra09@gmail.com> (https://ridit.space)",
6
6
  "license": "MIT",
@@ -18,8 +18,6 @@
18
18
  "prepublishOnly": "npm run build"
19
19
  },
20
20
  "dependencies": {
21
- "@ridit/lens": "^0.1.5",
22
- "chalk": "^5.6.2",
23
21
  "commander": "^14.0.3",
24
22
  "figures": "^6.1.0",
25
23
  "ink": "^6.8.0",
@@ -27,7 +25,8 @@
27
25
  "ink-text-input": "^6.0.0",
28
26
  "nanoid": "^5.1.6",
29
27
  "react": "^19.2.4",
30
- "react-devtools-core": "^7.0.1"
28
+ "react-devtools-core": "^7.0.1",
29
+ "sugar-high": "^0.9.5"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@types/bun": "latest",
package/src/colors.ts CHANGED
@@ -1 +1,10 @@
1
1
  export const ACCENT = "#DA7758";
2
+
3
+ export const TOKEN_KEYWORD = "#B385C9";
4
+ export const TOKEN_STRING = "#85C98A";
5
+ export const TOKEN_NUMBER = "#E8C170";
6
+ export const TOKEN_PROPERTY = "#79C5D4";
7
+ export const TOKEN_ENTITY = "#7AABDB";
8
+ export const TOKEN_TEXT = "#E8E8E8";
9
+ export const TOKEN_MUTED = "#888888";
10
+ export const TOKEN_COMMENT = "#777777";