@songtonyli/dsh-cli 0.1.98 → 0.1.99

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 (181) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +12 -0
  4. package/node_modules/@aws-sdk/core/dist-es/submodules/client/getDefaultSocketTimeout.js +10 -0
  5. package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.browser.js +1 -0
  6. package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.js +1 -0
  7. package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.native.js +1 -0
  8. package/node_modules/@aws-sdk/core/package.json +1 -1
  9. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  10. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  11. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  12. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  13. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  14. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  15. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  16. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  17. package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
  18. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +3 -2
  19. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +3 -2
  20. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +3 -2
  21. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +3 -2
  22. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +3 -2
  23. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.js +2 -1
  24. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.js +2 -1
  25. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.js +2 -1
  26. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.js +2 -1
  27. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +2 -1
  28. package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
  29. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  30. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/boot.js +1 -1
  31. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/file.js +1 -1
  32. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/index.js +3 -0
  33. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/from-binary.js +3 -1
  34. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/index.js +7 -2
  35. package/node_modules/@bufbuild/protobuf/dist/cjs/package.json +1 -0
  36. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/reflect.js +0 -1
  37. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/registry.js +79 -10
  38. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/to-json.js +1 -1
  39. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/to-text.js +4 -9
  40. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/binary-encoding.js +9 -5
  41. package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/text-encoding.js +7 -3
  42. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.js +2 -2
  43. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +2 -2
  44. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.js +1 -0
  45. package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +3 -1
  46. package/node_modules/@bufbuild/protobuf/dist/esm/index.js +1 -1
  47. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +0 -1
  48. package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +77 -10
  49. package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +1 -1
  50. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/to-text.js +4 -9
  51. package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +9 -5
  52. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +7 -3
  53. package/node_modules/@bufbuild/protobuf/package.json +70 -267
  54. package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +1 -1
  55. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  56. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +4 -4
  57. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +2 -2
  58. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +2 -2
  59. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +55 -13
  60. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.cjs +1461 -176
  61. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_attributes.mjs +1363 -171
  62. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.cjs +1 -1
  63. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_events.mjs +1 -1
  64. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.cjs +382 -95
  65. package/node_modules/@opentelemetry/semantic-conventions/dist/experimental_metrics.mjs +358 -94
  66. package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.cjs +132 -8
  67. package/node_modules/@opentelemetry/semantic-conventions/dist/index-incubating.mjs +5 -5
  68. package/node_modules/@opentelemetry/semantic-conventions/dist/index.cjs +8 -0
  69. package/node_modules/@opentelemetry/semantic-conventions/dist/index.mjs +3 -3
  70. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.cjs +104 -13
  71. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_attributes.mjs +99 -14
  72. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.cjs +16 -0
  73. package/node_modules/@opentelemetry/semantic-conventions/dist/stable_metrics.mjs +15 -1
  74. package/node_modules/@opentelemetry/semantic-conventions/package.json +2 -2
  75. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +1 -0
  76. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +33 -5
  77. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +33 -5
  78. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +1 -0
  79. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retryMiddleware.js +11 -5
  80. package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/race.js +22 -0
  81. package/node_modules/@smithy/core/package.json +2 -2
  82. package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +10 -4
  83. package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +6 -2
  84. package/node_modules/@smithy/fetch-http-handler/dist-es/request-timeout.js +4 -2
  85. package/node_modules/@smithy/fetch-http-handler/package.json +3 -3
  86. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +31 -31
  87. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +2 -4
  88. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +29 -27
  89. package/node_modules/@smithy/node-http-handler/package.json +3 -3
  90. package/node_modules/@smithy/types/package.json +1 -1
  91. package/node_modules/commander/Readme.md +6 -32
  92. package/node_modules/commander/index.js +1 -1
  93. package/node_modules/commander/lib/command.js +22 -9
  94. package/node_modules/commander/lib/help.js +6 -2
  95. package/node_modules/commander/lib/option.js +1 -1
  96. package/node_modules/commander/package.json +2 -1
  97. package/node_modules/vfile-message/lib/index.js +44 -14
  98. package/node_modules/vfile-message/package.json +6 -13
  99. package/node_modules/vfile-message/readme.md +9 -14
  100. package/package.json +21 -21
  101. package/node_modules/@bufbuild/protobuf/dist/commonjs/package.json +0 -4
  102. package/node_modules/@bufbuild/protobuf/dist/esm/package.json +0 -4
  103. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/clone.js +0 -0
  104. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/boot.js +0 -0
  105. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/enum.js +0 -0
  106. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/extension.js +0 -0
  107. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/file.js +0 -0
  108. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/index.js +0 -0
  109. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/message.js +0 -0
  110. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/service.js +0 -0
  111. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/symbols.js +0 -0
  112. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv1/types.js +0 -0
  113. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/embed.js +0 -0
  114. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/enum.js +0 -0
  115. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/extension.js +0 -0
  116. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/message.js +0 -0
  117. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/restore-json-names.js +0 -0
  118. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/scalar.js +0 -0
  119. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/service.js +0 -0
  120. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/symbols.js +0 -0
  121. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/codegenv2/types.js +0 -0
  122. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/create.js +0 -0
  123. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/descriptors.js +0 -0
  124. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/equals.js +0 -0
  125. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/extensions.js +0 -0
  126. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/fields.js +0 -0
  127. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/from-json.js +0 -0
  128. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/is-message.js +0 -0
  129. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/json-value.js +0 -0
  130. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/merge.js +0 -0
  131. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/proto-int64.js +0 -0
  132. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/error.js +0 -0
  133. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/guard.js +0 -0
  134. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/index.js +0 -0
  135. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/message.js +0 -0
  136. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/names.js +0 -0
  137. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/nested-types.js +0 -0
  138. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/path.js +0 -0
  139. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/reflect-check.js +0 -0
  140. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/reflect-types.js +0 -0
  141. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/scalar.js +0 -0
  142. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/reflect/unsafe.js +0 -0
  143. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/to-binary.js +0 -0
  144. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/from-text.js +0 -0
  145. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/index.js +0 -0
  146. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/is-group-like.js +0 -0
  147. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/reader.js +0 -0
  148. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/txtpb/writer.js +0 -0
  149. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/types.js +0 -0
  150. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/unknown-enum.js +0 -0
  151. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/base64-encoding.js +0 -0
  152. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/index.js +0 -0
  153. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/size-delimited.js +0 -0
  154. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/text-format.js +0 -0
  155. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wire/varint.js +0 -0
  156. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/any.js +0 -0
  157. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/duration.js +0 -0
  158. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/any_pb.js +0 -0
  159. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/api_pb.js +0 -0
  160. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/c_sharp_features_pb.js +0 -0
  161. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/compiler/plugin_pb.js +0 -0
  162. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/cpp_features_pb.js +0 -0
  163. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/cpp_file_options_pb.js +0 -0
  164. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/cpp_options_pb.js +0 -0
  165. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/descriptor_pb.js +0 -0
  166. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/duration_pb.js +0 -0
  167. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/empty_pb.js +0 -0
  168. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/field_mask_pb.js +0 -0
  169. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/go_features_pb.js +0 -0
  170. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/java_features_pb.js +0 -0
  171. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/json_enumvalue_options_pb.js +0 -0
  172. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/json_options_pb.js +0 -0
  173. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/source_context_pb.js +0 -0
  174. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/struct_pb.js +0 -0
  175. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/timestamp_pb.js +0 -0
  176. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/type_pb.js +0 -0
  177. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/google/protobuf/wrappers_pb.js +0 -0
  178. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/index.js +0 -0
  179. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/json.js +0 -0
  180. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/timestamp.js +0 -0
  181. /package/node_modules/@bufbuild/protobuf/dist/{commonjs → cjs}/wkt/wrappers.js +0 -0
@@ -78,6 +78,7 @@ export class FetchHttpHandler {
78
78
  Object.assign(requestOptions, this.config.requestInit(request));
79
79
  }
80
80
  let removeSignalEventListener = () => { };
81
+ const timeout = requestTimeoutFn(requestTimeoutInMs);
81
82
  const fetchRequest = createRequest(url, requestOptions);
82
83
  const raceOfPromises = [
83
84
  fetchFn(fetchRequest).then((response) => {
@@ -106,7 +107,7 @@ export class FetchHttpHandler {
106
107
  }),
107
108
  };
108
109
  }),
109
- requestTimeoutFn(requestTimeoutInMs),
110
+ timeout.promise,
110
111
  ];
111
112
  if (abortSignal) {
112
113
  raceOfPromises.push(new Promise((resolve, reject) => {
@@ -124,7 +125,10 @@ export class FetchHttpHandler {
124
125
  }
125
126
  }));
126
127
  }
127
- return Promise.race(raceOfPromises).finally(removeSignalEventListener);
128
+ return Promise.race(raceOfPromises).finally(() => {
129
+ timeout.cancel();
130
+ removeSignalEventListener();
131
+ });
128
132
  }
129
133
  updateHttpClientConfig(key, value) {
130
134
  this.config = undefined;
@@ -1,11 +1,13 @@
1
1
  export function requestTimeout(timeoutInMs = 0) {
2
- return new Promise((resolve, reject) => {
2
+ let timeoutId;
3
+ const promise = new Promise((resolve, reject) => {
3
4
  if (timeoutInMs) {
4
- setTimeout(() => {
5
+ timeoutId = setTimeout(() => {
5
6
  const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`);
6
7
  timeoutError.name = "TimeoutError";
7
8
  reject(timeoutError);
8
9
  }, timeoutInMs);
9
10
  }
10
11
  });
12
+ return { promise, cancel: () => clearTimeout(timeoutId) };
11
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/fetch-http-handler",
3
- "version": "5.8.0",
3
+ "version": "5.8.1",
4
4
  "description": "Provides a way to make requests",
5
5
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/fetch-http-handler",
6
6
  "license": "Apache-2.0",
@@ -28,8 +28,8 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@smithy/core": "^3.33.3",
32
- "@smithy/types": "^4.18.0",
31
+ "@smithy/core": "^3.39.0",
32
+ "@smithy/types": "^4.20.0",
33
33
  "tslib": "^2.6.2"
34
34
  },
35
35
  "devDependencies": {
@@ -130,39 +130,41 @@ const resolveDefaultSocketTimeout = (config) => {
130
130
  };
131
131
 
132
132
  const DEFER_EVENT_LISTENER_TIME = 3000;
133
- const setSocketTimeout = (request, reject, timeoutInMs = 0, destroyResponseBodyOnTimeout = false) => {
134
- let response;
135
- if (destroyResponseBodyOnTimeout) {
136
- request.once("response", (res) => (response = res));
133
+ const setSocketTimeout = (request, reject, timeoutInMs = 0, isServiceDefault = false) => {
134
+ if (!Number.isFinite(timeoutInMs) || timeoutInMs <= 0) {
135
+ return;
137
136
  }
138
- const registerTimeout = (offset) => {
139
- const timeout = timeoutInMs - offset;
140
- const onTimeout = () => {
141
- const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${destroyResponseBodyOnTimeout ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
142
- if (destroyResponseBodyOnTimeout) {
143
- response?.destroy(error);
144
- }
145
- request.destroy();
146
- reject(error);
147
- };
148
- if (request.socket) {
149
- request.socket.setTimeout(timeout, onTimeout);
150
- request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
137
+ let response;
138
+ request.once("response", (res) => (response = res));
139
+ const onTimeout = () => {
140
+ if (response?.complete) {
141
+ request.socket?.destroy();
142
+ return;
143
+ }
144
+ const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${isServiceDefault ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
145
+ response?.destroy(error);
146
+ request.destroy();
147
+ reject(error);
148
+ };
149
+ const registerTimeout = () => {
150
+ const { socket } = request;
151
+ if (!socket) {
152
+ request.once("socket", registerTimeout);
153
+ }
154
+ else if (socket.connecting) {
155
+ socket.once("connect", registerTimeout);
151
156
  }
152
157
  else {
153
- request.setTimeout(timeout, onTimeout);
158
+ socket.setTimeout(timeoutInMs, onTimeout);
159
+ request.on("close", () => socket.removeListener("timeout", onTimeout));
154
160
  }
155
161
  };
156
- if (0 < timeoutInMs && timeoutInMs < 6000) {
157
- registerTimeout(0);
158
- return 0;
159
- }
160
- const deferralId = timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
161
- if (destroyResponseBodyOnTimeout) {
162
- request.once("close", () => timing.clearTimeout(deferralId));
163
- return 0;
162
+ if (timeoutInMs < 6000) {
163
+ registerTimeout();
164
+ return;
164
165
  }
165
- return deferralId;
166
+ const deferralId = timing.setTimeout(registerTimeout, DEFER_EVENT_LISTENER_TIME);
167
+ request.once("close", () => timing.clearTimeout(deferralId));
166
168
  };
167
169
 
168
170
  const MIN_WAIT_TIME = 6_000;
@@ -301,13 +303,11 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
301
303
  let socketWarningTimeoutId = -1;
302
304
  let connectionTimeoutId = -1;
303
305
  let requestTimeoutId = -1;
304
- let socketTimeoutId = -1;
305
306
  let keepAliveTimeoutId = -1;
306
307
  const clearTimeouts = () => {
307
308
  timing.clearTimeout(socketWarningTimeoutId);
308
309
  timing.clearTimeout(connectionTimeoutId);
309
310
  timing.clearTimeout(requestTimeoutId);
310
- timing.clearTimeout(socketTimeoutId);
311
311
  timing.clearTimeout(keepAliveTimeoutId);
312
312
  };
313
313
  const resolve = async (arg) => {
@@ -405,10 +405,10 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
405
405
  requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
406
406
  const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
407
407
  if (defaultSocketTimeout) {
408
- socketTimeoutId = setSocketTimeout(req, reject, defaultSocketTimeout, true);
408
+ setSocketTimeout(req, reject, defaultSocketTimeout, true);
409
409
  }
410
410
  else {
411
- socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
411
+ setSocketTimeout(req, reject, config.socketTimeout);
412
412
  }
413
413
  const httpAgent = nodeHttpsOptions.agent;
414
414
  if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
@@ -85,13 +85,11 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
85
85
  let socketWarningTimeoutId = -1;
86
86
  let connectionTimeoutId = -1;
87
87
  let requestTimeoutId = -1;
88
- let socketTimeoutId = -1;
89
88
  let keepAliveTimeoutId = -1;
90
89
  const clearTimeouts = () => {
91
90
  timing.clearTimeout(socketWarningTimeoutId);
92
91
  timing.clearTimeout(connectionTimeoutId);
93
92
  timing.clearTimeout(requestTimeoutId);
94
- timing.clearTimeout(socketTimeoutId);
95
93
  timing.clearTimeout(keepAliveTimeoutId);
96
94
  };
97
95
  const resolve = async (arg) => {
@@ -189,10 +187,10 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
189
187
  requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
190
188
  const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
191
189
  if (defaultSocketTimeout) {
192
- socketTimeoutId = setSocketTimeout(req, reject, defaultSocketTimeout, true);
190
+ setSocketTimeout(req, reject, defaultSocketTimeout, true);
193
191
  }
194
192
  else {
195
- socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
193
+ setSocketTimeout(req, reject, config.socketTimeout);
196
194
  }
197
195
  const httpAgent = nodeHttpsOptions.agent;
198
196
  if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
@@ -1,36 +1,38 @@
1
1
  import { timing } from "./timing";
2
2
  const DEFER_EVENT_LISTENER_TIME = 3000;
3
- export const setSocketTimeout = (request, reject, timeoutInMs = 0, destroyResponseBodyOnTimeout = false) => {
4
- let response;
5
- if (destroyResponseBodyOnTimeout) {
6
- request.once("response", (res) => (response = res));
3
+ export const setSocketTimeout = (request, reject, timeoutInMs = 0, isServiceDefault = false) => {
4
+ if (!Number.isFinite(timeoutInMs) || timeoutInMs <= 0) {
5
+ return;
7
6
  }
8
- const registerTimeout = (offset) => {
9
- const timeout = timeoutInMs - offset;
10
- const onTimeout = () => {
11
- const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${destroyResponseBodyOnTimeout ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
12
- if (destroyResponseBodyOnTimeout) {
13
- response?.destroy(error);
14
- }
15
- request.destroy();
16
- reject(error);
17
- };
18
- if (request.socket) {
19
- request.socket.setTimeout(timeout, onTimeout);
20
- request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
7
+ let response;
8
+ request.once("response", (res) => (response = res));
9
+ const onTimeout = () => {
10
+ if (response?.complete) {
11
+ request.socket?.destroy();
12
+ return;
13
+ }
14
+ const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${isServiceDefault ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
15
+ response?.destroy(error);
16
+ request.destroy();
17
+ reject(error);
18
+ };
19
+ const registerTimeout = () => {
20
+ const { socket } = request;
21
+ if (!socket) {
22
+ request.once("socket", registerTimeout);
23
+ }
24
+ else if (socket.connecting) {
25
+ socket.once("connect", registerTimeout);
21
26
  }
22
27
  else {
23
- request.setTimeout(timeout, onTimeout);
28
+ socket.setTimeout(timeoutInMs, onTimeout);
29
+ request.on("close", () => socket.removeListener("timeout", onTimeout));
24
30
  }
25
31
  };
26
- if (0 < timeoutInMs && timeoutInMs < 6000) {
27
- registerTimeout(0);
28
- return 0;
29
- }
30
- const deferralId = timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
31
- if (destroyResponseBodyOnTimeout) {
32
- request.once("close", () => timing.clearTimeout(deferralId));
33
- return 0;
32
+ if (timeoutInMs < 6000) {
33
+ registerTimeout();
34
+ return;
34
35
  }
35
- return deferralId;
36
+ const deferralId = timing.setTimeout(registerTimeout, DEFER_EVENT_LISTENER_TIME);
37
+ request.once("close", () => timing.clearTimeout(deferralId));
36
38
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/node-http-handler",
3
- "version": "4.14.1",
3
+ "version": "4.14.2",
4
4
  "description": "Provides a way to make requests",
5
5
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/node-http-handler",
6
6
  "license": "Apache-2.0",
@@ -29,8 +29,8 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@smithy/core": "^3.38.1",
33
- "@smithy/types": "^4.19.0",
32
+ "@smithy/core": "^3.39.0",
33
+ "@smithy/types": "^4.20.0",
34
34
  "tslib": "^2.6.2"
35
35
  },
36
36
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/types",
3
- "version": "4.19.0",
3
+ "version": "4.20.0",
4
4
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/types",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -44,7 +44,6 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
44
44
  - [Bits and pieces](#bits-and-pieces)
45
45
  - [.parse() and .parseAsync()](#parse-and-parseasync)
46
46
  - [Parsing Configuration](#parsing-configuration)
47
- - [Legacy options as properties](#legacy-options-as-properties)
48
47
  - [TypeScript](#typescript)
49
48
  - [createCommand()](#createcommand)
50
49
  - [Node options such as `--harmony`](#node-options-such-as---harmony)
@@ -54,7 +53,6 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
54
53
  - [Override exit and output handling](#override-exit-and-output-handling)
55
54
  - [Additional documentation](#additional-documentation)
56
55
  - [Support](#support)
57
- - [Commander for enterprise](#commander-for-enterprise)
58
56
 
59
57
  For information about terms used in this document see: [terminology](./docs/terminology.md)
60
58
 
@@ -367,7 +365,8 @@ Example file: [options-variadic.js](./examples/options-variadic.js)
367
365
  ```js
368
366
  program
369
367
  .option('-n, --number <numbers...>', 'specify numbers')
370
- .option('-l, --letter [letters...]', 'specify letters');
368
+ .option('-l, --letter [letters...]', 'specify letters')
369
+ .argument('[operand]');
371
370
 
372
371
  program.parse();
373
372
 
@@ -380,10 +379,10 @@ $ collect -n 1 2 3 --letter a b c
380
379
  Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] }
381
380
  Remaining arguments: []
382
381
  $ collect --letter=A -n80 operand
383
- Options: { number: [ '80' ], letter: [ 'A' ] }
382
+ Options: { letter: [ 'A' ], number: [ '80' ] }
384
383
  Remaining arguments: [ 'operand' ]
385
384
  $ collect --letter -n 1 -n 2 3 -- operand
386
- Options: { number: [ '1', '2', '3' ], letter: true }
385
+ Options: { letter: true, number: [ '1', '2', '3' ] }
387
386
  Remaining arguments: [ 'operand' ]
388
387
  ```
389
388
 
@@ -670,7 +669,7 @@ Example file: [action-this.js](./examples/action-this.js)
670
669
  program
671
670
  .command('serve')
672
671
  .argument('<script>')
673
- .option('-p, --port <number>', 'port number', 80)
672
+ .option('-p, --port <number>', 'port number', '80')
674
673
  .action(function() {
675
674
  console.error('Run script %s on port %s', this.args[0], this.opts().port);
676
675
  });
@@ -1016,25 +1015,6 @@ By default, the option processing shows an error for an unknown option. To have
1016
1015
  By default, the argument processing displays an error for more command-arguments than expected.
1017
1016
  To suppress the error for excess arguments, use `.allowExcessArguments()`.
1018
1017
 
1019
- ### Legacy options as properties
1020
-
1021
- Before Commander 7, the option values were stored as properties on the command.
1022
- This was convenient to code, but the downside was possible clashes with
1023
- existing properties of `Command`.
1024
-
1025
- You can revert to the old behaviour to run unmodified legacy code by using `.storeOptionsAsProperties()`.
1026
-
1027
- ```js
1028
- program
1029
- .storeOptionsAsProperties()
1030
- .option('-d, --debug')
1031
- .action((commandAndOptions) => {
1032
- if (commandAndOptions.debug) {
1033
- console.error(`Called ${commandAndOptions.name()}`);
1034
- }
1035
- });
1036
- ```
1037
-
1038
1018
  ### TypeScript
1039
1019
 
1040
1020
  **extra-typings:** There is an optional project to infer extra type information from the option and argument definitions.
@@ -1075,7 +1055,7 @@ You can enable `--harmony` option in two ways:
1075
1055
 
1076
1056
  An executable subcommand is launched as a separate child process.
1077
1057
 
1078
- If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al.,
1058
+ If you are using the node inspector for [debugging](https://nodejs.org/en/learn/getting-started/debugging) executable subcommands using `node --inspect` et al.,
1079
1059
  the inspector port is incremented by 1 for the spawned subcommand.
1080
1060
 
1081
1061
  If you are using VSCode to debug executable subcommands you need to set the `"autoAttachChildProcesses": true` flag in your `launch.json` configuration.
@@ -1164,9 +1144,3 @@ The current version of Commander is fully supported on Long Term Support version
1164
1144
  Older major versions of Commander receive security updates for 12 months. For more see: [Release Policy](./docs/release-policy.md).
1165
1145
 
1166
1146
  The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub.
1167
-
1168
- ### Commander for enterprise
1169
-
1170
- Available as part of the Tidelift Subscription
1171
-
1172
- The maintainers of Commander and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
@@ -18,4 +18,4 @@ export const createArgument = (name, description) =>
18
18
 
19
19
  export { Command, Option, Argument, Help };
20
20
  export { CommanderError, InvalidArgumentError };
21
- export { InvalidArgumentError as InvalidOptionArgumentError }; // Deprecated
21
+ export { InvalidArgumentError as InvalidOptionArgumentError };
@@ -975,7 +975,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
975
975
  // global overwrites local, like optsWithGlobals
976
976
  let source;
977
977
  this._getCommandAndAncestors().forEach((cmd) => {
978
- if (cmd.getOptionValueSource(key) !== undefined) {
978
+ if (Object.hasOwn(cmd._optionValueSources, key)) {
979
979
  source = cmd.getOptionValueSource(key);
980
980
  }
981
981
  });
@@ -1768,7 +1768,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1768
1768
 
1769
1769
  const negativeNumberArg = (arg) => {
1770
1770
  // return false if not a negative number
1771
- if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg)) return false;
1771
+ if (!/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(arg)) return false;
1772
1772
  // negative number is ok unless digit used as an option in command hierarchy
1773
1773
  return !this._getCommandAndAncestors().some((cmd) =>
1774
1774
  cmd.options
@@ -2366,7 +2366,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2366
2366
  * (This does not override a group set directly on the subcommand using .helpGroup().)
2367
2367
  *
2368
2368
  * @example
2369
- * program.commandsGroup('Development Commands:);
2369
+ * program.commandsGroup('Development Commands:');
2370
2370
  * program.command('watch')...
2371
2371
  * program.command('lint')...
2372
2372
  * ...
@@ -2562,7 +2562,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2562
2562
  * Pass in false to disable the built-in help option.
2563
2563
  *
2564
2564
  * @example
2565
- * program.helpOption('-?, --help' 'show help'); // customise
2565
+ * program.helpOption('-?, --help', 'show help'); // customise
2566
2566
  * program.helpOption(false); // disable
2567
2567
  *
2568
2568
  * @param {(string | boolean)} flags
@@ -2720,7 +2720,12 @@ function incrementNodeInspectorPort(args) {
2720
2720
  // Testing for these options:
2721
2721
  // --inspect[=[host:]port]
2722
2722
  // --inspect-brk[=[host:]port]
2723
+ // --inspect-wait[=[host:]port]
2723
2724
  // --inspect-port=[host:]port
2725
+ //
2726
+ // Host can be an IP literal encapsulated within square brackets (e.g. [::1]),
2727
+ // an IPv4 address in dotted-decimal form (e.g. 192.168.0.1), or a registered name.
2728
+ // https://www.rfc-editor.org/rfc/rfc3986.html#section-3.2.2
2724
2729
  return args.map((arg) => {
2725
2730
  if (!arg.startsWith('--inspect')) {
2726
2731
  return arg;
@@ -2729,24 +2734,32 @@ function incrementNodeInspectorPort(args) {
2729
2734
  let debugHost = '127.0.0.1';
2730
2735
  let debugPort = '9229';
2731
2736
  let match;
2732
- if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
2737
+ if ((match = arg.match(/^(--inspect(-brk|-wait)?)$/)) !== null) {
2733
2738
  // e.g. --inspect
2734
2739
  debugOption = match[1];
2735
2740
  } else if (
2736
- (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null
2741
+ (match = arg.match(
2742
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/,
2743
+ )) !== null
2737
2744
  ) {
2745
+ // Matches a host or a port, but not both. No colon to separate them.
2738
2746
  debugOption = match[1];
2739
2747
  if (/^\d+$/.test(match[3])) {
2748
+ // Plain digits so a port number.
2740
2749
  // e.g. --inspect=1234
2741
2750
  debugPort = match[3];
2742
2751
  } else {
2743
- // e.g. --inspect=localhost
2752
+ // Assume a host.
2753
+ // e.g. --inspect=localhost, --inspect=[::1], --inspect=192.168.0.1
2744
2754
  debugHost = match[3];
2745
2755
  }
2746
2756
  } else if (
2747
- (match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null
2757
+ (match = arg.match(
2758
+ /^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/,
2759
+ )) !== null
2748
2760
  ) {
2749
- // e.g. --inspect=localhost:1234
2761
+ // Matched host:port pattern.
2762
+ // e.g. --inspect=localhost:1234, --inspect=[::1]:1234, --inspect=192.168.0.1:1234
2750
2763
  debugOption = match[1];
2751
2764
  debugHost = match[3];
2752
2765
  debugPort = match[4];
@@ -89,11 +89,15 @@ export class Help {
89
89
  visibleOptions.push(helpOption); // no changes needed
90
90
  } else if (helpOption.long && !removeLong) {
91
91
  visibleOptions.push(
92
- cmd.createOption(helpOption.long, helpOption.description),
92
+ cmd
93
+ .createOption(helpOption.long, helpOption.description)
94
+ .helpGroup(helpOption.helpGroupHeading),
93
95
  );
94
96
  } else if (helpOption.short && !removeShort) {
95
97
  visibleOptions.push(
96
- cmd.createOption(helpOption.short, helpOption.description),
98
+ cmd
99
+ .createOption(helpOption.short, helpOption.description)
100
+ .helpGroup(helpOption.helpGroupHeading),
97
101
  );
98
102
  }
99
103
  }
@@ -15,7 +15,7 @@ export class Option {
15
15
  this.required = flags.includes('<'); // A value must be supplied when the option is specified.
16
16
  this.optional = flags.includes('['); // A value is optional when the option is specified.
17
17
  // variadic test ignores <value,...> et al which might be used to describe custom splitting of single argument
18
- this.variadic = /\w\.\.\.[>\]]$/.test(flags); // The option can take multiple values.
18
+ this.variadic = /\p{ID_Continue}\.\.\.[>\]]$/u.test(flags); // The option can take multiple values.
19
19
  this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.
20
20
  const optionFlags = splitOptionFlags(flags);
21
21
  this.short = optionFlags.shortFlag; // May be a short flag, undefined, or even a long flag (if option has two long flags).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commander",
3
- "version": "15.0.0",
3
+ "version": "15.1.0",
4
4
  "description": "the complete solution for node.js command-line programs",
5
5
  "keywords": [
6
6
  "commander",
@@ -37,6 +37,7 @@
37
37
  "@types/node": "^22.7.4",
38
38
  "eslint": "^10.0.2",
39
39
  "eslint-config-prettier": "^10.0.1",
40
+ "eslint-node-test": "^1.0.0",
40
41
  "globals": "^17.3.0",
41
42
  "prettier": "^3.2.5",
42
43
  "tsd": "^0.33.0",
@@ -32,42 +32,67 @@ export class VFileMessage extends Error {
32
32
  *
33
33
  * @overload
34
34
  * @param {string} reason
35
+ * Reason for message, should use markdown.
35
36
  * @param {Options | null | undefined} [options]
37
+ * Configuration (optional).
36
38
  * @returns
39
+ * Instance of `VFileMessage`.
37
40
  *
38
41
  * @overload
39
42
  * @param {string} reason
43
+ * Reason for message, should use markdown.
40
44
  * @param {Node | NodeLike | null | undefined} parent
45
+ * Node or node-like, used for `ancestors` and `place`.
41
46
  * @param {string | null | undefined} [origin]
47
+ * Place in code where the message originates (optional).
42
48
  * @returns
49
+ * Instance of `VFileMessage`.
43
50
  *
44
51
  * @overload
45
52
  * @param {string} reason
53
+ * Reason for message, should use markdown.
46
54
  * @param {Point | Position | null | undefined} place
55
+ * Place of message.
47
56
  * @param {string | null | undefined} [origin]
57
+ * Place in code where the message originates (optional).
48
58
  * @returns
59
+ * Instance of `VFileMessage`.
49
60
  *
50
61
  * @overload
51
62
  * @param {string} reason
63
+ * Reason for message, should use markdown.
52
64
  * @param {string | null | undefined} [origin]
65
+ * Place in code where the message originates (optional).
53
66
  * @returns
67
+ * Instance of `VFileMessage`.
54
68
  *
55
69
  * @overload
56
70
  * @param {Error | VFileMessage} cause
71
+ * Original error cause of the message.
57
72
  * @param {Node | NodeLike | null | undefined} parent
73
+ * Node or node-like, used for `ancestors` and `place`.
58
74
  * @param {string | null | undefined} [origin]
75
+ * Place in code where the message originates (optional).
59
76
  * @returns
77
+ * Instance of `VFileMessage`.
60
78
  *
61
79
  * @overload
62
80
  * @param {Error | VFileMessage} cause
81
+ * Original error cause of the message.
63
82
  * @param {Point | Position | null | undefined} place
83
+ * Place of message.
64
84
  * @param {string | null | undefined} [origin]
85
+ * Place in code where the message originates (optional).
65
86
  * @returns
87
+ * Instance of `VFileMessage`.
66
88
  *
67
89
  * @overload
68
90
  * @param {Error | VFileMessage} cause
91
+ * Original error cause of the message.
69
92
  * @param {string | null | undefined} [origin]
93
+ * Place in code where the message originates (optional).
70
94
  * @returns
95
+ * Instance of `VFileMessage`.
71
96
  *
72
97
  * @param {Error | VFileMessage | string} causeOrReason
73
98
  * Reason for message, should use markdown.
@@ -143,7 +168,7 @@ export class VFileMessage extends Error {
143
168
  }
144
169
  }
145
170
 
146
- if (!options.place && options.ancestors && options.ancestors) {
171
+ if (!options.place && options.ancestors) {
147
172
  const parent = options.ancestors[options.ancestors.length - 1]
148
173
 
149
174
  if (parent) {
@@ -216,6 +241,8 @@ export class VFileMessage extends Error {
216
241
  *
217
242
  * On normal errors, this would be something like `ParseError`, buit in
218
243
  * `VFile` messages we use this space to show where an error happened.
244
+ *
245
+ * @type {string}
219
246
  */
220
247
  this.name = stringifyPosition(options.place) || '1:1'
221
248
 
@@ -299,16 +326,19 @@ export class VFileMessage extends Error {
299
326
  }
300
327
  }
301
328
 
302
- VFileMessage.prototype.file = ''
303
- VFileMessage.prototype.name = ''
304
- VFileMessage.prototype.reason = ''
305
- VFileMessage.prototype.message = ''
306
- VFileMessage.prototype.stack = ''
307
- VFileMessage.prototype.column = undefined
308
- VFileMessage.prototype.line = undefined
309
- VFileMessage.prototype.ancestors = undefined
310
- VFileMessage.prototype.cause = undefined
311
- VFileMessage.prototype.fatal = undefined
312
- VFileMessage.prototype.place = undefined
313
- VFileMessage.prototype.ruleId = undefined
314
- VFileMessage.prototype.source = undefined
329
+ // eslint-disable-next-line unicorn/no-top-level-side-effects -- our own class.
330
+ Object.defineProperties(VFileMessage.prototype, {
331
+ file: {configurable: true, enumerable: true, value: '', writable: true},
332
+ name: {configurable: true, enumerable: true, value: '', writable: true},
333
+ reason: {configurable: true, enumerable: true, value: '', writable: true},
334
+ message: {configurable: true, enumerable: true, value: '', writable: true},
335
+ stack: {configurable: true, enumerable: true, value: '', writable: true},
336
+ column: {configurable: true, enumerable: true, writable: true},
337
+ line: {configurable: true, enumerable: true, writable: true},
338
+ ancestors: {configurable: true, enumerable: true, writable: true},
339
+ cause: {configurable: true, enumerable: true, writable: true},
340
+ fatal: {configurable: true, enumerable: true, writable: true},
341
+ place: {configurable: true, enumerable: true, writable: true},
342
+ ruleId: {configurable: true, enumerable: true, writable: true},
343
+ source: {configurable: true, enumerable: true, writable: true}
344
+ })