@reopt-ai/dev-proxy 1.1.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.
@@ -0,0 +1,48 @@
1
+ import { truncate } from "./format.js";
2
+ export const LIST_COL = {
3
+ pointer: 1,
4
+ time: 15,
5
+ method: 8,
6
+ sub: 10,
7
+ status: 4,
8
+ dur: 6,
9
+ size: 7,
10
+ };
11
+ export const LIST_FIXED_WIDTH = LIST_COL.pointer +
12
+ LIST_COL.time +
13
+ LIST_COL.method +
14
+ LIST_COL.sub +
15
+ LIST_COL.status +
16
+ LIST_COL.dur +
17
+ LIST_COL.size;
18
+ export const LIST_RESERVED_LINES = 3; // ListHeader + TableHeader + separator
19
+ export const LIST_BORDER_ROWS = 2;
20
+ export const LIST_BORDER_COLS = 2;
21
+ export const LIST_PADDING_X = 1;
22
+ export function getListDimensions(termSize, halfWidth) {
23
+ const available = halfWidth ? Math.floor(termSize.cols / 2) : termSize.cols;
24
+ const innerWidth = Math.max(16, available - LIST_BORDER_COLS - LIST_PADDING_X * 2);
25
+ const pathW = Math.max(16, innerWidth - LIST_FIXED_WIDTH);
26
+ const visibleRows = Math.max(1, termSize.rows - LIST_RESERVED_LINES - LIST_BORDER_ROWS);
27
+ return { available, innerWidth, pathW, visibleRows };
28
+ }
29
+ export function buildListHeaderTokens({ available, count, followMode, errorsOnly, hideNextStatic, searchQuery, }) {
30
+ const showMeta = available >= 56;
31
+ const showFilters = available >= 64;
32
+ const query = searchQuery ? truncate(searchQuery, showFilters ? 18 : 12) : "";
33
+ const left = [
34
+ { text: "REQUESTS", kind: "requests" },
35
+ { text: "FOLLOW", kind: "follow", active: followMode },
36
+ ];
37
+ const right = [];
38
+ if (showMeta)
39
+ right.push({ text: `${count} VISIBLE`, kind: "meta" });
40
+ if (showFilters) {
41
+ right.push({ text: "FILTER", kind: "filter-label" });
42
+ right.push({ text: "ERR", kind: "err", active: errorsOnly });
43
+ right.push({ text: "QUIET", kind: "quiet", active: hideNextStatic });
44
+ if (query)
45
+ right.push({ text: `/${query}`, kind: "query", active: true });
46
+ }
47
+ return { left, right, showMeta, showFilters };
48
+ }
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@reopt-ai/dev-proxy",
3
+ "version": "1.1.1",
4
+ "description": "Subdomain-based reverse proxy and HTTP/WS traffic inspector TUI",
5
+ "license": "MIT",
6
+ "author": "reopt.ai",
7
+ "homepage": "https://github.com/reopt-ai/dev-proxy#readme",
8
+ "bugs": {
9
+ "url": "https://github.com/reopt-ai/dev-proxy/issues"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/reopt-ai/dev-proxy.git"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "keywords": [
19
+ "proxy",
20
+ "reverse-proxy",
21
+ "dev-tools",
22
+ "http-inspector",
23
+ "websocket",
24
+ "tui",
25
+ "terminal",
26
+ "ink",
27
+ "subdomain"
28
+ ],
29
+ "type": "module",
30
+ "bin": {
31
+ "dev-proxy": "bin/dev-proxy.js"
32
+ },
33
+ "files": [
34
+ "bin",
35
+ "dist",
36
+ "!dist/.tsbuildinfo",
37
+ "LICENSE",
38
+ "README.md",
39
+ "README_KO.md"
40
+ ],
41
+ "engines": {
42
+ "node": ">=20.11.0"
43
+ },
44
+ "scripts": {
45
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
46
+ "build": "pnpm run clean && tsc -p tsconfig.build.json",
47
+ "prepublishOnly": "pnpm run build",
48
+ "proxy": "pnpm run build && node dist/bootstrap.js",
49
+ "proxy:src": "node --import tsx/esm src/bootstrap.ts",
50
+ "lint": "eslint .",
51
+ "lint:fix": "eslint . --fix",
52
+ "format": "prettier --write .",
53
+ "format:check": "prettier --check .",
54
+ "typecheck": "tsc --noEmit",
55
+ "test": "vitest run",
56
+ "test:watch": "vitest",
57
+ "check": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm test"
58
+ },
59
+ "dependencies": {
60
+ "ink": "^6.8.0",
61
+ "ink-select-input": "^6.2.0",
62
+ "ink-text-input": "^6.0.0",
63
+ "react": "^19.0.0"
64
+ },
65
+ "devDependencies": {
66
+ "@eslint/js": "^10.0.1",
67
+ "@semantic-release/changelog": "^6.0.3",
68
+ "@semantic-release/git": "^10.0.1",
69
+ "@semantic-release/github": "^12.0.6",
70
+ "@types/node": "^25.5.0",
71
+ "@types/react": "^19.0.0",
72
+ "conventional-changelog-conventionalcommits": "^9.3.0",
73
+ "eslint": "^10.1.0",
74
+ "eslint-config-prettier": "^10.1.8",
75
+ "eslint-plugin-react-hooks": "^7.0.1",
76
+ "prettier": "^3.8.1",
77
+ "semantic-release": "^25.0.3",
78
+ "tsx": "^4.21.0",
79
+ "typescript": "^5.9.0",
80
+ "typescript-eslint": "^8.57.2",
81
+ "vitest": "^3.2.4"
82
+ }
83
+ }