ai 7.0.40 → 7.0.41

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.41
4
+
5
+ ### Patch Changes
6
+
7
+ - 2e2224b: Route the warning system information banner to stderr so it does not corrupt application output written to stdout.
8
+ - Updated dependencies [bf216b3]
9
+ - @ai-sdk/gateway@4.0.31
10
+
3
11
  ## 7.0.40
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -598,6 +598,16 @@ function formatWarning({
598
598
  }
599
599
  var FIRST_WARNING_INFO_MESSAGE = "AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.";
600
600
  var hasLoggedBefore = false;
601
+ function emitWarning({
602
+ message,
603
+ type
604
+ }) {
605
+ if (typeof process !== "undefined" && typeof process.emitWarning === "function") {
606
+ process.emitWarning(message, { type });
607
+ } else {
608
+ console.warn(message);
609
+ }
610
+ }
601
611
  var logWarnings = (options) => {
602
612
  if (options.warnings.length === 0) {
603
613
  return;
@@ -612,7 +622,10 @@ var logWarnings = (options) => {
612
622
  }
613
623
  if (!hasLoggedBefore) {
614
624
  hasLoggedBefore = true;
615
- console.info(FIRST_WARNING_INFO_MESSAGE);
625
+ emitWarning({
626
+ message: FIRST_WARNING_INFO_MESSAGE,
627
+ type: "Warning"
628
+ });
616
629
  }
617
630
  for (const warning of options.warnings) {
618
631
  const message = formatWarning({
@@ -620,13 +633,10 @@ var logWarnings = (options) => {
620
633
  provider: options.provider,
621
634
  model: options.model
622
635
  });
623
- if (typeof process !== "undefined" && typeof process.emitWarning === "function") {
624
- process.emitWarning(message, {
625
- type: warning.type === "deprecated" ? "DeprecationWarning" : "Warning"
626
- });
627
- } else {
628
- console.warn(message);
629
- }
636
+ emitWarning({
637
+ message,
638
+ type: warning.type === "deprecated" ? "DeprecationWarning" : "Warning"
639
+ });
630
640
  }
631
641
  };
632
642
 
@@ -1132,7 +1142,7 @@ import {
1132
1142
  } from "@ai-sdk/provider-utils";
1133
1143
 
1134
1144
  // src/version.ts
1135
- var VERSION = true ? "7.0.40" : "0.0.0-test";
1145
+ var VERSION = true ? "7.0.41" : "0.0.0-test";
1136
1146
 
1137
1147
  // src/util/download/download.ts
1138
1148
  var download = async ({