laxy-verify 1.1.2 → 1.1.4

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 +21 -40
  2. package/package.json +1 -1
package/dist/auth.js CHANGED
@@ -121,48 +121,29 @@ function whoami() {
121
121
  console.log(" 인증 정보를 읽을 수 없습니다.");
122
122
  }
123
123
  }
124
- /** readline으로 줄 입력 */
125
- function askQuestion(prompt, mute = false) {
126
- return new Promise((resolve) => {
127
- const rl = readline.createInterface({
128
- input: process.stdin,
129
- output: mute ? undefined : process.stdout,
130
- terminal: false,
131
- });
132
- if (mute) {
133
- process.stdout.write(prompt);
134
- }
135
- // readline.question 대신 line 이벤트 사용 (Windows 호환성)
136
- let answered = false;
137
- rl.question(mute ? "" : prompt, (ans) => {
138
- if (answered)
139
- return;
140
- answered = true;
141
- if (mute)
142
- process.stdout.write("\n");
143
- rl.close();
144
- rl.removeAllListeners();
145
- resolve(ans.trim());
124
+ 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());
146
138
  });
147
- // 비밀번호 모드에서 라인 이벤트 수동 처리 (일부 Windows 터미널 호환)
148
- if (mute) {
149
- rl.on("line", (line) => {
150
- if (answered)
151
- return;
152
- answered = true;
153
- process.stdout.write("\n");
154
- rl.close();
155
- rl.removeAllListeners();
156
- resolve(line.trim());
157
- });
158
- }
159
139
  });
160
- }
161
- async function login(emailArg) {
162
- const email = emailArg
163
- ? emailArg.trim()
164
- : await askQuestion(" 이메일: ");
165
- const password = await askQuestion(" 비밀번호: ", true);
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();
166
147
  console.log("\n 로그인 중...");
167
148
  let res;
168
149
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laxy-verify",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Frontend quality gate: build + Lighthouse verification",
5
5
  "type": "commonjs",
6
6
  "bin": {