xshell 1.2.5 → 1.2.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/net.d.ts CHANGED
@@ -66,10 +66,10 @@ export interface RequestFullOptions extends RequestOptions {
66
66
  export interface RequestRawOptions extends RequestOptions {
67
67
  raw: true;
68
68
  }
69
- export interface RequestError extends Error {
69
+ export interface RequestError<TBody extends string | Buffer = string> extends Error {
70
70
  url: URL;
71
71
  options: RequestOptions | RequestFullOptions | RequestRawOptions;
72
- response?: FullResponse<string>;
72
+ response?: FullResponse<TBody>;
73
73
  [inspect.custom]: Function;
74
74
  }
75
75
  export interface StatusCodeError {
package/net.js CHANGED
@@ -245,7 +245,9 @@ export async function request(url, options = {}) {
245
245
  value: {
246
246
  status: response.status,
247
247
  headers: response.headers,
248
- body: await stream_to_text(response.body),
248
+ body: decode
249
+ ? await stream_to_text(response.body)
250
+ : await stream_to_buffer(response.body),
249
251
  }
250
252
  }
251
253
  } : {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
package/path.d.ts CHANGED
@@ -54,7 +54,7 @@ export declare function extname(path: string): string;
54
54
  /** `/` */
55
55
  export declare const sep = "/";
56
56
  /** The platform-specific file delimiter. ';' or ':'. */
57
- export declare const delimiter: ";" | ":";
57
+ export declare const delimiter: ":" | ";";
58
58
  /** Returns an object from a path string - the opposite of format().
59
59
  @param path path to evaluate.
60
60
  @throws {TypeError} if `path` is not a string. */
@@ -81,7 +81,7 @@ export declare let path: {
81
81
  basename: typeof basename;
82
82
  extname: typeof extname;
83
83
  sep: string;
84
- delimiter: ";" | ":";
84
+ delimiter: ":" | ";";
85
85
  parse: typeof parse;
86
86
  format: typeof format;
87
87
  toNamespacedPath: typeof toNamespacedPath;
package/server.js CHANGED
@@ -180,7 +180,10 @@ export class Server {
180
180
  // send 时有可能 websocket 连接断开,抛异常,为防止循环调用 (console.error -> stdio subscriber -> throw error -> console.error)
181
181
  // 这里只能忽略错误
182
182
  try {
183
- await this.remote.send({ id, data: [typeof chunk === 'string' ? encode(chunk) : chunk] }, websocket);
183
+ await this.remote.send({
184
+ id,
185
+ data: typeof chunk === 'string' ? encode(chunk) : chunk
186
+ }, websocket);
184
187
  }
185
188
  catch { }
186
189
  };