ai 7.0.39 → 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.
@@ -85,7 +85,7 @@ import {
85
85
  } from "@ai-sdk/provider-utils";
86
86
 
87
87
  // src/version.ts
88
- var VERSION = true ? "7.0.39" : "0.0.0-test";
88
+ var VERSION = true ? "7.0.41" : "0.0.0-test";
89
89
 
90
90
  // src/util/download/download.ts
91
91
  var download = async ({
@@ -339,6 +339,16 @@ function formatWarning({
339
339
  }
340
340
  var FIRST_WARNING_INFO_MESSAGE = "AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.";
341
341
  var hasLoggedBefore = false;
342
+ function emitWarning({
343
+ message,
344
+ type
345
+ }) {
346
+ if (typeof process !== "undefined" && typeof process.emitWarning === "function") {
347
+ process.emitWarning(message, { type });
348
+ } else {
349
+ console.warn(message);
350
+ }
351
+ }
342
352
  var logWarnings = (options) => {
343
353
  if (options.warnings.length === 0) {
344
354
  return;
@@ -353,7 +363,10 @@ var logWarnings = (options) => {
353
363
  }
354
364
  if (!hasLoggedBefore) {
355
365
  hasLoggedBefore = true;
356
- console.info(FIRST_WARNING_INFO_MESSAGE);
366
+ emitWarning({
367
+ message: FIRST_WARNING_INFO_MESSAGE,
368
+ type: "Warning"
369
+ });
357
370
  }
358
371
  for (const warning of options.warnings) {
359
372
  const message = formatWarning({
@@ -361,13 +374,10 @@ var logWarnings = (options) => {
361
374
  provider: options.provider,
362
375
  model: options.model
363
376
  });
364
- if (typeof process !== "undefined" && typeof process.emitWarning === "function") {
365
- process.emitWarning(message, {
366
- type: warning.type === "deprecated" ? "DeprecationWarning" : "Warning"
367
- });
368
- } else {
369
- console.warn(message);
370
- }
377
+ emitWarning({
378
+ message,
379
+ type: warning.type === "deprecated" ? "DeprecationWarning" : "Warning"
380
+ });
371
381
  }
372
382
  };
373
383