vector-framework 0.9.5 → 0.9.7
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/README.md +2 -0
- package/dist/cli/index.js +90 -55
- package/dist/cli/index.js.map +1 -1
- package/dist/cli.js +112 -62
- package/dist/core/config-loader.d.ts.map +1 -1
- package/dist/core/config-loader.js +9 -4
- package/dist/core/config-loader.js.map +1 -1
- package/dist/core/server.d.ts +3 -3
- package/dist/core/server.d.ts.map +1 -1
- package/dist/core/server.js +50 -27
- package/dist/core/server.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +8 -8
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cli/index.ts +111 -70
- package/src/core/config-loader.ts +10 -4
- package/src/core/server.ts +60 -31
- package/src/types/index.ts +6 -4
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ const config: VectorConfigSchema = {
|
|
|
27
27
|
routesDir: "./routes", // Routes directory (default: ./routes)
|
|
28
28
|
development: process.env.NODE_ENV !== "production", // Development mode
|
|
29
29
|
reusePort: true, // Reuse port (default: true)
|
|
30
|
+
idleTimeout: 60, // Idle timeout in seconds (default: 60)
|
|
30
31
|
|
|
31
32
|
// CORS configuration
|
|
32
33
|
cors: {
|
|
@@ -338,6 +339,7 @@ interface VectorConfig {
|
|
|
338
339
|
development?: boolean; // Development mode
|
|
339
340
|
routesDir?: string; // Routes directory (default: ./routes)
|
|
340
341
|
autoDiscover?: boolean; // Auto-discover routes (default: true)
|
|
342
|
+
idleTimeout?: number; // Idle timeout in seconds (default: 60)
|
|
341
343
|
cors?: CorsOptions; // CORS configuration
|
|
342
344
|
before?: BeforeMiddlewareHandler[]; // Pre-request middleware
|
|
343
345
|
finally?: AfterMiddlewareHandler[]; // Post-response middleware
|
package/dist/cli/index.js
CHANGED
|
@@ -32,6 +32,10 @@ const { values, positionals } = parseArgs({
|
|
|
32
32
|
type: "boolean",
|
|
33
33
|
default: true,
|
|
34
34
|
},
|
|
35
|
+
config: {
|
|
36
|
+
type: "string",
|
|
37
|
+
short: "c",
|
|
38
|
+
},
|
|
35
39
|
},
|
|
36
40
|
strict: true,
|
|
37
41
|
allowPositionals: true,
|
|
@@ -43,61 +47,75 @@ async function runDev() {
|
|
|
43
47
|
let server = null;
|
|
44
48
|
let vector = null;
|
|
45
49
|
async function startServer() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
config
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
50
|
+
// Create a timeout promise that rejects after 10 seconds
|
|
51
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
reject(new Error("Server startup timed out (10s)"));
|
|
54
|
+
}, 10000);
|
|
55
|
+
});
|
|
56
|
+
// Create the actual server start promise
|
|
57
|
+
const serverStartPromise = (async () => {
|
|
58
|
+
try {
|
|
59
|
+
// Load configuration using ConfigLoader
|
|
60
|
+
const configLoader = new ConfigLoader(values.config);
|
|
61
|
+
const config = await configLoader.load();
|
|
62
|
+
const configSource = configLoader.getConfigSource();
|
|
63
|
+
// Merge CLI options with loaded config
|
|
64
|
+
// Only use CLI values if config doesn't have them
|
|
65
|
+
config.port = config.port ?? Number.parseInt(values.port);
|
|
66
|
+
config.hostname = config.hostname ?? values.host;
|
|
67
|
+
config.routesDir = config.routesDir ?? values.routes;
|
|
68
|
+
config.development = config.development ?? isDev;
|
|
69
|
+
config.autoDiscover = true; // Always auto-discover routes
|
|
70
|
+
// Apply CLI CORS option if not set in config
|
|
71
|
+
if (!config.cors && values.cors) {
|
|
72
|
+
config.cors = {
|
|
73
|
+
origin: "*",
|
|
74
|
+
credentials: true,
|
|
75
|
+
allowHeaders: "Content-Type, Authorization",
|
|
76
|
+
allowMethods: "GET, POST, PUT, PATCH, DELETE, OPTIONS",
|
|
77
|
+
exposeHeaders: "Authorization",
|
|
78
|
+
maxAge: 86400,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// Get Vector instance and configure handlers
|
|
82
|
+
vector = getVectorInstance();
|
|
83
|
+
// Load and set auth handler if configured
|
|
84
|
+
const authHandler = await configLoader.loadAuthHandler();
|
|
85
|
+
if (authHandler) {
|
|
86
|
+
vector.setProtectedHandler(authHandler);
|
|
87
|
+
}
|
|
88
|
+
// Load and set cache handler if configured
|
|
89
|
+
const cacheHandler = await configLoader.loadCacheHandler();
|
|
90
|
+
if (cacheHandler) {
|
|
91
|
+
vector.setCacheHandler(cacheHandler);
|
|
92
|
+
}
|
|
93
|
+
// Start the server
|
|
94
|
+
server = await vector.startServer(config);
|
|
95
|
+
// Verify the server is actually running
|
|
96
|
+
if (!server || !server.port) {
|
|
97
|
+
throw new Error("Server started but is not responding correctly");
|
|
98
|
+
}
|
|
99
|
+
const gray = "\x1b[90m";
|
|
100
|
+
const reset = "\x1b[0m";
|
|
101
|
+
const cyan = "\x1b[36m";
|
|
102
|
+
const green = "\x1b[32m";
|
|
103
|
+
console.log(` ${gray}Config${reset} ${configSource === "user" ? "User config loaded" : "Using defaults"}`);
|
|
104
|
+
console.log(` ${gray}Routes${reset} ${config.routesDir}`);
|
|
105
|
+
if (isDev && values.watch) {
|
|
106
|
+
console.log(` ${gray}Watching${reset} All project files`);
|
|
107
|
+
}
|
|
108
|
+
console.log(` ${gray}CORS${reset} ${config.cors ? "Enabled" : "Disabled"}`);
|
|
109
|
+
console.log(` ${gray}Mode${reset} ${config.development ? "Development" : "Production"}\n`);
|
|
110
|
+
console.log(` ${green}Ready${reset} → ${cyan}http://${config.hostname}:${config.port}${reset}\n`);
|
|
111
|
+
return { server, vector, config };
|
|
80
112
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const gray = "\x1b[90m";
|
|
84
|
-
const reset = "\x1b[0m";
|
|
85
|
-
const cyan = "\x1b[36m";
|
|
86
|
-
const green = "\x1b[32m";
|
|
87
|
-
console.log(` ${gray}Config${reset} ${configSource === "user" ? "User config loaded" : "Using defaults"}`);
|
|
88
|
-
console.log(` ${gray}Routes${reset} ${config.routesDir}`);
|
|
89
|
-
if (isDev && values.watch) {
|
|
90
|
-
console.log(` ${gray}Watching${reset} All project files`);
|
|
113
|
+
catch (error) {
|
|
114
|
+
throw error;
|
|
91
115
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return { server, vector, config };
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
console.error("[ERROR] Failed to start server:", error);
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
116
|
+
})();
|
|
117
|
+
// Race between server startup and timeout
|
|
118
|
+
return await Promise.race([serverStartPromise, timeoutPromise]);
|
|
101
119
|
}
|
|
102
120
|
try {
|
|
103
121
|
// Start the server initially
|
|
@@ -159,7 +177,8 @@ async function runDev() {
|
|
|
159
177
|
vector = result.vector;
|
|
160
178
|
}
|
|
161
179
|
catch (error) {
|
|
162
|
-
console.error("
|
|
180
|
+
console.error("\n[Reload Error]", error.message || error);
|
|
181
|
+
// Don't exit the process on reload failures, just continue watching
|
|
163
182
|
}
|
|
164
183
|
finally {
|
|
165
184
|
// Reset flag after a delay
|
|
@@ -177,7 +196,22 @@ async function runDev() {
|
|
|
177
196
|
}
|
|
178
197
|
}
|
|
179
198
|
catch (error) {
|
|
180
|
-
|
|
199
|
+
const red = "\x1b[31m";
|
|
200
|
+
const reset = "\x1b[0m";
|
|
201
|
+
console.error(`\n${red}[ERROR] Failed to start server${reset}\n`);
|
|
202
|
+
// Always show the error message and stack trace
|
|
203
|
+
if (error.message) {
|
|
204
|
+
console.error(`Message: ${error.message}`);
|
|
205
|
+
}
|
|
206
|
+
if (error.stack) {
|
|
207
|
+
console.error(`\nStack trace:`);
|
|
208
|
+
console.error(error.stack);
|
|
209
|
+
}
|
|
210
|
+
else if (!error.message) {
|
|
211
|
+
// If no message or stack, show the raw error
|
|
212
|
+
console.error(`Raw error:`, error);
|
|
213
|
+
}
|
|
214
|
+
// Ensure we exit with error code
|
|
181
215
|
process.exit(1);
|
|
182
216
|
}
|
|
183
217
|
}
|
|
@@ -244,6 +278,7 @@ Options:
|
|
|
244
278
|
-h, --host <host> Hostname to bind to (default: localhost)
|
|
245
279
|
-r, --routes <dir> Routes directory (default: ./routes)
|
|
246
280
|
-w, --watch Watch for file changes (default: true)
|
|
281
|
+
-c, --config <path> Path to config file (default: vector.config.ts)
|
|
247
282
|
--cors Enable CORS (default: true)
|
|
248
283
|
`);
|
|
249
284
|
process.exit(1);
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,4CAA4C;AAC5C,MAAM,IAAI,GACR,OAAO,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEzE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC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;QAC5B,CAAC;aAAM,CAAC;YACN,iCAAiC;YACjC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;YACpD,SAAS,CACP,KAAK,EACL,CAAC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EACzD;gBACE,KAAK,EAAE,SAAS;gBAChB,KAAK,EAAE,IAAI;aACZ,CACF,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,QAAQ,OAAO,EAAE,CAAC;IAChB,KAAK,KAAK;QACR,MAAM,MAAM,EAAE,CAAC;QACf,MAAM;IACR,KAAK,OAAO;QACV,MAAM,QAAQ,EAAE,CAAC;QACjB,MAAM;IACR,KAAK,OAAO;QACV,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC;QACpC,MAAM,MAAM,EAAE,CAAC;QACf,MAAM;IACR;QACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;CAef,CAAC,CAAC;QACC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -799,18 +799,36 @@ class VectorServer {
|
|
|
799
799
|
return new Response("Internal Server Error", { status: 500 });
|
|
800
800
|
}
|
|
801
801
|
};
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
802
|
+
try {
|
|
803
|
+
this.server = Bun.serve({
|
|
804
|
+
port,
|
|
805
|
+
hostname,
|
|
806
|
+
reusePort: this.config.reusePort !== false,
|
|
807
|
+
fetch,
|
|
808
|
+
idleTimeout: this.config.idleTimeout || 60,
|
|
809
|
+
error: (error) => {
|
|
810
|
+
console.error("[ERROR] Server error:", error);
|
|
811
|
+
return new Response("Internal Server Error", { status: 500 });
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
if (!this.server || !this.server.port) {
|
|
815
|
+
throw new Error(`Failed to start server on ${hostname}:${port} - server object is invalid`);
|
|
810
816
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
817
|
+
console.log(`\u2192 Vector server running at http://${hostname}:${port}`);
|
|
818
|
+
return this.server;
|
|
819
|
+
} catch (error) {
|
|
820
|
+
if (error.code === "EADDRINUSE" || error.message?.includes("address already in use")) {
|
|
821
|
+
error.message = `Port ${port} is already in use`;
|
|
822
|
+
error.port = port;
|
|
823
|
+
} else if (error.code === "EACCES" || error.message?.includes("permission denied")) {
|
|
824
|
+
error.message = `Permission denied to bind to port ${port}`;
|
|
825
|
+
error.port = port;
|
|
826
|
+
} else if (error.message?.includes("EADDRNOTAVAIL")) {
|
|
827
|
+
error.message = `Cannot bind to hostname ${hostname}`;
|
|
828
|
+
error.hostname = hostname;
|
|
829
|
+
}
|
|
830
|
+
throw error;
|
|
831
|
+
}
|
|
814
832
|
}
|
|
815
833
|
stop() {
|
|
816
834
|
if (this.server) {
|
|
@@ -1002,14 +1020,15 @@ import { parseArgs } from "util";
|
|
|
1002
1020
|
|
|
1003
1021
|
// src/core/config-loader.ts
|
|
1004
1022
|
import { existsSync as existsSync2 } from "fs";
|
|
1005
|
-
import { resolve as resolve2 } from "path";
|
|
1023
|
+
import { resolve as resolve2, isAbsolute } from "path";
|
|
1006
1024
|
|
|
1007
1025
|
class ConfigLoader {
|
|
1008
1026
|
configPath;
|
|
1009
1027
|
config = null;
|
|
1010
1028
|
configSource = "default";
|
|
1011
|
-
constructor(configPath
|
|
1012
|
-
|
|
1029
|
+
constructor(configPath) {
|
|
1030
|
+
const path = configPath || "vector.config.ts";
|
|
1031
|
+
this.configPath = isAbsolute(path) ? path : resolve2(process.cwd(), path);
|
|
1013
1032
|
}
|
|
1014
1033
|
async load() {
|
|
1015
1034
|
if (existsSync2(this.configPath)) {
|
|
@@ -1043,6 +1062,7 @@ class ConfigLoader {
|
|
|
1043
1062
|
config.reusePort = this.config.reusePort;
|
|
1044
1063
|
config.development = this.config.development;
|
|
1045
1064
|
config.routesDir = this.config.routesDir || "./routes";
|
|
1065
|
+
config.idleTimeout = this.config.idleTimeout;
|
|
1046
1066
|
}
|
|
1047
1067
|
config.autoDiscover = true;
|
|
1048
1068
|
if (this.config?.cors) {
|
|
@@ -1106,6 +1126,10 @@ var { values, positionals } = parseArgs({
|
|
|
1106
1126
|
cors: {
|
|
1107
1127
|
type: "boolean",
|
|
1108
1128
|
default: true
|
|
1129
|
+
},
|
|
1130
|
+
config: {
|
|
1131
|
+
type: "string",
|
|
1132
|
+
short: "c"
|
|
1109
1133
|
}
|
|
1110
1134
|
},
|
|
1111
1135
|
strict: true,
|
|
@@ -1120,54 +1144,64 @@ async function runDev() {
|
|
|
1120
1144
|
let server = null;
|
|
1121
1145
|
let vector = null;
|
|
1122
1146
|
async function startServer() {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
config.
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1147
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
1148
|
+
setTimeout(() => {
|
|
1149
|
+
reject(new Error("Server startup timed out (10s)"));
|
|
1150
|
+
}, 1e4);
|
|
1151
|
+
});
|
|
1152
|
+
const serverStartPromise = (async () => {
|
|
1153
|
+
try {
|
|
1154
|
+
const configLoader = new ConfigLoader(values.config);
|
|
1155
|
+
const config = await configLoader.load();
|
|
1156
|
+
const configSource = configLoader.getConfigSource();
|
|
1157
|
+
config.port = config.port ?? Number.parseInt(values.port);
|
|
1158
|
+
config.hostname = config.hostname ?? values.host;
|
|
1159
|
+
config.routesDir = config.routesDir ?? values.routes;
|
|
1160
|
+
config.development = config.development ?? isDev;
|
|
1161
|
+
config.autoDiscover = true;
|
|
1162
|
+
if (!config.cors && values.cors) {
|
|
1163
|
+
config.cors = {
|
|
1164
|
+
origin: "*",
|
|
1165
|
+
credentials: true,
|
|
1166
|
+
allowHeaders: "Content-Type, Authorization",
|
|
1167
|
+
allowMethods: "GET, POST, PUT, PATCH, DELETE, OPTIONS",
|
|
1168
|
+
exposeHeaders: "Authorization",
|
|
1169
|
+
maxAge: 86400
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
vector = getVectorInstance();
|
|
1173
|
+
const authHandler = await configLoader.loadAuthHandler();
|
|
1174
|
+
if (authHandler) {
|
|
1175
|
+
vector.setProtectedHandler(authHandler);
|
|
1176
|
+
}
|
|
1177
|
+
const cacheHandler = await configLoader.loadCacheHandler();
|
|
1178
|
+
if (cacheHandler) {
|
|
1179
|
+
vector.setCacheHandler(cacheHandler);
|
|
1180
|
+
}
|
|
1181
|
+
server = await vector.startServer(config);
|
|
1182
|
+
if (!server || !server.port) {
|
|
1183
|
+
throw new Error("Server started but is not responding correctly");
|
|
1184
|
+
}
|
|
1185
|
+
const gray = "\x1B[90m";
|
|
1186
|
+
const reset = "\x1B[0m";
|
|
1187
|
+
const cyan = "\x1B[36m";
|
|
1188
|
+
const green = "\x1B[32m";
|
|
1189
|
+
console.log(` ${gray}Config${reset} ${configSource === "user" ? "User config loaded" : "Using defaults"}`);
|
|
1190
|
+
console.log(` ${gray}Routes${reset} ${config.routesDir}`);
|
|
1191
|
+
if (isDev && values.watch) {
|
|
1192
|
+
console.log(` ${gray}Watching${reset} All project files`);
|
|
1193
|
+
}
|
|
1194
|
+
console.log(` ${gray}CORS${reset} ${config.cors ? "Enabled" : "Disabled"}`);
|
|
1195
|
+
console.log(` ${gray}Mode${reset} ${config.development ? "Development" : "Production"}
|
|
1163
1196
|
`);
|
|
1164
|
-
|
|
1197
|
+
console.log(` ${green}Ready${reset} \u2192 ${cyan}http://${config.hostname}:${config.port}${reset}
|
|
1165
1198
|
`);
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
}
|
|
1199
|
+
return { server, vector, config };
|
|
1200
|
+
} catch (error) {
|
|
1201
|
+
throw error;
|
|
1202
|
+
}
|
|
1203
|
+
})();
|
|
1204
|
+
return await Promise.race([serverStartPromise, timeoutPromise]);
|
|
1171
1205
|
}
|
|
1172
1206
|
try {
|
|
1173
1207
|
const result = await startServer();
|
|
@@ -1207,7 +1241,8 @@ async function runDev() {
|
|
|
1207
1241
|
server = result2.server;
|
|
1208
1242
|
vector = result2.vector;
|
|
1209
1243
|
} catch (error) {
|
|
1210
|
-
console.error(
|
|
1244
|
+
console.error(`
|
|
1245
|
+
[Reload Error]`, error.message || error);
|
|
1211
1246
|
} finally {
|
|
1212
1247
|
setTimeout(() => {
|
|
1213
1248
|
isReloading = false;
|
|
@@ -1221,7 +1256,21 @@ async function runDev() {
|
|
|
1221
1256
|
}
|
|
1222
1257
|
}
|
|
1223
1258
|
} catch (error) {
|
|
1224
|
-
|
|
1259
|
+
const red = "\x1B[31m";
|
|
1260
|
+
const reset = "\x1B[0m";
|
|
1261
|
+
console.error(`
|
|
1262
|
+
${red}[ERROR] Failed to start server${reset}
|
|
1263
|
+
`);
|
|
1264
|
+
if (error.message) {
|
|
1265
|
+
console.error(`Message: ${error.message}`);
|
|
1266
|
+
}
|
|
1267
|
+
if (error.stack) {
|
|
1268
|
+
console.error(`
|
|
1269
|
+
Stack trace:`);
|
|
1270
|
+
console.error(error.stack);
|
|
1271
|
+
} else if (!error.message) {
|
|
1272
|
+
console.error(`Raw error:`, error);
|
|
1273
|
+
}
|
|
1225
1274
|
process.exit(1);
|
|
1226
1275
|
}
|
|
1227
1276
|
}
|
|
@@ -1288,6 +1337,7 @@ Options:
|
|
|
1288
1337
|
-h, --host <host> Hostname to bind to (default: localhost)
|
|
1289
1338
|
-r, --routes <dir> Routes directory (default: ./routes)
|
|
1290
1339
|
-w, --watch Watch for file changes (default: true)
|
|
1340
|
+
-c, --config <path> Path to config file (default: vector.config.ts)
|
|
1291
1341
|
--cors Enable CORS (default: true)
|
|
1292
1342
|
`);
|
|
1293
1343
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/core/config-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB,qBAAa,YAAY,CAAC,MAAM,SAAS,WAAW,GAAG,kBAAkB;IACvE,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAA2C;IACzD,OAAO,CAAC,YAAY,CAAiC;gBAEzC,UAAU,
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/core/config-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB,qBAAa,YAAY,CAAC,MAAM,SAAS,WAAW,GAAG,kBAAkB;IACvE,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAA2C;IACzD,OAAO,CAAC,YAAY,CAAiC;gBAEzC,UAAU,CAAC,EAAE,MAAM;IAUzB,IAAI,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAgC3C,eAAe,IAAI,MAAM,GAAG,SAAS;YAIvB,iBAAiB;IA8CzB,eAAe,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAI3D,gBAAgB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAItD,SAAS,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,IAAI;CAG/C"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
2
|
+
import { resolve, isAbsolute } from "node:path";
|
|
3
3
|
import { toFileUrl } from "../utils/path";
|
|
4
4
|
export class ConfigLoader {
|
|
5
5
|
configPath;
|
|
6
6
|
config = null;
|
|
7
7
|
configSource = "default";
|
|
8
|
-
constructor(configPath
|
|
9
|
-
//
|
|
10
|
-
|
|
8
|
+
constructor(configPath) {
|
|
9
|
+
// Use provided config path or default to vector.config.ts
|
|
10
|
+
const path = configPath || "vector.config.ts";
|
|
11
|
+
// Handle absolute vs relative paths
|
|
12
|
+
this.configPath = isAbsolute(path)
|
|
13
|
+
? path
|
|
14
|
+
: resolve(process.cwd(), path);
|
|
11
15
|
}
|
|
12
16
|
async load() {
|
|
13
17
|
// Check if config file exists before attempting to load
|
|
@@ -48,6 +52,7 @@ export class ConfigLoader {
|
|
|
48
52
|
config.reusePort = this.config.reusePort;
|
|
49
53
|
config.development = this.config.development;
|
|
50
54
|
config.routesDir = this.config.routesDir || "./routes";
|
|
55
|
+
config.idleTimeout = this.config.idleTimeout;
|
|
51
56
|
}
|
|
52
57
|
// Always auto-discover routes
|
|
53
58
|
config.autoDiscover = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/core/config-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/core/config-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAW1C,MAAM,OAAO,YAAY;IACf,UAAU,CAAS;IACnB,MAAM,GAAsC,IAAI,CAAC;IACjD,YAAY,GAAuB,SAAS,CAAC;IAErD,YAAY,UAAmB;QAC7B,0DAA0D;QAC1D,MAAM,IAAI,GAAG,UAAU,IAAI,kBAAkB,CAAC;QAE9C,oCAAoC;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC;YAChC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,wDAAwD;QACxD,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC;gBACH,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEzD,wDAAwD;gBACxD,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAClD,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;gBAChD,IAAI,CAAC,MAA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|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Server } from
|
|
2
|
-
import type { DefaultVectorTypes, VectorConfig, VectorTypes } from
|
|
3
|
-
import type { VectorRouter } from
|
|
1
|
+
import type { Server } from "bun";
|
|
2
|
+
import type { DefaultVectorTypes, VectorConfig, VectorTypes } from "../types";
|
|
3
|
+
import type { VectorRouter } from "./router";
|
|
4
4
|
export declare class VectorServer<TTypes extends VectorTypes = DefaultVectorTypes> {
|
|
5
5
|
private server;
|
|
6
6
|
private router;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/core/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/core/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,KAAK,EAEV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,qBAAa,YAAY,CAAC,MAAM,SAAS,WAAW,GAAG,kBAAkB;IACvE,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,WAAW,CAAM;gBAEb,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC;IAYtE,OAAO,CAAC,oBAAoB;IAiBtB,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAiE9B,IAAI;IAQJ,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B,OAAO,IAAI,MAAM;IAIjB,WAAW,IAAI,MAAM;IAIrB,MAAM,IAAI,MAAM;CAKjB"}
|