projax 3.3.58 → 3.3.59
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/dist/electron/script-runner.js +52 -20
- package/dist/index.js +1 -1
- package/dist/prxi.js +844 -109
- package/dist/prxi.tsx +1234 -179
- package/dist/script-runner.js +52 -20
- package/package.json +1 -1
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/core-bridge.ts.html +0 -292
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -191
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/core-bridge.ts.html +0 -292
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -191
- package/coverage/lcov-report/port-extractor.ts.html +0 -1174
- package/coverage/lcov-report/port-scanner.ts.html +0 -301
- package/coverage/lcov-report/port-utils.ts.html +0 -670
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/script-runner.ts.html +0 -3346
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/test-parser.ts.html +0 -799
- package/coverage/lcov.info +0 -1338
- package/coverage/port-extractor.ts.html +0 -1174
- package/coverage/port-scanner.ts.html +0 -301
- package/coverage/port-utils.ts.html +0 -670
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/script-runner.ts.html +0 -3346
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/test-parser.ts.html +0 -799
- package/dist/__tests__/core-bridge.test.d.ts +0 -1
- package/dist/__tests__/core-bridge.test.js +0 -135
- package/dist/__tests__/port-extractor.test.d.ts +0 -1
- package/dist/__tests__/port-extractor.test.js +0 -407
- package/dist/__tests__/port-scanner.test.d.ts +0 -1
- package/dist/__tests__/port-scanner.test.js +0 -170
- package/dist/__tests__/port-utils.test.d.ts +0 -1
- package/dist/__tests__/port-utils.test.js +0 -127
- package/dist/__tests__/script-runner.test.d.ts +0 -1
- package/dist/__tests__/script-runner.test.js +0 -491
- package/dist/__tests__/test-parser.test.d.ts +0 -1
- package/dist/__tests__/test-parser.test.js +0 -276
- package/dist/api/__tests__/database.test.d.ts +0 -2
- package/dist/api/__tests__/database.test.d.ts.map +0 -1
- package/dist/api/__tests__/database.test.js +0 -485
- package/dist/api/__tests__/database.test.js.map +0 -1
- package/dist/api/__tests__/routes.test.d.ts +0 -2
- package/dist/api/__tests__/routes.test.d.ts.map +0 -1
- package/dist/api/__tests__/routes.test.js +0 -484
- package/dist/api/__tests__/routes.test.js.map +0 -1
- package/dist/api/__tests__/scanner.test.d.ts +0 -2
- package/dist/api/__tests__/scanner.test.d.ts.map +0 -1
- package/dist/api/__tests__/scanner.test.js +0 -403
- package/dist/api/__tests__/scanner.test.js.map +0 -1
- package/dist/core/__tests__/database.test.d.ts +0 -1
- package/dist/core/__tests__/database.test.js +0 -557
- package/dist/core/__tests__/detector.test.d.ts +0 -1
- package/dist/core/__tests__/detector.test.js +0 -375
- package/dist/core/__tests__/index.test.d.ts +0 -1
- package/dist/core/__tests__/index.test.js +0 -469
- package/dist/core/__tests__/scanner.test.d.ts +0 -1
- package/dist/core/__tests__/scanner.test.js +0 -406
- package/dist/core/__tests__/settings.test.d.ts +0 -1
- package/dist/core/__tests__/settings.test.js +0 -280
- package/dist/electron/core/__tests__/database.test.d.ts +0 -1
- package/dist/electron/core/__tests__/database.test.js +0 -557
- package/dist/electron/core/__tests__/detector.test.d.ts +0 -1
- package/dist/electron/core/__tests__/detector.test.js +0 -375
- package/dist/electron/core/__tests__/index.test.d.ts +0 -1
- package/dist/electron/core/__tests__/index.test.js +0 -469
- package/dist/electron/core/__tests__/scanner.test.d.ts +0 -1
- package/dist/electron/core/__tests__/scanner.test.js +0 -406
- package/dist/electron/core/__tests__/settings.test.d.ts +0 -1
- package/dist/electron/core/__tests__/settings.test.js +0 -280
- package/jest.config.js +0 -26
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const fs = __importStar(require("fs"));
|
|
37
|
-
const path = __importStar(require("path"));
|
|
38
|
-
const os = __importStar(require("os"));
|
|
39
|
-
const port_scanner_1 = require("../port-scanner");
|
|
40
|
-
// We need to mock the core-bridge module since it depends on the core package
|
|
41
|
-
jest.mock('../core-bridge', () => {
|
|
42
|
-
const mockDb = {
|
|
43
|
-
projects: [],
|
|
44
|
-
ports: [],
|
|
45
|
-
getProject: function (id) {
|
|
46
|
-
return this.projects.find((p) => p.id === id) || null;
|
|
47
|
-
},
|
|
48
|
-
getAllProjects: function () {
|
|
49
|
-
return [...this.projects];
|
|
50
|
-
},
|
|
51
|
-
getProjectPorts: function (projectId) {
|
|
52
|
-
return this.ports.filter((p) => p.project_id === projectId);
|
|
53
|
-
},
|
|
54
|
-
removeProjectPorts: function (projectId) {
|
|
55
|
-
this.ports = this.ports.filter((p) => p.project_id !== projectId);
|
|
56
|
-
},
|
|
57
|
-
addProjectPort: function (projectId, port, source, script) {
|
|
58
|
-
const newPort = {
|
|
59
|
-
id: this.ports.length + 1,
|
|
60
|
-
project_id: projectId,
|
|
61
|
-
port,
|
|
62
|
-
script_name: script,
|
|
63
|
-
config_source: source,
|
|
64
|
-
last_detected: Math.floor(Date.now() / 1000),
|
|
65
|
-
created_at: Math.floor(Date.now() / 1000),
|
|
66
|
-
};
|
|
67
|
-
this.ports.push(newPort);
|
|
68
|
-
return newPort;
|
|
69
|
-
},
|
|
70
|
-
// Helper for tests
|
|
71
|
-
_reset: function () {
|
|
72
|
-
this.projects = [];
|
|
73
|
-
this.ports = [];
|
|
74
|
-
},
|
|
75
|
-
_addProject: function (id, name, projectPath) {
|
|
76
|
-
this.projects.push({
|
|
77
|
-
id,
|
|
78
|
-
name,
|
|
79
|
-
path: projectPath,
|
|
80
|
-
created_at: Math.floor(Date.now() / 1000),
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
return {
|
|
85
|
-
getDatabaseManager: () => mockDb,
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
const core_bridge_1 = require("../core-bridge");
|
|
89
|
-
describe('Port Scanner', () => {
|
|
90
|
-
let testDir;
|
|
91
|
-
let mockDb;
|
|
92
|
-
beforeEach(() => {
|
|
93
|
-
testDir = path.join(os.tmpdir(), `projax-port-scanner-test-${Date.now()}`);
|
|
94
|
-
fs.mkdirSync(testDir, { recursive: true });
|
|
95
|
-
mockDb = (0, core_bridge_1.getDatabaseManager)();
|
|
96
|
-
mockDb._reset();
|
|
97
|
-
});
|
|
98
|
-
afterEach(() => {
|
|
99
|
-
if (fs.existsSync(testDir)) {
|
|
100
|
-
fs.rmSync(testDir, { recursive: true, force: true });
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
describe('shouldRescanPorts', () => {
|
|
104
|
-
it('should return true when no ports exist for project', () => {
|
|
105
|
-
mockDb._addProject(1, 'Test Project', testDir);
|
|
106
|
-
const result = (0, port_scanner_1.shouldRescanPorts)(1);
|
|
107
|
-
expect(result).toBe(true);
|
|
108
|
-
});
|
|
109
|
-
it('should return false when ports were recently detected', () => {
|
|
110
|
-
mockDb._addProject(1, 'Test Project', testDir);
|
|
111
|
-
// Add port with current timestamp
|
|
112
|
-
mockDb.addProjectPort(1, 3000, 'package.json', 'dev');
|
|
113
|
-
const result = (0, port_scanner_1.shouldRescanPorts)(1);
|
|
114
|
-
expect(result).toBe(false);
|
|
115
|
-
});
|
|
116
|
-
it('should return true when ports are older than 24 hours', () => {
|
|
117
|
-
mockDb._addProject(1, 'Test Project', testDir);
|
|
118
|
-
// Add port with old timestamp (25 hours ago)
|
|
119
|
-
const oldTimestamp = Math.floor(Date.now() / 1000) - (25 * 60 * 60);
|
|
120
|
-
const port = mockDb.addProjectPort(1, 3000, 'package.json', 'dev');
|
|
121
|
-
port.last_detected = oldTimestamp;
|
|
122
|
-
const result = (0, port_scanner_1.shouldRescanPorts)(1);
|
|
123
|
-
expect(result).toBe(true);
|
|
124
|
-
});
|
|
125
|
-
it('should return true if any port is stale (mixed timestamps)', () => {
|
|
126
|
-
mockDb._addProject(1, 'Test Project', testDir);
|
|
127
|
-
// Add recent port
|
|
128
|
-
mockDb.addProjectPort(1, 3000, 'package.json', 'dev');
|
|
129
|
-
// Add stale port (26 hours ago)
|
|
130
|
-
const oldTimestamp = Math.floor(Date.now() / 1000) - (26 * 60 * 60);
|
|
131
|
-
const stalePort = mockDb.addProjectPort(1, 8080, 'package.json', 'api');
|
|
132
|
-
stalePort.last_detected = oldTimestamp;
|
|
133
|
-
const result = (0, port_scanner_1.shouldRescanPorts)(1);
|
|
134
|
-
expect(result).toBe(true);
|
|
135
|
-
});
|
|
136
|
-
it('should return false when all ports are recent', () => {
|
|
137
|
-
mockDb._addProject(1, 'Test Project', testDir);
|
|
138
|
-
// Add multiple recent ports
|
|
139
|
-
mockDb.addProjectPort(1, 3000, 'package.json', 'dev');
|
|
140
|
-
mockDb.addProjectPort(1, 8080, 'package.json', 'api');
|
|
141
|
-
mockDb.addProjectPort(1, 5432, 'docker-compose.yml', null);
|
|
142
|
-
const result = (0, port_scanner_1.shouldRescanPorts)(1);
|
|
143
|
-
expect(result).toBe(false);
|
|
144
|
-
});
|
|
145
|
-
it('should handle project with no database entry', () => {
|
|
146
|
-
// Project doesn't exist in database
|
|
147
|
-
const result = (0, port_scanner_1.shouldRescanPorts)(999);
|
|
148
|
-
// Should return true since no ports found
|
|
149
|
-
expect(result).toBe(true);
|
|
150
|
-
});
|
|
151
|
-
it('should consider 23 hours as recent (not stale)', () => {
|
|
152
|
-
mockDb._addProject(1, 'Test Project', testDir);
|
|
153
|
-
// Add port detected 23 hours ago
|
|
154
|
-
const timestamp = Math.floor(Date.now() / 1000) - (23 * 60 * 60);
|
|
155
|
-
const port = mockDb.addProjectPort(1, 3000, 'package.json', 'dev');
|
|
156
|
-
port.last_detected = timestamp;
|
|
157
|
-
const result = (0, port_scanner_1.shouldRescanPorts)(1);
|
|
158
|
-
expect(result).toBe(false);
|
|
159
|
-
});
|
|
160
|
-
it('should consider exactly 24 hours as stale', () => {
|
|
161
|
-
mockDb._addProject(1, 'Test Project', testDir);
|
|
162
|
-
// Add port detected exactly 24 hours ago
|
|
163
|
-
const timestamp = Math.floor(Date.now() / 1000) - (24 * 60 * 60);
|
|
164
|
-
const port = mockDb.addProjectPort(1, 3000, 'package.json', 'dev');
|
|
165
|
-
port.last_detected = timestamp;
|
|
166
|
-
const result = (0, port_scanner_1.shouldRescanPorts)(1);
|
|
167
|
-
expect(result).toBe(true);
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const port_utils_1 = require("../port-utils");
|
|
4
|
-
describe('Port Utils', () => {
|
|
5
|
-
describe('extractPortFromError', () => {
|
|
6
|
-
it('should extract port from EADDRINUSE error with port only', () => {
|
|
7
|
-
const error = 'EADDRINUSE: address already in use :::3000';
|
|
8
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
9
|
-
expect(port).toBe(3000);
|
|
10
|
-
});
|
|
11
|
-
it('should extract port from EADDRINUSE error with IP address', () => {
|
|
12
|
-
const error = 'Error: listen EADDRINUSE: address already in use 0.0.0.0:3000';
|
|
13
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
14
|
-
expect(port).toBe(3000);
|
|
15
|
-
});
|
|
16
|
-
it('should extract port from simple "Port X is already in use" message', () => {
|
|
17
|
-
const error = 'Port 3000 is already in use';
|
|
18
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
19
|
-
expect(port).toBe(3000);
|
|
20
|
-
});
|
|
21
|
-
it('should extract port from "port X is already in use by another process"', () => {
|
|
22
|
-
const error = 'port 8080 is already in use by another process';
|
|
23
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
24
|
-
expect(port).toBe(8080);
|
|
25
|
-
});
|
|
26
|
-
it('should extract port from "Address already in use" message', () => {
|
|
27
|
-
const error = 'Address already in use: 5432';
|
|
28
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
29
|
-
expect(port).toBe(5432);
|
|
30
|
-
});
|
|
31
|
-
it('should extract port from EADDRINUSE with localhost', () => {
|
|
32
|
-
const error = 'EADDRINUSE: address already in use localhost:3000';
|
|
33
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
34
|
-
expect(port).toBe(3000);
|
|
35
|
-
});
|
|
36
|
-
it('should extract port from EADDRINUSE with 127.0.0.1', () => {
|
|
37
|
-
const error = 'listen EADDRINUSE: address already in use 127.0.0.1:4000';
|
|
38
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
39
|
-
expect(port).toBe(4000);
|
|
40
|
-
});
|
|
41
|
-
it('should extract port from error with multiple lines', () => {
|
|
42
|
-
const error = `
|
|
43
|
-
Error starting server
|
|
44
|
-
EADDRINUSE: address already in use :::3000
|
|
45
|
-
at Server.setupListenHandle
|
|
46
|
-
`;
|
|
47
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
48
|
-
expect(port).toBe(3000);
|
|
49
|
-
});
|
|
50
|
-
it('should extract port from "(EADDRINUSE)" format', () => {
|
|
51
|
-
const error = 'Failed to start: :3000 (EADDRINUSE)';
|
|
52
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
53
|
-
expect(port).toBe(3000);
|
|
54
|
-
});
|
|
55
|
-
it('should return null for error without port', () => {
|
|
56
|
-
const error = 'Some other error occurred';
|
|
57
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
58
|
-
expect(port).toBeNull();
|
|
59
|
-
});
|
|
60
|
-
it('should return null for invalid port number', () => {
|
|
61
|
-
const error = 'Port 999999 is already in use';
|
|
62
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
63
|
-
expect(port).toBeNull();
|
|
64
|
-
});
|
|
65
|
-
it('should return null for port 0', () => {
|
|
66
|
-
const error = 'Port 0 is already in use';
|
|
67
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
68
|
-
expect(port).toBeNull();
|
|
69
|
-
});
|
|
70
|
-
it('should extract first valid port from multiple ports', () => {
|
|
71
|
-
const error = 'Port 3000 is in use, also port 4000';
|
|
72
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
73
|
-
expect(port).toBe(3000);
|
|
74
|
-
});
|
|
75
|
-
it('should handle case-insensitive matching', () => {
|
|
76
|
-
const error = 'PORT 3000 is already in use';
|
|
77
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
78
|
-
expect(port).toBe(3000);
|
|
79
|
-
});
|
|
80
|
-
it('should extract port from Node.js-style error', () => {
|
|
81
|
-
const error = `
|
|
82
|
-
Error: listen EADDRINUSE: address already in use :::3000
|
|
83
|
-
at Server.setupListenHandle [as _listen2] (node:net:1313:16)
|
|
84
|
-
at listenInCluster (node:net:1361:12)
|
|
85
|
-
`;
|
|
86
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
87
|
-
expect(port).toBe(3000);
|
|
88
|
-
});
|
|
89
|
-
it('should extract port from Vite error message', () => {
|
|
90
|
-
const error = 'Port 5173 is already in use';
|
|
91
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
92
|
-
expect(port).toBe(5173);
|
|
93
|
-
});
|
|
94
|
-
it('should extract port from Next.js error message', () => {
|
|
95
|
-
const error = 'Error: Port 3000 is already in use';
|
|
96
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
97
|
-
expect(port).toBe(3000);
|
|
98
|
-
});
|
|
99
|
-
it('should extract common development ports', () => {
|
|
100
|
-
const testCases = [
|
|
101
|
-
{ error: 'Port 3000 is in use', expected: 3000 }, // React/Next.js
|
|
102
|
-
{ error: 'Port 8080 is in use', expected: 8080 }, // Common API
|
|
103
|
-
{ error: 'Port 5173 is in use', expected: 5173 }, // Vite
|
|
104
|
-
{ error: 'Port 4200 is in use', expected: 4200 }, // Angular
|
|
105
|
-
{ error: 'Port 8000 is in use', expected: 8000 }, // Python/Django
|
|
106
|
-
{ error: 'Port 5000 is in use', expected: 5000 }, // Flask
|
|
107
|
-
];
|
|
108
|
-
testCases.forEach(({ error, expected }) => {
|
|
109
|
-
expect((0, port_utils_1.extractPortFromError)(error)).toBe(expected);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
it('should handle errors with extra whitespace', () => {
|
|
113
|
-
const error = ' Port 3000 is already in use ';
|
|
114
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
115
|
-
expect(port).toBe(3000);
|
|
116
|
-
});
|
|
117
|
-
it('should extract port from complex error messages', () => {
|
|
118
|
-
const error = `
|
|
119
|
-
Failed to start development server.
|
|
120
|
-
Error: listen EADDRINUSE: address already in use 0.0.0.0:3000
|
|
121
|
-
Please check if another process is already using port 3000.
|
|
122
|
-
`;
|
|
123
|
-
const port = (0, port_utils_1.extractPortFromError)(error);
|
|
124
|
-
expect(port).toBe(3000);
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|