laxy-verify 1.1.4 → 1.1.6

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.
Files changed (2) hide show
  1. package/dist/auth.js +34 -23
  2. package/package.json +1 -1
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,29 +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
- // 입력 완료 후 stdin 핸들 해제 (Windows UV_HANDLE_CLOSING Assertion 방지)
143
- // destroy()는 rl.close()와 충돌하므로 unref()로 이벤트루프 참조만 제거
144
- rl.removeAllListeners();
145
- rl.close();
146
- process.stdin.unref();
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);
147
158
  console.log("\n 로그인 중...");
148
159
  let res;
149
160
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laxy-verify",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Frontend quality gate: build + Lighthouse verification",
5
5
  "type": "commonjs",
6
6
  "bin": {