toolcraft-openapi 0.0.165 → 0.0.166
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/composition.json
CHANGED
|
@@ -109,27 +109,47 @@ export class Prompt extends EventEmitter {
|
|
|
109
109
|
return Promise.reject(new Error(nonTtyPromptMessage()));
|
|
110
110
|
}
|
|
111
111
|
readNonTtyLine() {
|
|
112
|
+
if (this.input.readableEnded) {
|
|
113
|
+
return Promise.resolve("");
|
|
114
|
+
}
|
|
115
|
+
if (this.input.destroyed) {
|
|
116
|
+
this.state = "cancel";
|
|
117
|
+
return Promise.resolve(CANCEL);
|
|
118
|
+
}
|
|
112
119
|
return new Promise((resolve) => {
|
|
113
|
-
|
|
120
|
+
let rl = null;
|
|
114
121
|
let settled = false;
|
|
115
122
|
const settle = (value) => {
|
|
116
123
|
if (settled) {
|
|
117
124
|
return;
|
|
118
125
|
}
|
|
119
126
|
settled = true;
|
|
120
|
-
this.
|
|
121
|
-
|
|
127
|
+
this.input.removeListener("close", onCancel);
|
|
128
|
+
this.signal?.removeEventListener("abort", onCancel);
|
|
129
|
+
rl?.close();
|
|
122
130
|
resolve(value);
|
|
123
131
|
};
|
|
124
|
-
const
|
|
132
|
+
const onCancel = () => {
|
|
125
133
|
this.state = "cancel";
|
|
126
134
|
settle(CANCEL);
|
|
127
135
|
};
|
|
136
|
+
this.input.once("close", onCancel);
|
|
137
|
+
rl = readline.createInterface({ input: this.input, terminal: false });
|
|
138
|
+
if (settled) {
|
|
139
|
+
rl.close();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
128
142
|
rl.once("line", settle);
|
|
129
|
-
rl.once("close", () => settle(rl
|
|
130
|
-
this.signal?.addEventListener("abort",
|
|
143
|
+
rl.once("close", () => settle(rl?.line ?? ""));
|
|
144
|
+
this.signal?.addEventListener("abort", onCancel, { once: true });
|
|
131
145
|
if (this.signal?.aborted) {
|
|
132
|
-
|
|
146
|
+
onCancel();
|
|
147
|
+
}
|
|
148
|
+
else if (this.input.readableEnded) {
|
|
149
|
+
settle(rl.line);
|
|
150
|
+
}
|
|
151
|
+
else if (this.input.destroyed) {
|
|
152
|
+
onCancel();
|
|
133
153
|
}
|
|
134
154
|
});
|
|
135
155
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft-openapi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.166",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"toolcraft-openapi-generate": "dist/bin/generate.js"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"toolcraft": "0.0.
|
|
33
|
+
"toolcraft": "0.0.166",
|
|
34
34
|
"fast-string-width": "^3.0.2",
|
|
35
35
|
"fast-wrap-ansi": "^0.2.0",
|
|
36
36
|
"sisteransi": "^1.0.5",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"directory": "packages/toolcraft-openapi"
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"toolcraft-schema": "0.0.
|
|
48
|
+
"toolcraft-schema": "0.0.166",
|
|
49
49
|
"toolcraft-design": "*",
|
|
50
50
|
"@poe-code/frontmatter": "*"
|
|
51
51
|
},
|