laxy-verify 1.1.5 → 1.1.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/dist/auth.js CHANGED
@@ -49,7 +49,6 @@ exports.login = login;
49
49
  const fs = __importStar(require("node:fs"));
50
50
  const path = __importStar(require("node:path"));
51
51
  const os = __importStar(require("node:os"));
52
- const readline = __importStar(require("node:readline"));
53
52
  const CREDENTIALS_DIR = path.join(os.homedir(), ".laxy");
54
53
  const CREDENTIALS_PATH = path.join(CREDENTIALS_DIR, "credentials.json");
55
54
  exports.LAXY_API_URL = process.env.LAXY_API_URL ?? "https://laxy-blue.vercel.app";
@@ -121,32 +120,41 @@ function whoami() {
121
120
  console.log(" 인증 정보를 읽을 수 없습니다.");
122
121
  }
123
122
  }
123
+ /**
124
+ * stdin에서 한 줄을 동기적으로 읽는다.
125
+ * readline/createInterface를 사용하지 않으므로 UV async 핸들을 생성하지 않아
126
+ * Windows의 UV_HANDLE_CLOSING Assertion 문제를 원천적으로 방지한다.
127
+ */
128
+ function readLineSync(prompt, muted = false) {
129
+ process.stdout.write(prompt);
130
+ const chars = [];
131
+ const oneByte = Buffer.alloc(1);
132
+ try {
133
+ while (true) {
134
+ const n = fs.readSync(0 /* stdin fd */, oneByte, 0, 1, null);
135
+ if (n === 0)
136
+ break;
137
+ const ch = oneByte[0];
138
+ if (ch === 10 /* \n – LF */) {
139
+ if (muted)
140
+ process.stdout.write("\n");
141
+ break;
142
+ }
143
+ if (ch !== 13 /* \r – CR, Windows CRLF 때 무시 */)
144
+ chars.push(ch);
145
+ }
146
+ }
147
+ catch {
148
+ // stdin 읽기 실패 → 빈 문자열 반환
149
+ }
150
+ return Buffer.from(chars).toString("utf-8");
151
+ }
124
152
  async function login(emailArg) {
125
- // 단일 readline 인터페이스로 이메일+비밀번호 수집
126
- // (복수 rl 인스턴스 생성 Windows UV_HANDLE_CLOSING Assertion 발생)
127
- const rl = readline.createInterface({
128
- input: process.stdin,
129
- output: process.stdout,
130
- terminal: false,
131
- });
132
- const ask = (prompt) => new Promise((resolve) => rl.question(prompt, (ans) => resolve(ans.trim())));
133
- const askMuted = (prompt) => new Promise((resolve) => {
134
- process.stdout.write(prompt);
135
- rl.once("line", (line) => {
136
- process.stdout.write("\n");
137
- resolve(line.trim());
138
- });
139
- });
140
- const email = emailArg?.trim() ?? (await ask(" 이메일: "));
141
- const password = await askMuted(" 비밀번호: ");
142
- // Windows UV_HANDLE_CLOSING Assertion 방지:
143
- // rl.close()는 내부적으로 stdin.pause() → CancelIoEx(Windows) 를 호출하는데,
144
- // UV 루프가 이미 종료 중인 시점에 IOCP 완료 콜백이 wq_async에 작업을 보내면 assertion 발생.
145
- // 해결: rl.close() 없이 stdin 리스너를 직접 제거한 뒤 destroy()를 fetch *이전*에 호출.
146
- // fetch가 실행되는 동안 UV 루프가 살아있어 stdin IOCP 완료가 정상 처리된다.
147
- rl.removeAllListeners();
148
- process.stdin.removeAllListeners(); // readline이 달아놓은 stdin 리스너 제거
149
- process.stdin.destroy(); // fetch 전에 파괴 → UV 루프 활성 중 정리 완료
153
+ // readLineSync: fs.readSync(0, ...) 기반 동기 읽기
154
+ // readline.createInterface는 process.stdin을 UV async 스트림으로 열어
155
+ // Windows에서 process.exit() 시 UV_HANDLE_CLOSING Assertion을 일으킨다.
156
+ const email = emailArg?.trim() ?? readLineSync(" 이메일: ");
157
+ const password = readLineSync(" 비밀번호: ", true);
150
158
  console.log("\n 로그인 중...");
151
159
  let res;
152
160
  try {
package/dist/cli.js CHANGED
@@ -154,7 +154,9 @@ async function run() {
154
154
  // ── 서브커맨드 처리 ──────────────────────────────────────────────────────
155
155
  if (args.subcommand === "login") {
156
156
  await (0, auth_js_1.login)(args.subcommandArg);
157
- process.exit(0);
157
+ // Windows: fetch()의 TCP 소켓이 closing 중에 process.exit()을 즉시 호출하면
158
+ // UV_HANDLE_CLOSING Assertion 발생. setTimeout으로 UV 루프에 정리 시간을 준다.
159
+ setTimeout(() => process.exit(0), 100);
158
160
  return;
159
161
  }
160
162
  if (args.subcommand === "logout") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laxy-verify",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Frontend quality gate: build + Lighthouse verification",
5
5
  "type": "commonjs",
6
6
  "bin": {