@mandujs/cli 0.9.9 → 0.9.11
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/package.json +2 -2
- package/src/commands/dev.ts +22 -13
- package/src/main.ts +27 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mandujs/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.11",
|
|
4
4
|
"description": "Agent-Native Fullstack Framework - 에이전트가 코딩해도 아키텍처가 무너지지 않는 개발 OS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/main.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@mandujs/core": "0.9.
|
|
35
|
+
"@mandujs/core": "0.9.10"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"bun": ">=1.0.0"
|
package/src/commands/dev.ts
CHANGED
|
@@ -98,19 +98,28 @@ export async function dev(options: DevOptions = {}): Promise<void> {
|
|
|
98
98
|
devBundler = await startDevBundler({
|
|
99
99
|
rootDir,
|
|
100
100
|
manifest,
|
|
101
|
-
onRebuild: (result) => {
|
|
102
|
-
if (result.success) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
101
|
+
onRebuild: (result) => {
|
|
102
|
+
if (result.success) {
|
|
103
|
+
if (result.routeId === "*") {
|
|
104
|
+
hmrServer?.broadcast({
|
|
105
|
+
type: "reload",
|
|
106
|
+
data: {
|
|
107
|
+
timestamp: Date.now(),
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
hmrServer?.broadcast({
|
|
112
|
+
type: "island-update",
|
|
113
|
+
data: {
|
|
114
|
+
routeId: result.routeId,
|
|
115
|
+
timestamp: Date.now(),
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
hmrServer?.broadcast({
|
|
121
|
+
type: "error",
|
|
122
|
+
data: {
|
|
114
123
|
routeId: result.routeId,
|
|
115
124
|
message: result.error,
|
|
116
125
|
},
|
package/src/main.ts
CHANGED
|
@@ -123,6 +123,31 @@ function parseArgs(args: string[]): { command: string; options: Record<string, s
|
|
|
123
123
|
return { command, options };
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* 포트 옵션 안전하게 파싱
|
|
128
|
+
* - 숫자가 아니면 undefined 반환 (기본값 사용)
|
|
129
|
+
* - 유효 범위: 1-65535
|
|
130
|
+
*/
|
|
131
|
+
function parsePort(value: string | undefined, optionName = "port"): number | undefined {
|
|
132
|
+
if (!value || value === "true") {
|
|
133
|
+
return undefined; // 기본값 사용
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const port = Number(value);
|
|
137
|
+
|
|
138
|
+
if (Number.isNaN(port)) {
|
|
139
|
+
console.warn(`⚠️ Invalid --${optionName} value: "${value}" (using default)`);
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
144
|
+
console.warn(`⚠️ Invalid --${optionName} range: ${port} (must be 1-65535, using default)`);
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return port;
|
|
149
|
+
}
|
|
150
|
+
|
|
126
151
|
async function main(): Promise<void> {
|
|
127
152
|
const args = process.argv.slice(2);
|
|
128
153
|
const { command, options } = parseArgs(args);
|
|
@@ -164,7 +189,7 @@ async function main(): Promise<void> {
|
|
|
164
189
|
break;
|
|
165
190
|
|
|
166
191
|
case "dev":
|
|
167
|
-
await dev({ port:
|
|
192
|
+
await dev({ port: parsePort(options.port) });
|
|
168
193
|
break;
|
|
169
194
|
|
|
170
195
|
case "contract": {
|
|
@@ -203,7 +228,7 @@ async function main(): Promise<void> {
|
|
|
203
228
|
break;
|
|
204
229
|
case "serve":
|
|
205
230
|
success = await openAPIServe({
|
|
206
|
-
port:
|
|
231
|
+
port: parsePort(options.port),
|
|
207
232
|
});
|
|
208
233
|
break;
|
|
209
234
|
default:
|